-
Notifications
You must be signed in to change notification settings - Fork 147
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 output handling of merge commits #965
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #965 +/- ##
==========================================
+ Coverage 91.71% 91.74% +0.03%
==========================================
Files 178 178
Lines 7431 7459 +28
==========================================
+ Hits 6815 6843 +28
Misses 616 616
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
ggshield output handlers currently do not support multi-parent commits. When they try to output them, they fail with list index errors. Workaround this by post-processing the diff to turn it into a single-parent commit.
d081be7
to
57931f7
Compare
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.
Looks good, just a question about design choices.
We decided to ignore lignes that were removed by another parent. Is there no risk of leak with this decision?
That's a good question. The new merge commit policy assumes parent commits of a merge have already been scanned. This means it would even be safe to ignore all removed lines, since it would be unlikely to find a valid multi-match secret from the combination of lines coming from different commits. We keep those coming from one of the parents so that the patch we show has consistent line numbers. |
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.
Oh that was bad 😢, thank you for fixing !
Context
GGShield output handlers currently do not support multi-parent commits. When they try to output them, they fail with list index errors:
This only happens in the
main
branch, not in the current release.What has been done
Workaround this by post-processing the diff to turn it into a single-parent commit.
Validation
Using the same repository as in "Context":
PR check list
skip-changelog
label has been added to the PR.(skip-changelog because this bug is not in the current release)