@tamsensedev/runner 0.0.0-stage → 0.1.0

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 (79) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +45 -2
  3. package/dist/cli.js +2234 -0
  4. package/dist/cli.js.map +1 -0
  5. package/library/.claude-plugin/plugin.json +5 -0
  6. package/library/THIRD_PARTY_NOTICES.md +123 -0
  7. package/library/agents/code-architect.md +67 -0
  8. package/library/agents/code-explorer.md +61 -0
  9. package/library/agents/code-reviewer.md +73 -0
  10. package/library/agents/code-simplifier.md +62 -0
  11. package/library/agents/design-critic.md +52 -0
  12. package/library/agents/second-opinion.md +64 -0
  13. package/library/agents/security-auditor.md +86 -0
  14. package/library/agents/silent-failure-hunter.md +70 -0
  15. package/library/agents/test-coverage-analyzer.md +78 -0
  16. package/library/agents/test-runner.md +48 -0
  17. package/library/agents/ui-tester.md +47 -0
  18. package/library/licenses/Apache-2.0.txt +202 -0
  19. package/library/skills/accessibility/SKILL.md +144 -0
  20. package/library/skills/accessibility/references/wcag-checks.md +168 -0
  21. package/library/skills/addressing-review-feedback/SKILL.md +109 -0
  22. package/library/skills/app-screens/SKILL.md +96 -0
  23. package/library/skills/app-screens/references/shell-kpis-charts.md +108 -0
  24. package/library/skills/app-screens/references/states-density-phone.md +54 -0
  25. package/library/skills/app-screens/references/tables-forms-settings.md +104 -0
  26. package/library/skills/avoiding-generic-ai-design/SKILL.md +92 -0
  27. package/library/skills/avoiding-generic-ai-design/references/tells.md +112 -0
  28. package/library/skills/clean-commits/SKILL.md +85 -0
  29. package/library/skills/design-review/SKILL.md +107 -0
  30. package/library/skills/design-review/references/critique-passes.md +101 -0
  31. package/library/skills/design-review/references/screenshot-procedure.md +113 -0
  32. package/library/skills/differential-security-review/LICENSE +427 -0
  33. package/library/skills/differential-security-review/SKILL.md +105 -0
  34. package/library/skills/differential-security-review/references/adversarial.md +115 -0
  35. package/library/skills/differential-security-review/references/methodology.md +145 -0
  36. package/library/skills/differential-security-review/references/patterns.md +108 -0
  37. package/library/skills/false-positive-check/LICENSE +427 -0
  38. package/library/skills/false-positive-check/SKILL.md +95 -0
  39. package/library/skills/false-positive-check/references/bug-class-verification.md +128 -0
  40. package/library/skills/false-positive-check/references/deep-verification.md +113 -0
  41. package/library/skills/false-positive-check/references/evidence-templates.md +93 -0
  42. package/library/skills/false-positive-check/references/false-positive-patterns.md +122 -0
  43. package/library/skills/false-positive-check/references/gate-reviews.md +36 -0
  44. package/library/skills/false-positive-check/references/standard-verification.md +80 -0
  45. package/library/skills/focused-implementation/SKILL.md +104 -0
  46. package/library/skills/implementation-plan/SKILL.md +66 -0
  47. package/library/skills/interface-design/SKILL.md +144 -0
  48. package/library/skills/interface-design/references/craft-defaults.md +130 -0
  49. package/library/skills/interface-design/references/new-direction.md +62 -0
  50. package/library/skills/interface-design/references/writing.md +52 -0
  51. package/library/skills/interface-polish/SKILL.md +103 -0
  52. package/library/skills/interface-polish/references/detail-rules.md +154 -0
  53. package/library/skills/interface-polish/references/worst-case-data.md +158 -0
  54. package/library/skills/motion-design/SKILL.md +106 -0
  55. package/library/skills/motion-design/references/recipes.md +243 -0
  56. package/library/skills/postgres-performance/SKILL.md +97 -0
  57. package/library/skills/postgres-performance/references/rules.md +265 -0
  58. package/library/skills/project-orientation/SKILL.md +77 -0
  59. package/library/skills/reviewing-changes/SKILL.md +183 -0
  60. package/library/skills/safe-database-changes/SKILL.md +111 -0
  61. package/library/skills/safe-database-changes/references/backfills.md +75 -0
  62. package/library/skills/safe-database-changes/references/migration-tools.md +69 -0
  63. package/library/skills/safe-database-changes/references/postgres-ddl.md +199 -0
  64. package/library/skills/security-review/SKILL.md +132 -0
  65. package/library/skills/security-review/references/checks-by-area.md +107 -0
  66. package/library/skills/security-review/references/do-not-report.md +86 -0
  67. package/library/skills/spec-writing/SKILL.md +144 -0
  68. package/library/skills/systematic-debugging/SKILL.md +130 -0
  69. package/library/skills/systematic-debugging/references/flaky-tests.md +51 -0
  70. package/library/skills/systematic-debugging/references/root-cause-tracing.md +55 -0
  71. package/library/skills/task-interview/SKILL.md +84 -0
  72. package/library/skills/test-driven-development/SKILL.md +116 -0
  73. package/library/skills/test-driven-development/references/writing-good-tests.md +85 -0
  74. package/library/skills/ui-testing/SKILL.md +99 -0
  75. package/library/skills/ui-testing/references/headless-check.md +262 -0
  76. package/library/skills/ui-testing/references/playwright-patterns.md +134 -0
  77. package/library/skills/verification-before-completion/SKILL.md +113 -0
  78. package/library/skills/web-interface-guidelines/SKILL.md +202 -0
  79. package/package.json +44 -5
@@ -0,0 +1,115 @@
1
+ # Adversarial analysis (phase 5)
2
+
3
+ Read after phase 4 for every HIGH risk change. The rule: concrete impact only, never "could cause issues". Every finding names the data exposed, the privilege gained, the money at risk or the invariant broken.
4
+
5
+ Everything here is analysis on paper and reading code. Do not send requests to live services, and do not write files into the repository under review.
6
+
7
+ ## 1. Define a specific attacker model
8
+
9
+ **Who is the attacker?**
10
+ - Unauthenticated visitor
11
+ - Authenticated regular user
12
+ - User of another tenant or organisation
13
+ - Malicious or compromised administrator
14
+ - Compromised upstream service, webhook sender or dependency
15
+
16
+ **What access do they have?**
17
+ - Public API only
18
+ - An authenticated role
19
+ - Specific permissions or tokens
20
+ - Ability to send webhooks, queue messages or files
21
+
22
+ **Where do they interact with the system?**
23
+ - Specific HTTP endpoints, pages or forms
24
+ - RPC, GraphQL or WebSocket interfaces
25
+ - Jobs triggered by their input
26
+ - External APIs the system calls on their behalf
27
+
28
+ ## 2. Identify concrete attack vectors
29
+
30
+ ```
31
+ ENTRY POINT: <exact endpoint or function the attacker can reach>
32
+
33
+ ATTACK SEQUENCE:
34
+ 1. <specific request with parameters>
35
+ 2. <how it reaches the vulnerable code, file:line>
36
+ 3. <what happens in the vulnerable code>
37
+ 4. <impact achieved>
38
+
39
+ PROOF OF ACCESSIBILITY:
40
+ - The entry point is exposed (route registered, no guard in front)
41
+ - The attacker has the required permissions
42
+ - The path exists through real interfaces, not only internal calls
43
+ ```
44
+
45
+ ## 3. Rate realistic exploitability
46
+
47
+ **EASY:** through public or ordinary user APIs, no special privileges, a single request, no special conditions.
48
+
49
+ **MEDIUM:** needs specific conditions or elevated but obtainable privileges: several steps, timing, a particular system state.
50
+
51
+ **HARD:** needs admin privileges, rare conditions or significant resources.
52
+
53
+ ## 4. Build the complete exploit scenario
54
+
55
+ ```
56
+ ATTACKER STARTING POSITION:
57
+ <what the attacker has at the beginning>
58
+
59
+ STEP-BY-STEP EXPLOITATION:
60
+ Step 1: <concrete action through an accessible interface>
61
+ - Request: <exact call>
62
+ - Parameters: <specific values>
63
+ - Result: <what happens>
64
+ Step 2: <next action>
65
+ - Why this works: <reference to the code change>
66
+ - State change: <what changed>
67
+ Step 3: <final impact>
68
+ - Result: <concrete harm>
69
+ - Evidence: <how to verify it from the code or a test>
70
+
71
+ CONCRETE IMPACT:
72
+ <specific and measurable: which records exposed, which privilege gained, how much money>
73
+ ```
74
+
75
+ ## 5. Cross-reference with the baseline
76
+
77
+ From the baseline context in [methodology.md](methodology.md):
78
+
79
+ - Does this violate a system-wide invariant?
80
+ - Does it break a trust boundary?
81
+ - Does it bypass a validation pattern used elsewhere?
82
+ - Is it a regression of an earlier fix?
83
+
84
+ ## Finding template
85
+
86
+ ```
87
+ [SEVERITY] <title>
88
+
89
+ Attacker model:
90
+ - WHO: <attacker type>
91
+ - ACCESS: <privileges>
92
+ - INTERFACE: <entry point>
93
+
94
+ Attack vector: <step-by-step through accessible interfaces>
95
+ Exploitability: EASY | MEDIUM | HARD, because <reason>
96
+ Concrete impact: <specific harm>
97
+ Proof of concept: <pseudocode or request sequence>
98
+ Root cause: <file:line, commit>
99
+ Blast radius: <N callers>
100
+ Baseline violation: <invariant or pattern broken>
101
+ ```
102
+
103
+ ## Example
104
+
105
+ **Change:** a refactor of the invoice routes moved handlers into a new router file. The old router applied `requireAccountMember` to the whole `/accounts/:accountId/*` group; the new file registers `GET /invoices/:id` without it and loads the invoice by id alone.
106
+
107
+ 1. **Attacker model.** WHO: any authenticated user. ACCESS: an ordinary account. INTERFACE: `GET /invoices/:id`.
108
+ 2. **Attack vector.** ENTRY POINT: `GET /invoices/:id`. SEQUENCE: log in with any account; request `/invoices/1001`, `/invoices/1002`, and so on; the handler calls `invoiceRepo.findById(id)` (src/invoices/routes.ts:24) with no account filter; the full invoice is returned. PROOF: the route is registered in src/app.ts:40 behind `requireLogin` only.
109
+ 3. **Exploitability.** EASY: one request per invoice, ordinary user, ids are sequential integers.
110
+ 4. **Impact.** Every invoice of every customer can be read: names, addresses, amounts, tax ids.
111
+ 5. **Baseline violation.** Breaks the invariant "a user only sees data of accounts they belong to". `requireAccountMember` guards every other account resource (12 routes). Git history: the guard was added in commit 4f2a9c1, "Fix: invoices readable across accounts". This is a regression.
112
+
113
+ Recommendation: register the route inside the account-scoped router, or add the guard and filter the query by account id; add a test that a member of account A gets 404 for an invoice of account B.
114
+
115
+ Part of the `differential-security-review` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/differential-review (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: attacker types and example rewritten for web applications, no live testing, no separate agent.
@@ -0,0 +1,145 @@
1
+ # Differential review methodology (phases 0 to 4)
2
+
3
+ Read at the start of every differential security review. `<base>` is the base branch named in the task (for example `origin/main`); `<repo>` is the repository folder. Never check out another commit in the repository under review.
4
+
5
+ ## Before phase 0: baseline context
6
+
7
+ Understand what the code was supposed to do before the change. From the base version (`git -C <repo> show <base>:<path>`, or a detached worktree in a temp directory outside the repository), capture:
8
+
9
+ - System-wide invariants: what must always be true (a user only sees their own account's data; a balance never goes negative).
10
+ - Trust boundaries and privilege levels: who can do what, and where that is enforced.
11
+ - Validation patterns: what gets checked where, and which checks are layered as defense in depth.
12
+ - Call graphs for the critical functions the change touches.
13
+ - How state changes flow (status transitions, money movement).
14
+ - External dependencies and the assumptions made about them.
15
+
16
+ This lets you spot when the change violates an invariant, breaks a layer of defense, or deviates from a system-wide pattern.
17
+
18
+ ## Phase 0: intake and triage
19
+
20
+ ```bash
21
+ git -C <repo> log --oneline <base>..HEAD
22
+ git -C <repo> diff --stat <base>...HEAD
23
+ git -C <repo> diff --name-only <base>...HEAD
24
+ ```
25
+
26
+ Assess codebase size (count source files of the main languages, for example `git -C <repo> ls-files '*.ts' '*.py' '*.go' | wc -l`) and pick the strategy:
27
+
28
+ - Small (under 20 files): deep analysis, read all dependencies.
29
+ - Medium (20 to 200): focused analysis, one hop of dependencies.
30
+ - Large (over 200): surgical, critical paths only.
31
+
32
+ Give every changed file a risk level:
33
+
34
+ - HIGH: auth, crypto, external calls, value transfer, validation removal, permission changes.
35
+ - MEDIUM: business logic, state changes, new public APIs.
36
+ - LOW: comments, tests, UI text, logging.
37
+
38
+ ## Phase 1: changed code analysis
39
+
40
+ For each changed file, highest risk first:
41
+
42
+ 1. **Read both versions**, base and head.
43
+ 2. **Analyse each diff region:**
44
+ ```
45
+ BEFORE: <exact code>
46
+ AFTER: <exact code>
47
+ CHANGE: <behavioural impact>
48
+ SECURITY: <implications>
49
+ ```
50
+ 3. **Check the history of removed code.** When was it added, and why?
51
+ ```bash
52
+ git -C <repo> log -S "<removed code>" --oneline <base>
53
+ git -C <repo> blame <base> -- <file>
54
+ git -C <repo> show <commit>
55
+ ```
56
+ Red flags: removed code that came from a "fix", "security", "CVE" or "vulnerability" commit is CRITICAL until explained. Code added recently (under a month) and now removed is HIGH.
57
+ 4. **Check for regressions** (code being re-added):
58
+ ```bash
59
+ git -C <repo> log -S "<added code>" -p <base>
60
+ ```
61
+ Pattern: added, removed for security, re-added now means a regression.
62
+ 5. **Micro-adversarial questions** for each change:
63
+ - What attack did the removed code prevent?
64
+ - What new surface does the new code expose?
65
+ - Can the modified logic be bypassed?
66
+ - Are checks weaker? Are edge cases still covered?
67
+ 6. **Write concrete attack scenarios** for anything suspicious:
68
+ ```
69
+ SCENARIO: <attack goal>
70
+ PRECONDITIONS: <required state>
71
+ STEPS:
72
+ 1. <specific action>
73
+ 2. <expected outcome>
74
+ 3. <exploitation>
75
+ WHY IT WORKS: <reference to the code change, file:line>
76
+ IMPACT: <severity and scope>
77
+ ```
78
+
79
+ ## Phase 2: test coverage of changed code
80
+
81
+ ```bash
82
+ git -C <repo> diff --name-only <base>...HEAD | grep -v -i test
83
+ git -C <repo> diff --name-only <base>...HEAD | grep -i test
84
+ git -C <repo> grep -n "<functionName>" -- '*test*' '*spec*'
85
+ ```
86
+
87
+ Adapt the test file patterns to the project's layout. Risk elevation rules:
88
+
89
+ - New function and no tests: raise MEDIUM to HIGH.
90
+ - Modified validation and unchanged tests: HIGH.
91
+ - Complex logic (over 20 lines) and no tests: HIGH.
92
+
93
+ ## Phase 3: blast radius
94
+
95
+ Count the callers of each modified function:
96
+
97
+ ```bash
98
+ git -C <repo> grep -n "<functionName>(" | wc -l
99
+ ```
100
+
101
+ Also check dynamic references (route tables, dependency injection, string-based lookups) where the language uses them.
102
+
103
+ | Callers | Blast radius |
104
+ |---|---|
105
+ | 1 to 5 | LOW |
106
+ | 6 to 20 | MEDIUM |
107
+ | 21 to 50 | HIGH |
108
+ | over 50 | CRITICAL |
109
+
110
+ Priority matrix:
111
+
112
+ | Change risk | Blast radius | Priority | Depth |
113
+ |---|---|---|---|
114
+ | HIGH | CRITICAL | P0 | Deep, all dependencies |
115
+ | HIGH | HIGH or MEDIUM | P1 | Deep |
116
+ | HIGH | LOW | P2 | Standard |
117
+ | MEDIUM | CRITICAL or HIGH | P1 | Standard plus callers |
118
+
119
+ ## Phase 4: deep context for HIGH risk changes
120
+
121
+ For each HIGH risk changed function, using Read, Grep and code tracing:
122
+
123
+ 1. **Map the function flow:** entry conditions (guards, middleware, decorators), state read, state written, external calls, return values and side effects.
124
+ 2. **Trace internal calls:** list every function called and map their flows in turn.
125
+ 3. **Trace external calls:** which trust boundaries are crossed, what is assumed about the other side's behaviour, whether a callback or re-entry is possible.
126
+ 4. **Identify invariants:** what must always be true, what must never happen, and whether the change keeps them.
127
+ 5. **Five whys:**
128
+ - Why was this code changed?
129
+ - Why did the original code exist?
130
+ - Why might this break?
131
+ - Why was this approach chosen?
132
+ - Why could this fail in production?
133
+
134
+ **Cross-cutting patterns:** find the validation and permission patterns repeated across the codebase and check whether the diff removed any instance:
135
+
136
+ ```bash
137
+ git -C <repo> grep -n "<repeated guard, e.g. requireRole(>"
138
+ git -C <repo> diff <base>...HEAD | grep "^-.*<repeated guard>"
139
+ ```
140
+
141
+ Flag a removal that breaks defense in depth.
142
+
143
+ Next: for HIGH risk changes, continue with [adversarial.md](adversarial.md).
144
+
145
+ Part of the `differential-security-review` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/differential-review (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: no checkouts, no external skills, commands made language-neutral and scoped to the repository folder.
@@ -0,0 +1,108 @@
1
+ # Common vulnerability patterns in diffs
2
+
3
+ Read during phase 1. Quick reference for detecting security problems in a change. Each `git diff` command assumes `git -C <repo> diff <base>...HEAD`, shortened below to `git diff <range>`.
4
+
5
+ ## Security regressions
6
+
7
+ **Pattern:** code previously removed for security reasons is added again.
8
+
9
+ ```bash
10
+ git log -S "<pattern>" --oneline -i --grep="security\|fix\|cve\|vuln" <base>
11
+ ```
12
+
13
+ Red flags: the earlier commit message mentions security, fix, CVE or vulnerability; the removal was recent (under six months); the current change gives no reason for re-adding it.
14
+
15
+ ## Missing validation
16
+
17
+ **Pattern:** a check, guard, assertion or schema rule removed without a replacement.
18
+
19
+ ```bash
20
+ git diff <range> | grep -E "^-.*(throw|assert|require|validate|schema|guard|check|return .*40[0-4])"
21
+ ```
22
+
23
+ Ask: was the validation moved elsewhere? Is it truly redundant? Does the removal expose something?
24
+
25
+ ```diff
26
+ async function withdraw(userId, amount) {
27
+ - if (amount <= 0) throw new BadRequest('amount must be positive')
28
+ - if (amount > await balanceOf(userId)) throw new BadRequest('insufficient funds')
29
+ await ledger.debit(userId, amount)
30
+ }
31
+ ```
32
+
33
+ Risk: negative withdrawals credit the account; overdrafts are possible.
34
+
35
+ ## Access control bypass
36
+
37
+ **Pattern:** a permission check removed or relaxed, or a route moved out of a protected group.
38
+
39
+ ```bash
40
+ git diff <range> | grep -E "^-.*(auth|guard|policy|permission|role|can[A-Z]|isAdmin|owner|tenant|accountId)"
41
+ ```
42
+
43
+ Ask: who can call this now? What is the new trust model? Was the check moved to the caller, and do all callers have it?
44
+
45
+ ```diff
46
+ - router.post('/settings', requireRole('admin'), updateSettings)
47
+ + router.post('/settings', updateSettings)
48
+ ```
49
+
50
+ Risk: any user can change global settings.
51
+
52
+ ## Double accounting
53
+
54
+ **Pattern:** the same balance, stock or counter is changed twice for one logical event, often in two functions that each assume the other did not.
55
+
56
+ ```js
57
+ // request a refund
58
+ balance[user] += amount // first credit
59
+ // later, when the provider confirms
60
+ balance[user] += amount // second credit: bug
61
+ ```
62
+
63
+ Impact: users are credited twice; the books do not balance.
64
+
65
+ ## Races and check-then-act
66
+
67
+ **Pattern:** a value is checked and then used in separate steps without a transaction, lock or unique constraint: coupon redemption, stock reservation, "only one active subscription", balance checks.
68
+
69
+ Ask: what happens when two requests arrive at the same moment? Is there a database constraint that makes the second one fail?
70
+
71
+ ## Unchecked results of external calls
72
+
73
+ **Pattern:** the response of a payment provider, storage service, email API or child process is not checked, so a failure is treated as success.
74
+
75
+ ```bash
76
+ git diff <range> | grep -E "^\+.*(fetch\(|axios|request\(|\.send\(|\.charge\(|\.upload\(|exec\()"
77
+ ```
78
+
79
+ Risk: silent failures leave state inconsistent (order marked paid, charge failed).
80
+
81
+ ## New external calls and outbound URLs
82
+
83
+ **Pattern:** the change adds calls to other services or fetches URLs. Check where the URL and the data come from (SSRF), whether TLS verification stays on, and whether the response is validated before use.
84
+
85
+ ## Denial of service
86
+
87
+ **Pattern:** loops or queries over user-controlled sizes, unbounded batch endpoints, work that one request can multiply. Report as a note unless the task is about it; it does not block on its own.
88
+
89
+ ## Smart contracts
90
+
91
+ If the repository is a smart-contract project, also check: external calls made before state updates (re-entrancy), arithmetic in `unchecked` blocks or old compiler versions (overflow), security logic depending on block timestamps, two-step approvals open to front-running, and return values of token transfers that are ignored.
92
+
93
+ ## Quick detection commands
94
+
95
+ ```bash
96
+ # removed checks
97
+ git diff <range> | grep "^-" | grep -E "throw|assert|require|validate|guard|policy"
98
+ # added external calls
99
+ git diff <range> | grep "^+" | grep -E "fetch\(|axios|http\.|request\(|exec\(|spawn\("
100
+ # changed visibility or exposure
101
+ git diff <range> | grep -E "export |public |private |internal |router\.|app\.(get|post|put|delete)"
102
+ # raw queries and raw HTML
103
+ git diff <range> | grep "^+" | grep -E "raw|Unsafe|innerHTML|v-html|dangerouslySetInnerHTML"
104
+ ```
105
+
106
+ Next: methodology in [methodology.md](methodology.md), exploit scenarios in [adversarial.md](adversarial.md).
107
+
108
+ Part of the `differential-security-review` skill, adapted from https://github.com/trailofbits/skills/tree/main/plugins/differential-review (commit 5c99c03fb8a9ea568432ecbcba5d86e9f4ac2bf0), CC BY-SA 4.0. Changed: examples and detection commands rewritten for web stacks, smart-contract patterns condensed into one section, added races, double accounting and outbound-call patterns for web applications.