Skip to content

Commit db33982

Browse files
authored
Merge pull request #1035 from talktosam2003/format
docs/analyzer-suppressions.md describes
2 parents af6ee0f + cd44fb0 commit db33982

5 files changed

Lines changed: 42 additions & 6 deletions

File tree

docs/analyzer-suppressions.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,40 @@ location = "Dynamic trace"
2121
reason = "Intentional risk in test environments"
2222
```
2323

24-
- `rule_id`: ID of the rule being suppressed
25-
- `contract_path`: Substring of the contract path
26-
- `location`: Optional substring matching the location of the finding
24+
- `rule_id`: ID of the rule being suppressed (see [security-rules.md](security-rules.md) for a list of IDs)
25+
- `contract_path`: Substring of the contract path. Use `""` to match all contracts.
26+
- `location`: Optional substring matching the location of the finding. If omitted, all findings for the rule/contract are suppressed.
2727
- `reason`: Justification for ignoring the finding
28+
29+
## Examples
30+
31+
### Suppress a rule globally
32+
To ignore a rule across the entire project, use an empty `contract_path` and omit the `location`.
33+
34+
```toml
35+
[[suppressions]]
36+
rule_id = "arithmetic"
37+
contract_path = ""
38+
reason = "Project uses a custom checked arithmetic wrapper that the analyzer doesn't yet recognize"
39+
```
40+
41+
### Suppress a rule for a specific contract
42+
To ignore a rule only for certain files (e.g., test mocks), provide a substring of the path.
43+
44+
```toml
45+
[[suppressions]]
46+
rule_id = "missing-auth"
47+
contract_path = "contracts/mocks/"
48+
reason = "Mock contracts intentionally bypass authorization for testing"
49+
```
50+
51+
### Suppress a specific finding
52+
To ignore a specific finding within a contract, provide both the `contract_path` and the `location` string reported by the analyzer.
53+
54+
```toml
55+
[[suppressions]]
56+
rule_id = "hardcoded-address"
57+
contract_path = "contracts/governance"
58+
location = "src/lib.rs:124"
59+
reason = "This is the hardcoded DAO treasury address, which is intentional"
60+
```

docs/issues/backlog-100-issues.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Roadmap view: [Section C priorities](roadmap-priorities.md#section-c--feature-re
7878
- **I-026** `[DOC]` `docs/plugin-api.md` trust-policy section documents environment variables but doesn't cross-link to the plugin failure-handling doc.
7979
- **I-027** `[DOC]` `docs/plugin-failure-handling.md` (1956 bytes) covers session-level circuit-breaker behavior introduced in PR #902 but doesn't describe what happens to in-flight events when a plugin trips the breaker.
8080
- **I-028** `[DOC]` `docs/plugin-command-namespaces.md` (1435 bytes) is not linked from `docs/plugin-api.md`, so readers learning about custom commands won't discover the namespace conflict rules.
81-
- **I-029** `[DOC]` `docs/analyzer-suppressions.md` (822 bytes) describes the suppression file format but gives no example of a suppression that covers a whole rule vs. a specific finding.
81+
- **I-029** ~`[DOC]` `docs/analyzer-suppressions.md` (822 bytes) describes the suppression file format but gives no example of a suppression that covers a whole rule vs. a specific finding.~
8282
- **I-030** `[DOC]` `docs/security-rules.md` (854 bytes) lists rule codes but doesn't map each code to its description, severity, or remediation guidance.
8383
- **I-031** `[DOC]` `docs/wasm-artifact-metadata.md` (1716 bytes) documents the metadata fields but doesn't show an example `inspect --format json` output that contains them.
8484
- **I-032** `[DOC]` `docs/watch-mode.md` (744 bytes) mentions the watch command but doesn't document the polling interval, file-glob support, or debounce behavior.

docs/issues/roadmap-priorities.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ useful order instead of re-triaging the whole epic every time.
8686
| I-026 | Cross-link plugin-api.md trust section → plugin-failure-handling.md | P2 | XS | Docs || 2 |
8787
| I-027 | Document in-flight event behavior when plugin circuit-breaker trips | P1 | S | Docs || 2 |
8888
| I-028 | Link `plugin-command-namespaces.md` from `plugin-api.md` | P1 | XS | Docs || 1 |
89-
| I-029 | Add suppression examples (rule-level vs. finding-level) | P2 | S | Docs || 2 |
89+
| I-029 | ~Add suppression examples (rule-level vs. finding-level)~ | P2 | S | Docs || 2 |
9090
| I-030 | Expand `docs/security-rules.md` with severity and remediation guide | P2 | M | Docs || 2 |
9191
| I-031 | Add `inspect --format json` example output to `wasm-artifact-metadata.md` | P2 | S | Docs || 2 |
9292
| I-032 | Expand `docs/watch-mode.md` with polling interval and debounce details | P2 | S | Docs || 2 |

docs/security-rules.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ Rules supply robust metadata explicitly defined via the `SecurityRule` trait:
1515
3. **arithmetic**: Validates potential unbounded operation panics.
1616
4. **reentrancy**: Defends against nested external calls to untrusted code.
1717
5. **unbounded-iteration**: Defends against `Vec` bounds scaling out of control.
18+
19+
## Suppressing Rules
20+
If a rule flags a finding that is an accepted risk or a false positive, you can suppress it using a suppression file. See [analyzer-suppressions.md](analyzer-suppressions.md) for details on the format and examples.

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ This directory contains a variety of examples demonstrating the capabilities of
4545

4646
* **`*.json` (Snapshots & Traces)**: Sample ledger states (`snapshot.json`) and execution traces (`trace_a.json`) that can be loaded directly into the debugger.
4747
* **`batch_args.json`**: Demonstrates how to run the debugger in batch mode for CI or automated auditing.
48-
* **`analyzer-suppressions.toml`**: Example configuration for filtering security analyzer findings.
48+
* **`analyzer-suppressions.toml`**: Example configuration for filtering security analyzer findings. See the [Analyzer Suppressions documentation](../docs/analyzer-suppressions.md) for usage details.

0 commit comments

Comments
 (0)