-
Notifications
You must be signed in to change notification settings - Fork 734
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
Add --show-ignored
flag
#1861
Add --show-ignored
flag
#1861
Conversation
DryRun Security SummaryThe pull request enhances the Brakeman application security scanner by adding a new command-line option to display ignored files and warnings, improving the reporting functionality, and enhancing the test suite to ensure the reliability and security-related functionality of the tool. Expand for full summarySummary: The code changes in this pull request are focused on enhancing the functionality and usability of the Brakeman application security scanner. The key changes include:
Overall, these changes are focused on improving the usability, configurability, and transparency of the Brakeman security scanner, which can indirectly benefit the security of Ruby on Rails applications by making it easier for developers and security teams to identify and address potential vulnerabilities. Files Changed:
Code AnalysisWe ran
Riskiness🟢 Risk threshold not exceeded. |
Thanks! Can you also add a simple test in |
Done! |
lib/brakeman/report/report_text.rb
Outdated
@@ -101,6 +102,10 @@ def generate_warnings | |||
end | |||
end | |||
|
|||
def generate_show_ignored_overview | |||
double_space("Ignored File Overview", ignored_warnings.map {|w| output_warning w}) |
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.
This should go at the end of the report, after generate_warnings
, not as part of the summary. It's not a summary, it's a list of warnings.
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.
Also title should be "Ignored Warnings" instead of "Ignored File Overview"
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.
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.
Okay, I moved generate_show_ignored_overview
to the end of the report.
I explicitly return @output_string
here because adding generate_show_ignored_overview
at the end was returning nil
in some cases (When --show-ignored
isn't used, the if
statement returns nil
). All of these lines that use add_chunk
don't set a second argument so all of the contents are saved to @output_string
, so I think it should be safe to return the instance variable here explicitly.
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 makes sense. Just coincidence that it's worked all this time since generate_warnings
always returns something.
Closes #1767.
After scaffolding a
Foo
model with a couple of vulnerabilities on a new application, runningbrakeman --show-ignored
displays the following:This ensures the exit code is unaffected by adding the flag (you can see in the test I added that the exit code returned is
3
which is the default in the command line test).I wanted to check the output and not just the exit code in the command line test, but I had some trouble finding the right way to do it.
Either way, Looking back at this comment, if we do want to affect the exit code or take another approach, I'd be glad to look over the logic again.