Class: Gergich::Capture::BrakemanCapture
- Inherits:
-
BaseCapture
- Object
- BaseCapture
- Gergich::Capture::BrakemanCapture
- Defined in:
- lib/gergich/capture/brakeman_capture.rb
Constant Summary collapse
- SEVERITY_MAP =
Map Brakeman “confidence level” to severity. brakemanscanner.org/docs/confidence/
{ "Weak" => "warn", "Medium" => "warn", "High" => "error" }.freeze
Instance Method Summary collapse
Methods inherited from BaseCapture
inherited, normalize_captor_class_name
Instance Method Details
#run(output) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gergich/capture/brakeman_capture.rb', line 14 def run(output) # See brakeman_example.json for sample output. JSON.parse(output)["warnings"].map { |warning| = "#{warning['warning_type']}: #{warning['message']}" += "\n Code: #{warning['code']}" if warning["code"] += "\n User Input: #{warning['user_input']}" if warning["user_input"] += "\n See: #{warning['link']}" if warning["link"] { path: warning["file"], position: warning["line"] || 0, message: , severity: SEVERITY_MAP[warning["confidence"]], source: "brakeman" } }.compact end |