-
-
Notifications
You must be signed in to change notification settings - Fork 281
feat(linters): add trivy_secret #790
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
base: master
Are you sure you want to change the base?
feat(linters): add trivy_secret #790
Conversation
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. |
|
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 |
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:
