Skip to content

Conversation

@ben-alkov
Copy link
Member

Maintainers will complete the following section

  • Commit messages are descriptive enough
  • Code coverage from testing does not decrease and new code is covered
  • [n/a] JSON/YAML configuration changes are updated in the relevant schema
  • [n/a] Changes to metadata also update the documentation for the metadata
  • Pull request has a link to an osbs-docs PR for user documentation updates

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

@ben-alkov ben-alkov requested a review from MartinBasti December 6, 2024 16:50
@ben-alkov ben-alkov self-assigned this Dec 6, 2024
return self.uri


def _enforce_sandbox(repo_root: str, *, remove_unsafe_symlinks: bool) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be a private method if we want to use it in atomic-reactor

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

Signed-off-by: Ben Alkov <[email protected]>
@ben-alkov
Copy link
Member Author

Moved implementation to atomic-reactor - it fits better there.

@ben-alkov ben-alkov closed this Dec 17, 2024
@ben-alkov ben-alkov deleted the feat-utils-symlink-sandbox branch January 13, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants