-
Notifications
You must be signed in to change notification settings - Fork 102
fix: Trivy fails with "invalid tar header" when scanning Copa-patched images #1359
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
fix: Trivy fails with "invalid tar header" when scanning Copa-patched images #1359
Conversation
…scanning issues Signed-off-by: robert-cronin <robert.owen.cronin@gmail.com>
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.
Pull Request Overview
This PR fixes a Trivy scanning issue (#1358) where Copa-patched images fail with "invalid tar header" errors. The fix ensures that locally exported images use uncompressed layers, which resolves hash mismatches that occur when diff_id and blob digest differ due to compression.
Key changes:
- Added
compression=uncompressedattribute to BuildKit export configuration for non-push (local) exports - Added
force-compression=trueto ensure the compression attribute is applied
| // Use uncompressed layers for local export to ensure diff_id == blob digest | ||
| // This fixes Trivy scanning issues where compressed layers have mismatched hashes |
Copilot
AI
Oct 28, 2025
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.
The comment explains the purpose of uncompressed layers but doesn't clarify why force-compression=true is needed alongside compression=uncompressed. Consider expanding the comment to explain that force-compression ensures the compression setting is applied even when BuildKit might otherwise use defaults.
| // Use uncompressed layers for local export to ensure diff_id == blob digest | |
| // This fixes Trivy scanning issues where compressed layers have mismatched hashes | |
| // Use uncompressed layers for local export to ensure diff_id == blob digest. | |
| // This fixes Trivy scanning issues where compressed layers have mismatched hashes. | |
| // Note: BuildKit may ignore the 'compression' setting and use its default unless 'force-compression' is set to 'true'. | |
| // Setting both ensures that the compression setting is always applied as intended. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1359 +/- ##
==========================================
+ Coverage 39.49% 39.51% +0.02%
==========================================
Files 42 42
Lines 5879 5881 +2
==========================================
+ Hits 2322 2324 +2
Misses 3361 3361
Partials 196 196 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: robert-cronin <robert.owen.cronin@gmail.com>
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.
LGTM
… images (#1359) Signed-off-by: robert-cronin <robert.owen.cronin@gmail.com>
Changes:
Closes #1358