Class: Neetob::CLI::MonthlyAudit::Security::Code::BundleAudit
- Defined in:
- lib/neetob/cli/monthly_audit/security/code/bundle_audit.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ BundleAudit
constructor
A new instance of BundleAudit.
- #run ⇒ Object
Methods included from Utils
#camel_case_to_slug, #is_upper?, #symbolize_keys
Constructor Details
#initialize ⇒ BundleAudit
Returns a new instance of BundleAudit.
11 12 13 |
# File 'lib/neetob/cli/monthly_audit/security/code/bundle_audit.rb', line 11 def initialize super() end |
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/neetob/cli/monthly_audit/security/code/bundle_audit.rb', line 15 def run ui.success("### 1.1.1. Checking whether running `bundle-audit check` throws any vulnerabilities") repo_data = [["Repository", "Vulnerabilities Found", "Comments", "Audit Passed"]] ui.info "\n" last_comment = nil NeetoCompliance::NeetoRepos.products.keys.each do |repo| ui.info("Checking bundle audit run results for #{repo}", print_to_audit_log: false) bundle_audit_result = Neetob::CLI::Github::BundleAudit.new([repo]).run vulnerabilities_found = "No" audit_passed = "No" comments = nil if bundle_audit_result && bundle_audit_result.include?("No vulnerabilities found") audit_passed = "Yes" else vulnerabilities_found = "Yes" comments = bundle_audit_result.gsub("\n", "<br>").gsub("~", "\\~") issue_url = GithubIssueCreation.new.create_issue( repo:, title: "Fix vulnerabilities reported by bundle-audit", description: comments) audit_passed += " #{issue_url}" same_as_last_vulnerabilities = comments == last_comment last_comment = comments if same_as_last_vulnerabilities comments = "''" end end repo_data << [repo, vulnerabilities_found, comments, audit_passed] end ui.print_table(repo_data) end |