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

Execute syft scan in chroot environment #13

Merged
merged 1 commit into from
Jan 5, 2023
Merged

Conversation

jedevc
Copy link
Collaborator

@jedevc jedevc commented Jan 3, 2023

When scanning a directory, the syft scanner resolves symlinks inside the target directory in the context of the host filesystem. However, for our purposes, the target filesystem is entirely self-contained. In lieu of syft changes, we can temporarily hack around this limitation by executing the scanner in a chroot-ed environment.

See anchore/syft#1359 for more context.

With this change, we see fewer warning messages of the form (though we may still see some due to broken symlinks):

#20 0.395 [0000]  WARN unable to access path="/bin/busybox": lstat /bin/busybox: no such file or directory

When scanning a directory, the syft scanner resolves symlinks inside the
target directory in the context of the host filesystem. However, for our
purposes, the target filesystem is entirely self-contained. In lieu of
syft changes, we can temporarily hack around this limitation by
executing the scanner in a chroot-ed environment.

Signed-off-by: Justin Chadwell <me@jedevc.com>
Copy link
Member

@tonistiigi tonistiigi left a comment

Choose a reason for hiding this comment

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

This should be fine as long as it is imported only from cmd and runs single-threaded. Otherwise, bad things can happen.

@tonistiigi tonistiigi merged commit 370ddaf into master Jan 5, 2023
@jedevc jedevc deleted the chroot-scanner branch January 6, 2023 10:50
@jedevc jedevc mentioned this pull request Jan 31, 2023
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.

None yet

2 participants