-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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(detect_secrets): refactor logic for detect-secrets #6537
fix(detect_secrets): refactor logic for detect-secrets #6537
Conversation
I like the fix because it will be easier spot the potential secret. However, I think other checks that use DetectSecrets may have the same problem if they refer to the line number, aren't they? |
...s/ecs_task_definitions_no_environment_secrets/ecs_task_definitions_no_environment_secrets.py
Show resolved
Hide resolved
...s/ecs_task_definitions_no_environment_secrets/ecs_task_definitions_no_environment_secrets.py
Outdated
Show resolved
Hide resolved
@kagahd I've been reviewing the logic from the remaining checks using detect-secrets on the same way and the numbers from the lines are correct. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6537 +/- ##
==========================================
- Coverage 93.67% 89.47% -4.21%
==========================================
Files 66 1182 +1116
Lines 6338 33993 +27655
==========================================
+ Hits 5937 30414 +24477
- Misses 401 3579 +3178
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
That's fantastic, what a great improvement 👏
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
Context
Fix #6467
Thanks @kagahd for the heads up! 🚀
Description
This PR change the logic from the checks:
ecs_task_definitions_no_environment_secrets
,awslambda_function_no_secrets_in_variables
The main problem here is that we are re-writing the ecs env vars into a format that Detect-Secrets could find them and we were using the line from the output to create the
status_extended
. That's why the line was incorrect (it was taking the lines from the re-written variables).The new approach changes the status extended from:
...Secret keyword on line 2.
to
...Secret keyword on env var DB_PASSWORD.
This way, the user will have the env name on the output.
Checklist
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.