Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #24011: Archiving allows to read inconsistent active technique category ids #5314

Conversation

clarktsiory
Copy link
Contributor

@clarktsiory clarktsiory commented Jan 11, 2024

https://issues.rudder.io/issues/24011

A lot of changes but the main one is throwing an error when accessing files outside the root configuration directory in with git (/var/rudder/configuration-repository) : https://github.com/Normation/rudder/pull/5314/files#diff-bb5734a3493073add0df1291f147ac6cd515b8a211f543610446796ed2374441R169-R187...

This should avoid this method to be identified as vulnerable by any smart vulnerability scanners that could also detect the initial vulnerability...

}
val target = recNewCategoryDirectory(catId, parents)

if (target.getCanonicalPath().startsWith(getItemDirectory.getCanonicalPath())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

uptcFile <- newActiveTechniquecFile(uptcId, getParents)
gitPath = toGitPath(uptcFile)
// don't forget to delete the category *directory*
_ <- ZIO.whenZIO(IOResult.attempt(uptcFile.exists)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes I added this IOResult.attempt wrapper check over file.exists I/O calls...

Copy link
Member

@fanf fanf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but could you add an unit test demonstrating the new behavior?

@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

1 similar comment
@clarktsiory
Copy link
Contributor Author

PR updated with a new commit

@clarktsiory
Copy link
Contributor Author

Added the unit test here, indeed the behavior is changed to raising the error in the IOResult : 1b69b90

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/rudder/pull/5314
-- Your faithful QA
Kant merge: "Happiness is not an ideal of reason, but of imagination."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/79719/console)

@clarktsiory
Copy link
Contributor Author

PR rebased

@clarktsiory clarktsiory force-pushed the bug_24011/archiving_allows_to_read_inconsistent_active_technique_category_ids branch from d90d288 to 574a23d Compare February 7, 2024 08:49
@fanf
Copy link
Member

fanf commented Feb 7, 2024

OK, merging this PR

@fanf fanf merged commit 574a23d into Normation:branches/rudder/7.3 Feb 7, 2024
15 checks passed
@clarktsiory clarktsiory mentioned this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants