Skip to content

feat: add configurable file count, depth, and more link support#1350

Merged
egibs merged 6 commits intochainguard-dev:mainfrom
egibs:add-depth-config
Feb 3, 2026
Merged

feat: add configurable file count, depth, and more link support#1350
egibs merged 6 commits intochainguard-dev:mainfrom
egibs:add-depth-config

Conversation

@egibs
Copy link
Member

@egibs egibs commented Feb 3, 2026

This PR adds two new flags to configure the maximum number of files to scan along with the maximum depth allowed when recursively extracting archives. Both values can be unlimited but have defaults which should cover most requirements.

This PR also adds some gating around the UPX binary we use and doesn't just automatically use the first result from PATH. Instead, a known path can be provided via MALCONTENT_UPX_PATH. For example, the Makefile uses this to automatically source the local UPX binary for sample testdata refreshes. If this is an empty string, we'll use /usr/bin/upx which is the default Wolfi location.

Finally, this PR adds additional symlink validations in handleSymlink, general hardlink/symlink support, and uses the file.GetContents function to read existing report content in diff.go which is how we retrieve file contents everywhere else. We didn't have any test coverage for the less common archive types, so I added four new samples and tests for Deb, RPM, Zlib, and Zstd extractions as well.

Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs marked this pull request as ready for review February 3, 2026 17:29
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
egibs added 2 commits February 3, 2026 12:32
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs changed the title feat: add configurable file count and depth; misc. tweaks feat: add configurable file count, depth, and more link support Feb 3, 2026
@egibs egibs force-pushed the add-depth-config branch 2 times, most recently from c330b4d to 3a3509a Compare February 3, 2026 20:03
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested a review from stevebeattie February 3, 2026 20:15
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Copy link
Member

@stevebeattie stevebeattie left a comment

Choose a reason for hiding this comment

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

Nice, thanks, really appreciate the added testcases in addition to the rest of the improvements,

@egibs egibs merged commit 8223117 into chainguard-dev:main Feb 3, 2026
18 checks passed
@egibs egibs deleted the add-depth-config branch February 3, 2026 22:18
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