@tamsensedev/runner 0.0.0-stage → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +47 -3
  3. package/dist/cli.js +2914 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/recorder.cjs +396 -0
  6. package/dist/recorder.cjs.map +1 -0
  7. package/library/.claude-plugin/plugin.json +5 -0
  8. package/library/THIRD_PARTY_NOTICES.md +123 -0
  9. package/library/agents/code-architect.md +67 -0
  10. package/library/agents/code-explorer.md +61 -0
  11. package/library/agents/code-reviewer.md +73 -0
  12. package/library/agents/code-simplifier.md +62 -0
  13. package/library/agents/design-critic.md +52 -0
  14. package/library/agents/second-opinion.md +64 -0
  15. package/library/agents/security-auditor.md +86 -0
  16. package/library/agents/silent-failure-hunter.md +70 -0
  17. package/library/agents/test-coverage-analyzer.md +78 -0
  18. package/library/agents/test-runner.md +48 -0
  19. package/library/agents/ui-tester.md +49 -0
  20. package/library/licenses/Apache-2.0.txt +202 -0
  21. package/library/skills/accessibility/SKILL.md +144 -0
  22. package/library/skills/accessibility/references/wcag-checks.md +168 -0
  23. package/library/skills/addressing-review-feedback/SKILL.md +109 -0
  24. package/library/skills/app-screens/SKILL.md +96 -0
  25. package/library/skills/app-screens/references/shell-kpis-charts.md +108 -0
  26. package/library/skills/app-screens/references/states-density-phone.md +54 -0
  27. package/library/skills/app-screens/references/tables-forms-settings.md +104 -0
  28. package/library/skills/avoiding-generic-ai-design/SKILL.md +92 -0
  29. package/library/skills/avoiding-generic-ai-design/references/tells.md +112 -0
  30. package/library/skills/clean-commits/SKILL.md +85 -0
  31. package/library/skills/design-review/SKILL.md +107 -0
  32. package/library/skills/design-review/references/critique-passes.md +101 -0
  33. package/library/skills/design-review/references/screenshot-procedure.md +121 -0
  34. package/library/skills/differential-security-review/LICENSE +427 -0
  35. package/library/skills/differential-security-review/SKILL.md +105 -0
  36. package/library/skills/differential-security-review/references/adversarial.md +115 -0
  37. package/library/skills/differential-security-review/references/methodology.md +145 -0
  38. package/library/skills/differential-security-review/references/patterns.md +108 -0
  39. package/library/skills/false-positive-check/LICENSE +427 -0
  40. package/library/skills/false-positive-check/SKILL.md +95 -0
  41. package/library/skills/false-positive-check/references/bug-class-verification.md +128 -0
  42. package/library/skills/false-positive-check/references/deep-verification.md +113 -0
  43. package/library/skills/false-positive-check/references/evidence-templates.md +93 -0
  44. package/library/skills/false-positive-check/references/false-positive-patterns.md +122 -0
  45. package/library/skills/false-positive-check/references/gate-reviews.md +36 -0
  46. package/library/skills/false-positive-check/references/standard-verification.md +80 -0
  47. package/library/skills/focused-implementation/SKILL.md +104 -0
  48. package/library/skills/implementation-plan/SKILL.md +66 -0
  49. package/library/skills/interface-design/SKILL.md +144 -0
  50. package/library/skills/interface-design/references/craft-defaults.md +130 -0
  51. package/library/skills/interface-design/references/new-direction.md +62 -0
  52. package/library/skills/interface-design/references/writing.md +52 -0
  53. package/library/skills/interface-polish/SKILL.md +103 -0
  54. package/library/skills/interface-polish/references/detail-rules.md +154 -0
  55. package/library/skills/interface-polish/references/worst-case-data.md +158 -0
  56. package/library/skills/motion-design/SKILL.md +106 -0
  57. package/library/skills/motion-design/references/recipes.md +243 -0
  58. package/library/skills/postgres-performance/SKILL.md +97 -0
  59. package/library/skills/postgres-performance/references/rules.md +265 -0
  60. package/library/skills/project-orientation/SKILL.md +77 -0
  61. package/library/skills/reviewing-changes/SKILL.md +183 -0
  62. package/library/skills/safe-database-changes/SKILL.md +111 -0
  63. package/library/skills/safe-database-changes/references/backfills.md +75 -0
  64. package/library/skills/safe-database-changes/references/migration-tools.md +69 -0
  65. package/library/skills/safe-database-changes/references/postgres-ddl.md +199 -0
  66. package/library/skills/security-review/SKILL.md +132 -0
  67. package/library/skills/security-review/references/checks-by-area.md +107 -0
  68. package/library/skills/security-review/references/do-not-report.md +86 -0
  69. package/library/skills/spec-writing/SKILL.md +144 -0
  70. package/library/skills/systematic-debugging/SKILL.md +130 -0
  71. package/library/skills/systematic-debugging/references/flaky-tests.md +51 -0
  72. package/library/skills/systematic-debugging/references/root-cause-tracing.md +55 -0
  73. package/library/skills/task-interview/SKILL.md +84 -0
  74. package/library/skills/test-driven-development/SKILL.md +116 -0
  75. package/library/skills/test-driven-development/references/writing-good-tests.md +85 -0
  76. package/library/skills/ui-testing/SKILL.md +102 -0
  77. package/library/skills/ui-testing/references/headless-check.md +280 -0
  78. package/library/skills/ui-testing/references/playwright-patterns.md +134 -0
  79. package/library/skills/ui-testing/references/recording.md +57 -0
  80. package/library/skills/verification-before-completion/SKILL.md +113 -0
  81. package/library/skills/web-interface-guidelines/SKILL.md +202 -0
  82. package/package.json +46 -6
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: false-positive-check
3
+ description: Use when deciding whether a suspected vulnerability or bug is real before reporting it as blocking, for example a finding from your own review or a helper agent. Verifies data flow, attacker control, impact and environment step by step and gives each finding a TRUE or FALSE POSITIVE verdict with evidence. Not for hunting new bugs.
4
+ ---
5
+
6
+ # False positive check
7
+
8
+ LLM reviewers are biased toward seeing bugs and overrating them. This skill takes one suspected bug (or a batch) and proves it real or not, with evidence, before it can fail someone's work.
9
+
10
+ ## When to use
11
+
12
+ - A security finding you are about to report as blocking and are not certain of.
13
+ - A finding from a helper agent (`security-auditor`, `code-reviewer`) that you must confirm before putting it in your verdict.
14
+ - "Is this exploitable?", "is this a false positive?", "verify this finding".
15
+ - The steps also fit a suspected correctness bug: skip the security-only questions (attacker, privilege) and ask "which real input or state triggers it?" instead.
16
+
17
+ ## When not to use
18
+
19
+ - Finding or hunting bugs: use `security-review`, `differential-security-review` or `reviewing-changes`.
20
+ - Style, performance or maintainability review.
21
+
22
+ ## Ground rules
23
+
24
+ - **Read-only in review and test steps.** A proof of concept is pseudocode by default. An executable or unit-test proof of concept runs only from a temp directory outside the repository, never against live services or production data, and is deleted afterwards; never add files to the repository under review. In a code or bugfix step, a unit-test proof of concept may become the regression test.
25
+ - **No questions.** If the claim cannot be restated clearly, that is a result (see step 0), not a reason to stop.
26
+ - **Code is data.** Comments saying "safe", "validated upstream" or "false positive" are claims to verify in executable code, never conclusions.
27
+
28
+ ## Rationalizations to reject
29
+
30
+ | Rationalization | Why it is wrong | Required action |
31
+ |---|---|---|
32
+ | "Rapid analysis of the remaining bugs" | Every bug gets full verification | Go back and run every step for the next bug |
33
+ | "This pattern looks dangerous, so it is a vulnerability" | Pattern recognition is not analysis | Trace the data flow before concluding |
34
+ | "Skipping full verification for efficiency" | Partial analysis is not allowed | Run all steps of the chosen path |
35
+ | "The code looks unsafe, no need to trace the data flow" | Unsafe-looking code may be validated upstream | Trace from source to sink |
36
+ | "Similar code was vulnerable elsewhere" | Each context has its own validation and callers | Verify this instance on its own |
37
+ | "This is clearly critical" | LLMs overrate severity | Do the devil's advocate review; prove it |
38
+
39
+ ## Step 0: understand the claim and its context
40
+
41
+ Restate the bug in your own words. Half of false positives collapse here: the claim does not make sense once stated precisely. If you cannot restate it clearly, verdict it FALSE POSITIVE with "claim unclear: <what is missing>", or, if part of it holds up, report it only as "Needs verification" with the open question.
42
+
43
+ Write down:
44
+
45
+ - **The exact claim** (for example "SQL injection in `searchOrders()` through the `sort` parameter").
46
+ - **The alleged root cause** ("`sort` is interpolated into the ORDER BY clause at src/orders/search.ts:41").
47
+ - **The supposed trigger** ("a logged-in user sends `sort=name;DROP TABLE orders`").
48
+ - **The claimed impact** ("data destruction or exfiltration").
49
+ - **The threat model:** which privilege the code runs with, whether it is sandboxed, and what the attacker can already do before triggering it.
50
+ - **The bug class**, then the class-specific checks in [references/bug-class-verification.md](references/bug-class-verification.md).
51
+ - **Execution context:** when and how this path runs in normal operation.
52
+ - **Callers:** which functions call this code and what constraints they impose on the input.
53
+ - **Architecture:** is this part of a larger system with several protection layers (middleware, gateway, database constraints)?
54
+ - **History:** recent changes, known issues or earlier reviews of this area (`git log -p -- <file>`).
55
+
56
+ ## Choose a path
57
+
58
+ **Standard verification** when all of these hold: a clear, specific claim; one component; a well-understood bug class (injection, XSS, IDOR, path traversal, overflow); no concurrency or async in the trigger; a straightforward source-to-sink flow. Follow [references/standard-verification.md](references/standard-verification.md).
59
+
60
+ **Deep verification** when any of these holds: an ambiguous claim; a path through three or more modules or services; races, TOCTOU or concurrency in the trigger; a logic bug without a clear spec; standard verification was inconclusive. Follow [references/deep-verification.md](references/deep-verification.md).
61
+
62
+ Default to standard: it has two escalation checkpoints that move you to deep when needed.
63
+
64
+ Templates for the evidence: [references/evidence-templates.md](references/evidence-templates.md). Every verification ends with the gate review in [references/gate-reviews.md](references/gate-reviews.md) and the checklist in [references/false-positive-patterns.md](references/false-positive-patterns.md).
65
+
66
+ ## Batch triage
67
+
68
+ When verifying several bugs:
69
+
70
+ 1. Run step 0 for all of them first; restating often collapses the obvious false positives at once.
71
+ 2. Choose the path for each bug separately.
72
+ 3. Do all standard-path bugs first, then the deep ones.
73
+ 4. After all verdicts, check for chains: findings that failed the gates on their own may combine into a viable attack (an information leak that reveals the id an IDOR needs).
74
+
75
+ ## Result
76
+
77
+ For each bug, one line plus the evidence:
78
+
79
+ ```
80
+ BUG #3 FALSE POSITIVE - SQL injection in src/orders/search.ts:41
81
+ Gate 2 (Reachability) FAIL: `sort` is checked against the allowlist ['name', 'date', 'total'] at src/orders/search.ts:30 before use.
82
+ BUG #4 TRUE POSITIVE - invoices of other accounts readable through GET /invoices/:id (src/invoices/routes.ts:24)
83
+ ```
84
+
85
+ Then the counts (X true positives, Y false positives) and the lists.
86
+
87
+ How this feeds the verdict of a review or test step:
88
+
89
+ - **TRUE POSITIVE:** report it, with severity per `security-review` (or `reviewing-changes` for correctness bugs). It may block.
90
+ - **FALSE POSITIVE:** drop it. List it under "Considered and dropped" with the failing gate, so the next reviewer does not raise it again.
91
+ - **Inconclusive** (a gate could not be decided from the code available): report as "Needs verification" with the exact open question. It does not block.
92
+
93
+ If a `submit_verdict` tool is available and this check is the whole job, that is how the result is returned; otherwise give the result at the end of your reply.
94
+
95
+ Adapted from https://github.com/trailofbits/skills/tree/main/plugins/fp-check (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), by Trail of Bits (Maciej Domanski), CC BY-SA 4.0. Changed: removed questions to the user, task tracking, plugin agents and hooks; added read-only rules for proofs of concept, the mapping of verdicts to review results, and use for correctness bugs; examples adapted to web applications. This skill folder, including its references, is licensed under CC BY-SA 4.0; see LICENSE.
@@ -0,0 +1,128 @@
1
+ # Bug-Class-Specific Verification
2
+
3
+ Different bug classes require different verification approaches. After classifying the bug in Step 0, apply the class-specific requirements below **in addition to** the generic verification phases.
4
+
5
+ Jump to the relevant class:
6
+
7
+ - [Memory Corruption](#memory-corruption): overflows, UAF, double-free, type confusion
8
+ - [Logic Bugs](#logic-bugs): auth bypass, access control, state transitions, privilege escalation
9
+ - [Race Conditions](#race-conditions): TOCTOU, data races, signal handling
10
+ - [Integer Issues](#integer-issues): overflow, underflow, truncation, signedness
11
+ - [Crypto Weaknesses](#crypto-weaknesses): weak algorithms, nonce reuse, timing channels
12
+ - [Injection](#injection): SQL, XSS, command, template, path traversal
13
+ - [Information Disclosure](#information-disclosure): uninitialized memory, leaks, side channels
14
+ - [Denial of Service](#denial-of-service): algorithmic complexity, resource exhaustion, crashes
15
+ - [Deserialization](#deserialization): object injection, gadget chains
16
+
17
+ ## Memory Corruption
18
+
19
+ Buffer overflow, heap overflow, stack overflow, out-of-bounds read/write, use-after-free, double-free, type confusion.
20
+
21
+ **Language safety check first:** Memory corruption in safe Rust, Go (without `unsafe.Pointer`/cgo), or managed languages (Java, C#, Python) is almost always a false positive: the type system or runtime prevents it. Verify whether the code is in an `unsafe` block (Rust), uses cgo/`unsafe.Pointer` (Go), or calls native code via JNI/P/Invoke. If the code is entirely in the safe subset, reject the memory corruption claim unless it involves a compiler bug or soundness hole.
22
+
23
+ **Verify:**
24
+
25
+ - What exactly gets corrupted? (which object, field, or memory region)
26
+ - What is the corruption size and offset? Can the attacker control them?
27
+ - Is the corruption a useful exploitation primitive (arbitrary read/write, vtable overwrite, function pointer overwrite) or just a crash?
28
+ - What allocator is in use (glibc, tcmalloc, jemalloc, Windows heap)? Does it have hardening that blocks exploitation?
29
+ - For UAF: trace the object lifetime: what frees it, what reuses the memory, can the attacker control the replacement object?
30
+ - For type confusion: prove the type mismatch exists and that misinterpretation of the data leads to a useful primitive.
31
+
32
+ ## Logic Bugs
33
+
34
+ Authentication bypass, access control errors, incorrect state transitions, confused deputy, privilege escalation through API misuse.
35
+
36
+ **Verify:**
37
+
38
+ - Check against the specification, RFC, or design docs: not just the code. Does the implementation match the intended behavior?
39
+ - Map all state transitions. Can the system reach a state the developer didn't anticipate?
40
+ - Identify implicit assumptions that are never enforced in code.
41
+ - For auth bugs: verify ALL authentication/authorization paths, not just the one that appears broken. Is there a secondary check that catches it?
42
+ - Logic bugs pass every bounds check and mathematical proof: don't let clean static analysis convince you it's a false positive.
43
+
44
+ ## Race Conditions
45
+
46
+ TOCTOU, data races, signal handling races, concurrent state modification.
47
+
48
+ **Verify:**
49
+
50
+ - What is the actual race window? Is it nanoseconds or seconds?
51
+ - Can the attacker widen the window (e.g., by stalling a thread with a slow NFS mount, large allocation, or CPU contention)?
52
+ - Verify the threading model: what threads/processes can actually access this data concurrently?
53
+ - Check all synchronization primitives in use: mutexes, atomics, RCU, lock-free structures.
54
+ - For TOCTOU on filesystem: can the attacker control the path between check and use (symlink races)?
55
+
56
+ ## Integer Issues
57
+
58
+ Overflow, underflow, truncation, signedness errors, wraparound.
59
+
60
+ **Verify:**
61
+
62
+ - What are the exact integer types and their ranges at every point in the computation?
63
+ - Is the overflow signed (undefined behavior in C/C++: compiler may exploit this) or unsigned (defined wraparound)?
64
+ - Trace the integer through all casts, conversions, and promotions. Where does truncation or sign extension occur?
65
+ - After the integer issue occurs, is the resulting value actually used in a dangerous way (allocation size, array index, loop bound)?
66
+ - Check if compiler warnings (`-Wconversion`, `-Wsign-compare`) flag this.
67
+
68
+ ## Crypto Weaknesses
69
+
70
+ Weak algorithms, bad parameters, nonce reuse, padding oracle, insufficient randomness, timing side channels.
71
+
72
+ **Verify:**
73
+
74
+ - Check parameter choices against current standards (NIST, IETF) and known attacks. "AES-128" is fine; "DES" is not.
75
+ - Verify randomness sources. Is the PRNG cryptographically secure? Is it properly seeded?
76
+ - For nonce reuse: prove the same nonce can actually be used twice in practice, not just theoretically.
77
+ - For timing side channels: is the code actually reachable by an attacker who can measure timing? Network jitter may make remote timing attacks impractical.
78
+ - Compare the implementation against a reference implementation or test vectors from the spec.
79
+
80
+ ## Injection
81
+
82
+ SQL injection, XSS, command injection, server-side template injection, path traversal, LDAP injection.
83
+
84
+ **Verify:**
85
+
86
+ - Trace attacker input from entry point to the sink (query, command, template, filesystem path). Is there any sanitization or escaping along the way?
87
+ - Check if the framework provides automatic escaping (e.g., parameterized queries, template auto-escaping). If so, is it actually enabled and not bypassed?
88
+ - For XSS: what context does the input land in (HTML body, attribute, JavaScript, URL)? Each requires different escaping.
89
+ - For path traversal: is the path canonicalized before the access check? Can `../` or null bytes bypass validation?
90
+ - Follow the actual payload through all intermediate processing (by reading the code, or by running it outside the repository): encoding, decoding, and transformation steps may neutralize or enable the payload.
91
+
92
+ ## Information Disclosure
93
+
94
+ Uninitialized memory reads, error message leaks, timing side channels, padding oracles.
95
+
96
+ **Verify:**
97
+
98
+ - What specific data leaks? Not all leaks are equal: a stack leak revealing ASLR base or canary is critical; one revealing a static string is worthless.
99
+ - Is the leaked data actually useful to an attacker for further exploitation (ASLR bypass, session tokens, crypto keys)?
100
+ - For uninitialized memory: prove the memory is actually uninitialized at the point of read, not just potentially uninitialized on some code path.
101
+ - For timing side channels: can the attacker make enough measurements with sufficient precision? What's the noise level?
102
+ - For error messages: does the error path actually reach the attacker, or is it logged server-side only?
103
+
104
+ ## Denial of Service
105
+
106
+ Algorithmic complexity, resource exhaustion, crash bugs, infinite loops, memory bombs.
107
+
108
+ **Verify:**
109
+
110
+ - What is the resource consumption ratio? Attacker sends X bytes, server consumes Y resources. Is the amplification meaningful?
111
+ - Can the resource be reclaimed (connection closes, memory freed) or is it permanent exhaustion?
112
+ - For algorithmic complexity: what is the actual worst-case input? Prove it triggers worst-case behavior, don't just claim O(n²).
113
+ - For crash bugs: is the crash reliably triggerable, or does it depend on specific heap/stack layout?
114
+ - Does the service restart automatically? A crash that causes a 100ms restart is different from one that requires manual intervention.
115
+
116
+ ## Deserialization
117
+
118
+ Unsafe deserialization, object injection, gadget chain exploitation.
119
+
120
+ **Verify:**
121
+
122
+ - Does the attacker actually control the serialized data that reaches the deserialization call?
123
+ - Does a usable gadget chain exist in the classpath/import graph? Without a gadget chain, unsafe deserialization is a design smell, not an exploitable bug.
124
+ - What deserialization library and version is in use? Are there known gadget chains for it?
125
+ - Are there type restrictions, allowlists, or look-ahead deserialization filters that block dangerous classes?
126
+ - For language-specific: Java `ObjectInputStream`, Python `pickle`, PHP `unserialize`, .NET `BinaryFormatter` each have different exploitation characteristics.
127
+
128
+ Part of the `false-positive-check` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/fp-check (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: punctuation and small wording changes for read-only runs.
@@ -0,0 +1,113 @@
1
+ # Deep Verification
2
+
3
+ Full verification for complex bugs. Use when routing in SKILL.md selects the deep path, or when standard verification escalates.
4
+
5
+ ## If Escalated from Standard
6
+
7
+ 1. Review all evidence gathered during the standard pass; do not repeat completed work.
8
+ 2. Identify which phases below are already satisfied by existing evidence.
9
+ 3. Continue from where standard verification left off.
10
+ 4. Keep and reference all prior findings.
11
+
12
+ ## Phases
13
+
14
+ Work through the phases in order for each bug (Bug #N). Keep a checklist in your notes and mark a phase done only when you have concrete evidence for it. Sub-steps within a phase are independent; do them in any order, but never start a phase before the one it depends on is complete. If the bug path is large, you may hand a phase's data-flow tracing to the `code-explorer` agent, with the bug description and prior evidence in the prompt; you still judge the result.
15
+
16
+ ```
17
+ Phase 1: Data flow analysis
18
+ 1.1 Map trust boundaries and trace data flow
19
+ 1.2 Research API contracts and safety guarantees
20
+ 1.3 Environment protection analysis
21
+ 1.4 Cross-reference analysis
22
+ Phase 2: Exploitability verification (after phase 1)
23
+ 2.1 Confirm attacker controls input data
24
+ 2.2 Mathematical bounds verification (or N/A)
25
+ 2.3 Race condition feasibility proof (or N/A)
26
+ 2.4 Adversarial analysis (after 2.1 to 2.3)
27
+ Phase 3: Impact assessment (after phase 2)
28
+ 3.1 Demonstrate real security impact
29
+ 3.2 Primary control vs defense in depth
30
+ Phase 4: PoC creation (after phase 3)
31
+ 4.1 Pseudocode PoC with data flow diagram
32
+ 4.2 Executable PoC if feasible
33
+ 4.3 Unit test PoC if feasible
34
+ 4.4 Negative PoC: exploit preconditions
35
+ 4.5 Verify the PoC demonstrates the vulnerability
36
+ Phase 5: Devil's advocate review (after phase 4)
37
+ Gate review (after phase 5)
38
+ ```
39
+
40
+ Apply all 13 checklist items from [false-positive-patterns.md](false-positive-patterns.md) to each bug.
41
+
42
+ ## Phase Requirements
43
+
44
+ The list above names every phase. Below are the key pitfalls and decision criteria for each: focus on what you might get wrong.
45
+
46
+ ### Phase 1: Data Flow Analysis
47
+
48
+ **1.1**: Map trust boundaries (internal/trusted vs external/untrusted) and trace data from source to the alleged vulnerability. Apply class-specific verification from [bug-class-verification.md](bug-class-verification.md). **Key pitfall**: analyzing code in isolation without tracing the full validation chain. Conditional logic upstream may make the vulnerable code mathematically unreachable (see [false-positive-patterns.md](false-positive-patterns.md) items 1 and 1a).
49
+
50
+ **1.2**: Check API contracts before claiming overflows or injections: many APIs have built-in protection (bounds checks, parameter binding, escaping) that prevents the alleged issue regardless of inputs.
51
+
52
+ **1.3**: Before concluding vulnerability, verify that no compiler, runtime, OS, or framework protection prevents exploitation. Mitigations like ASLR and stack canaries raise the bar but do not eliminate the vulnerability itself. Distinguish "prevents exploitation entirely" (Rust's safe type system, parameterized queries, framework auto-escaping) from "makes exploitation harder" (ASLR, a WAF).
53
+
54
+ **1.4**: Check whether similar code patterns exist elsewhere and are handled safely. Review test coverage, code review history (`git log -p`), and design documentation for this area.
55
+
56
+ ### Phase 2: Exploitability Verification
57
+
58
+ **2.1**: Prove the attacker controls the data reaching the vulnerability. **Key pitfall**: assuming external data reaches the operation without tracing the actual path. Internal storage set by trusted components is not attacker-controlled.
59
+
60
+ **2.2**: Create explicit algebraic proofs for bounds-related issues. Use the template in [evidence-templates.md](evidence-templates.md). Verify: IF validation_check_passes THEN bounds_guarantee_holds. Mark N/A when the bug is not about bounds or arithmetic.
61
+
62
+ **2.3**: For race conditions, prove concurrent access is actually possible (two requests, two workers, two processes). **Key pitfall**: assuming races in single-threaded initialization or in code already serialized by a lock, transaction or unique constraint. Mark N/A when no concurrency is involved.
63
+
64
+ **2.4**: Assess the full attack surface: input control, validation bypass paths, timing dependencies, and state manipulation.
65
+
66
+ ### Phase 3: Impact Assessment
67
+
68
+ **3.1**: Distinguish real security impact (code execution, privilege escalation, information disclosure, unauthorized data changes, money loss) from operational robustness issues.
69
+
70
+ **3.2**: Distinguish primary security controls from defense in depth. Failure of a defense-in-depth measure is not a vulnerability if primary protections remain intact.
71
+
72
+ ### Phase 4: PoC Creation
73
+
74
+ **Always create a pseudocode PoC.** Create executable and/or unit test PoCs when feasible and allowed:
75
+
76
+ 1. **Pseudocode with data flow diagram** showing the attack path (always).
77
+ 2. **Executable PoC** in the target language (if feasible). In review and test steps it runs only from a temp directory outside the repository, never against live services or production data, and is deleted afterwards.
78
+ 3. **Unit test PoC** exercising the vulnerable path with crafted inputs (if feasible). Same rule: never add it to the repository under review. In a code or bugfix step it may become the regression test.
79
+
80
+ See [evidence-templates.md](evidence-templates.md) for templates.
81
+
82
+ **Negative PoC (4.4)**: show the gap between normal operation and the exploit path: which preconditions must hold for the vulnerability to trigger, and why they do not hold under normal conditions.
83
+
84
+ ### Phase 5: Devil's Advocate Review
85
+
86
+ Before the verdict, challenge the claim systematically. Assume you are biased toward finding bugs and rating them as critical, and work against that bias.
87
+
88
+ **Challenges arguing AGAINST the vulnerability:**
89
+
90
+ 1. What non-vulnerability explanations exist for this code pattern?
91
+ 2. How would the original developers justify this implementation?
92
+ 3. What crucial system architecture context might be missing?
93
+ 4. Am I seeing a vulnerability because the pattern "looks dangerous" rather than because it actually is?
94
+ 5. Even if validation looks insufficient, does it actually prevent the claimed condition?
95
+ 6. Am I incorrectly assuming attacker control over trusted data?
96
+ 7. Have I rigorously proven the mathematical condition for vulnerability can occur?
97
+ 8. Beyond theoretical possibility, is this practically exploitable?
98
+ 9. Am I confusing defense-in-depth failure with a primary security vulnerability?
99
+ 10. What compiler, runtime, OS or framework protections might prevent exploitation?
100
+ 11. Am I hallucinating this vulnerability? LLMs are biased toward seeing bugs everywhere and rating every finding as critical. Is this a real, exploitable issue, or am I pattern-matching on scary-looking code?
101
+
102
+ **Challenges arguing FOR the vulnerability (false-negative protection):**
103
+
104
+ 12. Am I dismissing a real vulnerability because the exploit seems complex or unlikely?
105
+ 13. Am I inventing mitigations or validation logic that I have not verified in the actual source code? Re-read the code after reaching a conclusion.
106
+
107
+ See [evidence-templates.md](evidence-templates.md) for the documentation template.
108
+
109
+ ## Gate Review
110
+
111
+ Apply the six gates from [gate-reviews.md](gate-reviews.md) to reach a verdict.
112
+
113
+ Part of the `false-positive-check` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/fp-check (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: task tracking and plugin agents replaced by an in-order checklist (optionally the `code-explorer` agent), read-only rules for proofs of concept, N/A rules for 2.2 and 2.3, web examples of environment protections and impact.
@@ -0,0 +1,93 @@
1
+ # Evidence Templates
2
+
3
+ Use these templates when documenting verification evidence for each bug.
4
+
5
+ ## Data Flow Documentation
6
+
7
+ ```
8
+ Bug #N Data Flow Analysis
9
+ Source: [exact location] - Trust Level: [trusted/untrusted]
10
+ Path: Source → Validation1[file:line] → Transform[file:line] → Vulnerability[file:line]
11
+ Validation Points:
12
+ - Check1: [condition] at [file:line] - [passes/fails/bypassed]
13
+ - Check2: [condition] at [file:line] - [passes/fails/bypassed]
14
+ ```
15
+
16
+ ## Mathematical Bounds Proof
17
+
18
+ ```
19
+ Bug #N Mathematical Analysis
20
+ Claim: Operation X is vulnerable to [overflow/underflow/bounds violation]
21
+ Given Constraints: [list all validation conditions]
22
+
23
+ Algebraic Proof:
24
+ 1. [first constraint from validation]
25
+ 2. [constant or known value]
26
+ 3. [derived inequality]
27
+ ...
28
+ N. Therefore: [vulnerability confirmed/debunked] (Q.E.D.)
29
+
30
+ Conclusion: [vulnerability is/is not mathematically possible]
31
+ ```
32
+
33
+ **Example:**
34
+
35
+ ```
36
+ Given: validation ensures (input_size >= MIN_SIZE)
37
+ Given: MIN_SIZE = 16, header_size = 8
38
+ Prove: (input_size - header_size) cannot underflow
39
+
40
+ 1. input_size >= MIN_SIZE (from validation)
41
+ 2. MIN_SIZE = 16 (constant)
42
+ 3. header_size = 8 (constant)
43
+ 4. input_size >= 16 (substitution of 1,2)
44
+ 5. input_size - 8 >= 16 - 8 (subtract header_size from both sides)
45
+ 6. input_size - header_size >= 8 (simplification)
46
+ 7. Therefore: underflow impossible (Q.E.D.)
47
+ ```
48
+
49
+ ## Attacker Control Analysis
50
+
51
+ ```
52
+ Bug #N Attacker Control Analysis
53
+ Input Vector: [how attacker provides input]
54
+ Control Level: [full/partial/none]
55
+ Constraints: [what limits exist on attacker input]
56
+ Reachability: [can attacker-controlled data reach vulnerable operation?]
57
+ ```
58
+
59
+ ## PoC - Pseudocode with Data Flow Diagram
60
+
61
+ ```
62
+ PoC for Bug #N: [Brief Description]
63
+
64
+ Data Flow Diagram:
65
+
66
+ [External Input] → [Validation Point] → [Processing] → [Vulnerable Operation]
67
+ | | | |
68
+ Attacker (May be bypassed) (Transforms data) (Unsafe operation)
69
+ Controlled | | |
70
+ | v v v
71
+ [Malicious Data] → [Insufficient Check] → [Processed Data] → [Impact]
72
+
73
+ PSEUDOCODE:
74
+ function vulnerable_operation(user_data):
75
+ validation_result = weak_validation(user_data) // Explain why this fails
76
+ processed_data = transform_data(user_data) // Show transformation
77
+ unsafe_operation(processed_data) // Show vulnerability trigger
78
+ ```
79
+
80
+ ## Devil's Advocate Review
81
+
82
+ ```
83
+ Bug #N Devil's Advocate Review
84
+ Vulnerability Claim: [brief description]
85
+
86
+ For each devil's advocate question (7 in standard verification, 13 in deep verification), document your answer:
87
+ Questions against the vulnerability: [answers]
88
+ Questions for the vulnerability (false-negative protection): [answers]
89
+
90
+ Final Assessment: [Vulnerability confirmed/debunked with reasoning]
91
+ ```
92
+
93
+ Part of the `false-positive-check` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/fp-check (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: punctuation and small wording changes for read-only runs.
@@ -0,0 +1,122 @@
1
+ # False Positive Patterns: Lessons Learned
2
+
3
+ Apply ALL items in this checklist to EACH potential bug during verification.
4
+
5
+ Contents:
6
+
7
+ - [Checklist](#checklist): 13 items to apply to every bug (trace validation, confirm data paths, bounds logic, TOCTOU, trust boundaries, real vs theoretical impact, defense-in-depth)
8
+ - [Red Flags for False Positives](#red-flags-for-false-positives): recurring failure patterns (pattern-based, context-blind, math/bounds, API-contract)
9
+
10
+ ## Checklist
11
+
12
+ ### 1. Trace Full Validation Chain
13
+
14
+ Don't analyze isolated code snippets. Trace backwards to find ALL validation that precedes potentially dangerous operations. Network packet size operations may look dangerous but often have bounds validation earlier in the function.
15
+
16
+ ### 1a. Map Complete Conditional Logic Flow
17
+
18
+ Vulnerable-looking code may be unreachable due to conditional logic that creates mathematical guarantees. Example: array access `buffer[length-4]` appears unsafe when `length < 4`, but if the code is only reachable when `length > 12` due to earlier validation, the vulnerability is impossible.
19
+
20
+ **Verify:**
21
+
22
+ - What conditions must be met for execution to reach the alleged vulnerability?
23
+ - Do those conditions mathematically prevent the vulnerability scenario?
24
+ - Are there minimum size/length requirements that guarantee safe access?
25
+ - Does the conditional flow create impossible-to-violate bounds?
26
+
27
+ ### 2. Identify Defensive Programming Patterns
28
+
29
+ Distinguish between actual vulnerabilities and defensive assertions/validations. `ASSERT(size == expected_size)` followed by size-controlled operations is defensive, not vulnerable. Verify that checks actually prevent the alleged vulnerability.
30
+
31
+ ### 3. Confirm Exploitable Data Paths
32
+
33
+ Only report vulnerabilities with CONFIRMED exploitable data flow paths. Don't assume network-controlled data reaches dangerous functions without tracing the actual path step by step.
34
+
35
+ ### 4. Understand Data Source Context
36
+
37
+ Distinguish between data sources and their trust levels. API return values, compile-time constants, and network data have different risk profiles. Determine the actual source and whether it is attacker-controlled.
38
+
39
+ ### 5. Analyze Bounds Validation Logic
40
+
41
+ Look for mathematical relationships between validation checks and subsequent operations. If `packet_size >= MIN_SIZE` is checked and `MIN_SIZE >= sizeof(header)`, then `packet_size - sizeof(header)` cannot underflow.
42
+
43
+ ### 6. Verify TOCTOU Claims
44
+
45
+ Time-of-check-time-of-use issues require proof that the checked value can change between check and use. If a size is checked and immediately used in the same function with no external modification possible, there is no TOCTOU.
46
+
47
+ ### 7. Understand API Contract and Trust Boundaries
48
+
49
+ Always understand API contracts before claiming buffer overflows. Some APIs have built-in bounds protection and cannot write beyond the buffer regardless of input parameters.
50
+
51
+ ### 8. Distinguish Internal Storage from External Input
52
+
53
+ Internal storage systems (configuration stores, registries) are controlled by trusted components, not attackers. Values set during installation by trusted components are not attacker-controlled.
54
+
55
+ ### 9. Don't Confuse Pattern Recognition with Vulnerability Analysis
56
+
57
+ Code patterns that "look vulnerable" may be safely implemented due to context and API contracts. Size parameters being modified doesn't mean buffer overflow if the API prevents writing beyond bounds.
58
+
59
+ ### 10. Verify Concurrent Access is Actually Possible
60
+
61
+ Don't assume race conditions exist without proving concurrent access patterns. Single-threaded initialization contexts cannot have race conditions. Verify the threading model and synchronization mechanisms.
62
+
63
+ ### 11. Assess Real vs Theoretical Security Impact
64
+
65
+ Focus on vulnerabilities with actual security impact. Storage failure for non-critical data is an operational issue, not a security vulnerability. Ask: would this lead to code execution, privilege escalation, or information disclosure?
66
+
67
+ ### 12. Understand Defense-in-Depth vs Primary Controls
68
+
69
+ Failure of defense-in-depth mechanisms is not always a vulnerability if primary protections exist. Token cleanup failure is not critical if tokens are single-use by design at the server.
70
+
71
+ ### 13. Apply the Checklist Rigorously, Not Superficially
72
+
73
+ Having a checklist doesn't prevent false positives if it isn't applied systematically. For EVERY potential vulnerability, work through ALL checklist items before concluding.
74
+
75
+ ---
76
+
77
+ ## Red Flags for False Positives
78
+
79
+ ### Pattern-Based False Positives
80
+
81
+ - Reporting vulnerabilities in validation/bounds-checking code itself
82
+ - Claiming TOCTOU without proving the value can change
83
+ - Ignoring preceding validation logic
84
+ - Assuming network data reaches operations without tracing the path
85
+ - Confusing defensive programming (assertions/checks) with vulnerabilities
86
+ - Analyzing vulnerable-looking patterns without tracing conditional logic that controls reachability
87
+ - Reporting "vulnerabilities" in error handling or cleanup code
88
+ - Flagging size calculations without understanding mathematical constraints
89
+ - Identifying "dangerous" functions without checking if inputs are bounded
90
+ - Claiming buffer overflows in fixed-size operations with compile-time bounds
91
+ - Reporting race conditions in single-threaded or synchronized contexts
92
+
93
+ ### Context-Blind Analysis False Positives
94
+
95
+ - Analyzing code snippets without understanding broader system design
96
+ - Ignoring architectural guarantees (single-writer, trusted input sources)
97
+ - Missing that "vulnerable" code is unreachable due to earlier validation
98
+ - Confusing debug/development code paths with production paths
99
+ - Reporting issues in code that only runs during trusted installation/setup
100
+ - Flagging theoretical issues that cannot occur due to system architecture
101
+ - Missing that alleged vulnerabilities are prevented by framework or language guarantees
102
+ - Reporting issues in test-only or debug-only code paths as production vulnerabilities
103
+
104
+ ### Mathematical/Bounds Analysis False Positives
105
+
106
+ - Reporting integer underflow without proving the mathematical condition can occur
107
+ - Claiming buffer overflow when bounds are mathematically guaranteed by validation
108
+ - Missing that conditional logic creates mathematical impossibility of vulnerable conditions
109
+ - Reporting off-by-one errors without checking if loop bounds prevent the condition
110
+ - Claiming memory corruption when allocation sizes are verified sufficient
111
+ - Reporting arithmetic overflow without checking if input ranges prevent the condition
112
+
113
+ ### API Contract Misunderstanding False Positives
114
+
115
+ - Claiming buffer overflows when APIs have built-in bounds checking
116
+ - Reporting memory corruption for APIs that manage their own memory safely
117
+ - Missing that return values are already validated by the API contract
118
+ - Confusing API parameter modification with vulnerability when API prevents unsafe modification
119
+ - Reporting issues explicitly handled by the API's safety guarantees
120
+ - Missing that seemingly dangerous operations are safe due to API implementation details
121
+
122
+ Part of the `false-positive-check` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/fp-check (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: punctuation and small wording changes for read-only runs.
@@ -0,0 +1,36 @@
1
+ # Gate Reviews and Verdicts
2
+
3
+ Before reporting ANY bug as a vulnerability, all six gate reviews must pass. Evaluate them at the end, after all phases are complete:
4
+
5
+ | Gate | Criterion | Pass | Fail |
6
+ |------|-----------|------|------|
7
+ | **1. Process** | All phases completed with documented evidence | Evidence exists for every phase | Phases lack concrete evidence |
8
+ | **2. Reachability** | Attacker can reach and control data at the vulnerability | Clear evidence of attacker-controlled path + PoC confirms | Cannot demonstrate attacker control or reachability |
9
+ | **3. Real Impact** | Exploitation leads to code execution, privilege escalation, information disclosure, unauthorized changes to data, or loss of money | Direct impact with concrete scenarios | Only operational robustness issue |
10
+ | **4. PoC Validation** | PoC (pseudocode, executable, or unit test) demonstrates the attack path | Shows attacker control, trigger, and impact | PoC fails to show attack path or impact |
11
+ | **5. Math Bounds** | Mathematical analysis confirms vulnerable condition is possible (N/A, counted as pass, when the bug is not about bounds or arithmetic) | Algebraic proof shows condition is possible | Math proves validation prevents it |
12
+ | **6. Environment** | No environmental protections entirely prevent exploitation | Protections do not eliminate vulnerability | Environmental protections block it entirely |
13
+
14
+ For a suspected correctness bug rather than a vulnerability: gate 2 asks whether a realistic input or state reaches the faulty code, and gate 3 whether the outcome is a wrong result, lost or corrupted data, or a crash that users hit.
15
+
16
+ ## Verdict Format
17
+
18
+ - **TRUE POSITIVE**: All gate reviews pass → `BUG #N TRUE POSITIVE - [brief vulnerability description]`
19
+ - **FALSE POSITIVE**: Any gate review fails → `BUG #N FALSE POSITIVE - [brief reason for rejection]`
20
+ - **INCONCLUSIVE**: A gate cannot be decided from the code available (the caller is in another repository, the configuration is not in the repo) → `BUG #N NEEDS VERIFICATION - [the exact open question]`. Reported as a note, never as blocking.
21
+
22
+ If any phase fails verification, document the failure with evidence and continue all remaining phases. Issue the FALSE POSITIVE verdict only after all phases are complete.
23
+
24
+ ## Example Verdict
25
+
26
+ ```
27
+ BUG #3 FALSE POSITIVE - Integer underflow in packet_handler.c:142
28
+ Gate 5 (Math Bounds) FAIL: validation at line 98 ensures packet_size >= 16,
29
+ making (packet_size - header_size) >= 8. Underflow is mathematically impossible.
30
+
31
+ BUG #5 FALSE POSITIVE - IDOR in src/api/files.ts:19
32
+ Gate 2 (Reachability) FAIL: the route is mounted under accountRouter (src/app.ts:52),
33
+ whose middleware loads the file with the session's account id; other accounts' files return 404.
34
+ ```
35
+
36
+ Part of the `false-positive-check` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/fp-check (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: wider impact list for web applications, N/A rule for gate 5, correctness-bug reading of gates 2 and 3, inconclusive verdict, second example.