feat(linters): add trivy_secret#790
Open
BestChinchilla wants to merge 2 commits intomfussenegger:masterfrom
Open
feat(linters): add trivy_secret#790BestChinchilla wants to merge 2 commits intomfussenegger:masterfrom
BestChinchilla wants to merge 2 commits intomfussenegger:masterfrom
Conversation
Owner
Contributor
It is possible to run multiple scanners in one go, like The question becomes what if a user only wants to run one or the other scanner? Update: According to trivy config file reference, it is possible to configure scan:
scanners:
- vuln
- secret
- misconfig
- licenseI tested this locally and it seems to work as expected:
% trivy fs .
2025-05-21T08:39:35-07:00 INFO [vuln] Vulnerability scanning is enabled
2025-05-21T08:39:35-07:00 INFO [secret] Secret scanning is enabled
2025-05-21T08:39:35-07:00 INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2025-05-21T08:39:35-07:00 INFO [secret] Please see also https://trivy.dev/v0.62/docs/scanner/secret#recommendation for faster secret detection
2025-05-21T08:39:35-07:00 INFO Number of language-specific files num=0
2025-05-21T08:39:35-07:00 WARN [report] Supported files for scanner(s) not found. scanners=[vuln]
2025-05-21T08:39:35-07:00 INFO [report] No issues detected with scanner(s). scanners=[secret]
Report Summary
┌────────┬──────┬─────────────────┬─────────┐
│ Target │ Type │ Vulnerabilities │ Secrets │
├────────┼──────┼─────────────────┼─────────┤
│ - │ - │ - │ - │
└────────┴──────┴─────────────────┴─────────┘
Legend:
- '-': Not scanned
- '0': Clean (no security findings detected)
% trivy fs .
2025-05-21T08:39:49-07:00 INFO Loaded file_path="trivy.yaml"
2025-05-21T08:39:49-07:00 INFO [vuln] Vulnerability scanning is enabled
2025-05-21T08:39:49-07:00 INFO [misconfig] Misconfiguration scanning is enabled
2025-05-21T08:39:49-07:00 INFO [secret] Secret scanning is enabled
2025-05-21T08:39:49-07:00 INFO [secret] If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2025-05-21T08:39:49-07:00 INFO [secret] Please see also https://trivy.dev/v0.62/docs/scanner/secret#recommendation for faster secret detection
2025-05-21T08:39:49-07:00 INFO [license] License scanning is enabled
2025-05-21T08:39:49-07:00 INFO Number of language-specific files num=0
2025-05-21T08:39:49-07:00 INFO Detected config files num=0
2025-05-21T08:39:49-07:00 WARN [report] Supported files for scanner(s) not found. scanners=[misconfig vuln]
2025-05-21T08:39:49-07:00 INFO [report] No issues detected with scanner(s). scanners=[license secret]
Report Summary
┌────────┬──────┬──────────┬─────────┬───────────────────┬─────────────────┐
│ Target │ Type │ Licenses │ Secrets │ Misconfigurations │ Vulnerabilities │
├────────┼──────┼──────────┼─────────┼───────────────────┼─────────────────┤
│ - │ - │ - │ - │ - │ - │
└────────┴──────┴──────────┴─────────┴───────────────────┴─────────────────┘
Legend:
- '-': Not scanned
- '0': Clean (no security findings detected)This approach gives users the flexibility to configure trivy uniquely for each project. |
Author
|
I can try adding more if conditions for each of the scanners, but I don't write in Lua, so it might not be exactly best practice code :D |
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.
nvim-lint already have trivy linter, but it only scans for misconfig, this PR adding secret scanner functionality to make more safer development process
POC:
