Skip to content

Conversation

@jonjohnsonjr
Copy link
Contributor

This should probably be an allowlist like apk does, but this is a smaller diff and I'm worried about breaking more things.

This should probably be an allowlist like apk does, but this is a
smaller diff and I'm worried about breaking more things.

Signed-off-by: Jon Johnson <jon.johnson@chainguard.dev>
@jonjohnsonjr jonjohnsonjr enabled auto-merge (squash) December 11, 2024 00:34
Comment on lines +157 to +160
// Ignore files that aren't executable.
// This is mostly to ignore .melange.yaml files in the control section,
// but apk itself has hardcoded list of scripts that we might want to do too.
if header.FileInfo().Mode().Perm()&0555 != 0555 {
Copy link
Member

Choose a reason for hiding this comment

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

It's not immediately obvious to me from this why we're checking for these exact perm bits (r+x for all 3) but maybe that's just because I don't know this part of the domain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FWIW I copied this from melange SCA that does similar checks for entirely different reasons, and it matched what I saw from sampling real-world scripts in alpine. If this ends up being brittle I'll come back and figure out exactly what apk does here and replicate it.

@jonjohnsonjr jonjohnsonjr merged commit c269982 into chainguard-dev:main Dec 11, 2024
18 checks passed
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