-
Notifications
You must be signed in to change notification settings - Fork 8
Use Bundler::Audit::Scanner for analysis #16
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
Use Bundler::Audit::Scanner for analysis #16
Conversation
Dir.chdir(directory) do | ||
Bundler::Audit::Scanner.new.scan do |vulnerability| | ||
result = Result.new(vulnerability, File.open(gemfile_lock_path)) | ||
issue = result.to_issue |
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.
WDYT of changing to_issue
below to as_json
and then you could just do result.to_json
below?
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.
I think I'd feel more comfortable with that if we renamed the class to Issue
. Then we would have:
issue = Issue.new(vulnerability, File.open(gemfile_lock_path))
io.print("#{issue.to_json}\0")
WDYT?
I like this direction. Did we lose the insecure source checks entirely? |
I don't think those checks ever worked as the output looks completely different and isn't picked up by our currently handling of the output on master. Here's an example of that output. We currently just ignore it. I'd like to bring in proper support for insecure source checks in a separate PR.
|
Sounds good to me! |
a86125f
to
e85e0ac
Compare
@codeclimate/review This is ready for another 🔎 |
ratings: | ||
paths: | ||
- "**.rb" | ||
exclude_paths: | ||
- bin/bundler_audit.rb |
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.
Why are we excluding this file?
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.
Rubocop generated an error on the shebang line. I think we usually drop the extension on executables in other engines, which is why this doesn't often need to be excluded. Might be worth doing that instead.
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.
Never mind. That doesn't seem to be the issue. I get the false positive locally but not on dotcom. Strange.
❯ codeclimate analyze -e rubocop codeclimate-bundler-audit/git/devon/use-bundler-audit-scanner-for-analysis
Starting analysis
Running rubocop: Done!
== bin/bundler-audit (1 issue) ==
1: Use snake_case for source file names. [rubocop]
Analysis complete! Found 1 issue.
5cf3ad7
to
1f3c4b9
Compare
1f3c4b9
to
8efb4de
Compare
@gordondiggs Updated to remove that exclude path. |
LGTM! |
…er-for-analysis Use Bundler::Audit::Scanner for analysis
A small update to bring our rubocop config up-to-date with our styleguide. Following the refactor in #16, few changes in the codebase were needed.
A small update to bring our rubocop config up-to-date with our styleguide. Following the refactor in #16, few changes in the codebase were needed.
A small update to bring our rubocop config up-to-date with our styleguide. Following the refactor in #16, few changes in the codebase were needed.
A small update to bring our rubocop config up-to-date with our styleguide. Following the refactor in #16, few changes in the codebase were needed.
A small update to bring our rubocop config up-to-date with our styleguide. Following the refactor in #16, few changes in the codebase were needed.
This PR updates the engine analysis to use bundler-audit's internal
Scanner
class which offers better access to gem and advisory information.This particular change is also necessary to disable the gem's network access attempt in order to determine whether a Gemfile source is internal or external, an update which will be introduced following this PR.
This PR also takes a few refactoring steps to improve overall structure and clarify remediation point calculation.
There should be no behavioral changes as a result of the updates in this PR.
@codeclimate/review 🔎
Before
After