Skip to content

Commit

Permalink
feat: add fingerprint to report and move skip rule to docs (#1023)
Browse files Browse the repository at this point in the history
* feat: add fingerprint to report

* feat: add skip-rule config to docs

* chore: update stale snapshots
  • Loading branch information
elsapet committed May 31, 2023
1 parent 077a311 commit 37f23e3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion docs/reference/rule-pages.njk
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,18 @@ rule.metadata %}
{% endfor %}
</ul>
{% endif %}
{% endif %}

{% renderTemplate "liquid,md", rule.metadata %}
## Configuration

To skip this rule during a scan, use the following flag
```shell
bearer scan /path/to/your-project/ --skip-rule={{id}}
```

{% endif %}
To run _only_ this rule during a scan, use the following flag
```shell
bearer scan /path/to/your-project/ --only-rule={{id}}
```
{% endrenderTemplate %}
4 changes: 2 additions & 2 deletions pkg/report/output/security/.snapshots/TestBuildReportString
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Rules:

CRITICAL: Sensitive data sent to Rails loggers detected. [CWE-209, CWE-532]
https://docs.bearer.com/reference/rules/ruby_rails_logger
To skip this rule, use the flag --skip-rule=ruby_rails_logger
To exclude this finding, use the flag --exclude-fingerprint=375d7c2e9977cf2ce5dbf04b04237bea_0

File: :1



HIGH: Missing SSL certificate verification detected. [CWE-295]
https://docs.bearer.com/reference/rules/ruby_lang_ssl_verification
To skip this rule, use the flag --skip-rule=ruby_lang_ssl_verification
To exclude this finding, use the flag --exclude-fingerprint=9005ef3db844b32c1a0317e032f4a16a_0

File: :2

Expand Down
2 changes: 1 addition & 1 deletion pkg/report/output/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func writeFailureToString(reportStr *strings.Builder, result Result, severity st
reportStr.WriteString(color.HiBlackString(result.DocumentationUrl + "\n"))
}

reportStr.WriteString(color.HiBlackString("To skip this rule, use the flag --skip-rule=" + result.Id + "\n"))
reportStr.WriteString(color.HiBlackString("To exclude this finding, use the flag --exclude-fingerprint=" + result.Fingerprint + "\n"))
reportStr.WriteString("\n")
if result.DetailedContext != "" {
reportStr.WriteString("Detected: " + result.DetailedContext + "\n\n")
Expand Down

0 comments on commit 37f23e3

Please sign in to comment.