fix(flag): validate template file extension#10296
Open
DmitriyLewen wants to merge 6 commits intoaquasecurity:mainfrom
Open
fix(flag): validate template file extension#10296DmitriyLewen wants to merge 6 commits intoaquasecurity:mainfrom
DmitriyLewen wants to merge 6 commits intoaquasecurity:mainfrom
Conversation
Require .tpl extension for template files specified via --template flag to prevent arbitrary file disclosure through the reporting system. Template paths starting with @ are validated only when --format template is specified. Inline templates (without @ prefix) are not affected.
Add test cases to verify: - Template files with .tpl extension are accepted - Template files without .tpl extension are rejected - Files with wrong extension are rejected - Inline templates (without @ prefix) are allowed
Regenerate documentation to reflect the new .tpl extension requirement for template files.
Update the "Load templates from a file" section to explicitly mention that template files must have .tpl extension.
Contributor
Author
|
Reopened from #10220 after recreating the fork. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds security validation to the
--templateflag to prevent arbitrary file disclosure. Previously, users could specify any file path (e.g., @/etc/passwd) as a template, and Trivy would read and potentially expose its contents in thereport output. Now, template files must have the .tpl extension.
Changes
Benefits
Checklist