-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat(utils): implement symlink sandbox for cachi2 #2139
feat(utils): implement symlink sandbox for cachi2 #2139
Conversation
What/why: implement detection/removal of unsafe symlinks in repos, specifically covering cachi2 use case: Cachito already does this How: - copypasta `_enforce_sandbox()` and related unit tests from Cachito ("cachito/cachito/workers/tasks/general.py" and "cachito/tests/test_workers/test_tasks/test_general.py", respectively) - add call to `_enforce_sandbox()` - add CLI boolean arg `remove-unsafe-symlinks`, which toggles removing all symlinks which point to location(s) outside of any cloned repository Signed-off-by: Ben Alkov <[email protected]> rh-pre-commit.version: 2.3.2 rh-pre-commit.check-secrets: ENABLED
LGTM, just tests are failing for some reason |
why is this in commit message? |
@@ -135,6 +135,7 @@ def process_remote_sources(self) -> List[Dict[str, Any]]: | |||
remote_source_data["ref"] | |||
) | |||
|
|||
enforce_sandbox(source_path_app, remove_unsafe_symlinks=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be removal of unsafe symlinks implemented in followup PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had intended it for this PR, but it can be in a followup if you want to get this merged sooner.
It's a pre-commit hook to check for secrets. |
f7064c7
into
containerbuildsystem:feature_cachi2
But why should a random local RH specific pre-commit be recorded in commits upstream? |
Noted. Commit message disabled. |
What/why: implement detection/removal of unsafe symlinks in repos, specifically
covering cachi2 use case: Cachito already does this
How:
_enforce_sandbox()
and related unit tests from Cachito ("cachito/cachito/workers/tasks/general.py" and "cachito/tests/test_workers/test_tasks/test_general.py", respectively)_enforce_sandbox()
remove-unsafe-symlinks
, which toggles removing all symlinks which point to location(s) outside of any cloned repositorySigned-off-by: Ben Alkov [email protected]
rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
Maintainers will complete the following section