forgecraft-mcp 1.2.0 → 1.3.2

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 (136) hide show
  1. package/README.md +525 -525
  2. package/dist/cli/help.js +44 -44
  3. package/dist/registry/renderer-skeletons.js +92 -92
  4. package/dist/shared/gs-score-logger.js +6 -6
  5. package/dist/tools/add-module.js +123 -123
  6. package/dist/tools/advice-registry.js +18 -18
  7. package/dist/tools/check-cascade-report.js +64 -64
  8. package/dist/tools/configure-mcp.d.ts +3 -0
  9. package/dist/tools/configure-mcp.d.ts.map +1 -1
  10. package/dist/tools/configure-mcp.js +10 -0
  11. package/dist/tools/configure-mcp.js.map +1 -1
  12. package/dist/tools/forgecraft-dispatch.d.ts.map +1 -1
  13. package/dist/tools/forgecraft-dispatch.js +3 -0
  14. package/dist/tools/forgecraft-dispatch.js.map +1 -1
  15. package/dist/tools/forgecraft-schema-params.d.ts +9 -0
  16. package/dist/tools/forgecraft-schema-params.d.ts.map +1 -1
  17. package/dist/tools/forgecraft-schema-params.js +21 -0
  18. package/dist/tools/forgecraft-schema-params.js.map +1 -1
  19. package/dist/tools/forgecraft-schema.d.ts +9 -0
  20. package/dist/tools/forgecraft-schema.d.ts.map +1 -1
  21. package/dist/tools/refresh-output.js +14 -14
  22. package/dist/tools/scaffold-spec-stubs.js +115 -115
  23. package/dist/tools/scaffold-templates.js +62 -62
  24. package/dist/tools/setup-artifact-writers.d.ts +30 -0
  25. package/dist/tools/setup-artifact-writers.d.ts.map +1 -1
  26. package/dist/tools/setup-artifact-writers.js +120 -8
  27. package/dist/tools/setup-artifact-writers.js.map +1 -1
  28. package/dist/tools/setup-phase1.d.ts +3 -0
  29. package/dist/tools/setup-phase1.d.ts.map +1 -1
  30. package/dist/tools/setup-phase1.js +79 -35
  31. package/dist/tools/setup-phase1.js.map +1 -1
  32. package/dist/tools/setup-phase2.d.ts +2 -0
  33. package/dist/tools/setup-phase2.d.ts.map +1 -1
  34. package/dist/tools/setup-phase2.js +10 -1
  35. package/dist/tools/setup-phase2.js.map +1 -1
  36. package/dist/tools/setup-project.d.ts +18 -0
  37. package/dist/tools/setup-project.d.ts.map +1 -1
  38. package/dist/tools/setup-project.js +77 -1
  39. package/dist/tools/setup-project.js.map +1 -1
  40. package/dist/tools/spec-parser-tags.d.ts +9 -0
  41. package/dist/tools/spec-parser-tags.d.ts.map +1 -1
  42. package/dist/tools/spec-parser-tags.js +92 -0
  43. package/dist/tools/spec-parser-tags.js.map +1 -1
  44. package/package.json +89 -86
  45. package/templates/analytics/instructions.yaml +37 -37
  46. package/templates/analytics/mcp-servers.yaml +11 -11
  47. package/templates/analytics/structure.yaml +25 -25
  48. package/templates/api/instructions.yaml +231 -231
  49. package/templates/api/mcp-servers.yaml +22 -13
  50. package/templates/api/nfr.yaml +23 -23
  51. package/templates/api/review.yaml +103 -103
  52. package/templates/api/structure.yaml +34 -34
  53. package/templates/api/verification.yaml +132 -132
  54. package/templates/cli/instructions.yaml +31 -31
  55. package/templates/cli/mcp-servers.yaml +11 -11
  56. package/templates/cli/review.yaml +53 -53
  57. package/templates/cli/structure.yaml +16 -16
  58. package/templates/data-lineage/instructions.yaml +28 -28
  59. package/templates/data-lineage/mcp-servers.yaml +22 -22
  60. package/templates/data-pipeline/instructions.yaml +84 -84
  61. package/templates/data-pipeline/mcp-servers.yaml +13 -13
  62. package/templates/data-pipeline/nfr.yaml +39 -39
  63. package/templates/data-pipeline/structure.yaml +23 -23
  64. package/templates/fintech/hooks.yaml +55 -55
  65. package/templates/fintech/instructions.yaml +112 -112
  66. package/templates/fintech/mcp-servers.yaml +13 -13
  67. package/templates/fintech/nfr.yaml +46 -46
  68. package/templates/fintech/playbook.yaml +210 -210
  69. package/templates/fintech/verification.yaml +239 -239
  70. package/templates/game/instructions.yaml +289 -289
  71. package/templates/game/mcp-servers.yaml +38 -38
  72. package/templates/game/nfr.yaml +64 -64
  73. package/templates/game/playbook.yaml +214 -214
  74. package/templates/game/review.yaml +97 -97
  75. package/templates/game/structure.yaml +67 -67
  76. package/templates/game/verification.yaml +174 -174
  77. package/templates/healthcare/instructions.yaml +42 -42
  78. package/templates/healthcare/mcp-servers.yaml +13 -13
  79. package/templates/healthcare/nfr.yaml +47 -47
  80. package/templates/hipaa/instructions.yaml +41 -41
  81. package/templates/hipaa/mcp-servers.yaml +13 -13
  82. package/templates/infra/instructions.yaml +104 -104
  83. package/templates/infra/mcp-servers.yaml +20 -20
  84. package/templates/infra/nfr.yaml +46 -46
  85. package/templates/infra/review.yaml +65 -65
  86. package/templates/infra/structure.yaml +25 -25
  87. package/templates/library/instructions.yaml +36 -36
  88. package/templates/library/mcp-servers.yaml +20 -20
  89. package/templates/library/review.yaml +56 -56
  90. package/templates/library/structure.yaml +19 -19
  91. package/templates/medallion-architecture/instructions.yaml +41 -41
  92. package/templates/medallion-architecture/mcp-servers.yaml +22 -22
  93. package/templates/ml/instructions.yaml +85 -85
  94. package/templates/ml/mcp-servers.yaml +11 -11
  95. package/templates/ml/nfr.yaml +39 -39
  96. package/templates/ml/structure.yaml +25 -25
  97. package/templates/ml/verification.yaml +156 -156
  98. package/templates/mobile/instructions.yaml +44 -44
  99. package/templates/mobile/mcp-servers.yaml +11 -11
  100. package/templates/mobile/nfr.yaml +49 -49
  101. package/templates/mobile/structure.yaml +27 -27
  102. package/templates/mobile/verification.yaml +121 -121
  103. package/templates/observability-xray/instructions.yaml +40 -40
  104. package/templates/observability-xray/mcp-servers.yaml +15 -15
  105. package/templates/realtime/instructions.yaml +42 -42
  106. package/templates/realtime/mcp-servers.yaml +13 -13
  107. package/templates/soc2/instructions.yaml +41 -41
  108. package/templates/soc2/mcp-servers.yaml +24 -24
  109. package/templates/social/instructions.yaml +43 -43
  110. package/templates/social/mcp-servers.yaml +24 -24
  111. package/templates/state-machine/instructions.yaml +42 -42
  112. package/templates/state-machine/mcp-servers.yaml +11 -11
  113. package/templates/tools-registry.yaml +164 -164
  114. package/templates/universal/hooks.yaml +531 -531
  115. package/templates/universal/instructions.yaml +1692 -1692
  116. package/templates/universal/mcp-servers.yaml +50 -50
  117. package/templates/universal/nfr.yaml +197 -197
  118. package/templates/universal/reference.yaml +326 -326
  119. package/templates/universal/review.yaml +204 -204
  120. package/templates/universal/skills.yaml +262 -262
  121. package/templates/universal/structure.yaml +67 -67
  122. package/templates/universal/verification.yaml +416 -416
  123. package/templates/web-react/hooks.yaml +44 -44
  124. package/templates/web-react/instructions.yaml +207 -207
  125. package/templates/web-react/mcp-servers.yaml +20 -20
  126. package/templates/web-react/nfr.yaml +27 -27
  127. package/templates/web-react/review.yaml +94 -94
  128. package/templates/web-react/structure.yaml +46 -46
  129. package/templates/web-react/verification.yaml +126 -126
  130. package/templates/web-static/instructions.yaml +115 -115
  131. package/templates/web-static/mcp-servers.yaml +20 -20
  132. package/templates/web3/instructions.yaml +44 -44
  133. package/templates/web3/mcp-servers.yaml +11 -11
  134. package/templates/web3/verification.yaml +159 -159
  135. package/templates/zero-trust/instructions.yaml +41 -41
  136. package/templates/zero-trust/mcp-servers.yaml +15 -15
@@ -1,159 +1,159 @@
1
- tag: WEB3
2
- section: verification
3
- title: "Smart Contract Formal Test + Gas Simulation"
4
- description: >
5
- Web3 verification has two dimensions. Deterministic: smart contract function
6
- behavior is formally specifiable — ABI types, state transition invariants,
7
- and revert conditions are exact contracts checkable by automated tests.
8
- Stochastic: gas costs vary with network congestion and state size; they must
9
- be simulated at scale to identify DoS vectors and confirm cost bounds remain
10
- within user-acceptable thresholds under adversarial conditions.
11
- uncertainty_levels:
12
- - deterministic
13
- - stochastic
14
- completeness_ceiling: 0.88
15
-
16
- phases:
17
-
18
- - id: contract-definition
19
- title: "Define ABI Contracts, Invariants, and Gas Bounds"
20
- rationale: >
21
- A smart contract is immutable once deployed. Verification contracts must be
22
- more rigorous than any other domain: post-deployment bugs cannot be patched,
23
- only mitigated. State machine invariants, access control rules, and gas bounds
24
- must be written as formal properties before a single line of Solidity is written.
25
- steps:
26
- - id: define-abi-contracts
27
- instruction: >
28
- For every public and external function, define:
29
- - Preconditions: all require() and revert() conditions with natural-language meaning
30
- - Postconditions: what state changes are guaranteed on success
31
- - Events emitted: name, indexed fields, non-indexed fields
32
- - Reentrancy status: is this function safe to call while executing?
33
- Store in docs/abi-contracts.md. One section per function.
34
- contract: >
35
- docs/abi-contracts.md exists with one section per public/external function.
36
- Every function has preconditions, postconditions, and reentrancy status.
37
- tools: ["filesystem", "natspec comments in Solidity"]
38
- expected_output: "## transfer(address to, uint256 amount)\n**Pre:** caller balance ≥ amount\n**Post:** balances[caller] -= amount; balances[to] += amount"
39
- pass_criterion: "File exists; every public function in the ABI has a corresponding section"
40
-
41
- - id: define-invariants
42
- instruction: >
43
- Write the global invariants that must hold after every transaction:
44
- - Conservation: totalSupply == sum(balances) (for token contracts)
45
- - Access control: only owner can call admin functions
46
- - State machine: cannot transition from COMPLETED to ACTIVE
47
- - Economic: protocol fee ≤ 3% of any individual transaction
48
- These become the property tests run after every state transition in Foundry.
49
- contract: >
50
- docs/invariants.md lists all global invariants with formal notation.
51
- Each invariant has: name, condition, and a counterexample that would violate it.
52
- tools: ["filesystem"]
53
- expected_output: "| conservation | totalSupply == sum(all balances) | minting without incrementing supply |"
54
- pass_criterion: "File exists with ≥1 invariant per contract with counterexample"
55
-
56
- - id: define-gas-bounds
57
- instruction: >
58
- For each function, define maximum acceptable gas consumption:
59
- - Simple reads: ≤ 30,000 gas
60
- - Simple writes (single SSTORE): ≤ 50,000 gas
61
- - Complex operations: document the formula and ceiling with justification
62
- Store in docs/gas-contracts.md. Include adversarial scenarios:
63
- e.g., "calling batchTransfer with 500 recipients must cost ≤ 5,000,000 gas."
64
- contract: "docs/gas-contracts.md with numeric gas ceiling per function and adversarial scenario"
65
- tools: ["filesystem"]
66
- expected_output: "| batchTransfer(500) | 5,000,000 gas | adversarial max recipients |"
67
- pass_criterion: "File exists; every user-callable function has a numeric gas ceiling"
68
-
69
- - id: execution
70
- title: "Foundry Test Suite + Gas Simulation"
71
- rationale: >
72
- Foundry runs Solidity tests at EVM speed. Property-based tests (invariant tests)
73
- automatically generate counterexamples to global invariants. Forge gas reports
74
- provide exact gas consumption per function. Hardhat fork simulation tests
75
- behavior under mainnet state to detect integration assumptions.
76
- steps:
77
- - id: run-foundry-unit-tests
78
- instruction: >
79
- Write and run Foundry unit tests for every function. Each test covers:
80
- - Happy path
81
- - Each revert/require condition (expect the revert with the specific error)
82
- - Edge cases (zero values, max uint256, zero address, self-transfer)
83
- Run with `forge test -vvv`. All tests must pass with 0 failures.
84
- contract: >
85
- forge test exits 0. Every function has ≥3 test cases covering happy path,
86
- revert conditions, and edge cases. Coverage ≥ 95% branch coverage.
87
- tools: ["forge test -vvv", "forge coverage --report lcov"]
88
- expected_output: "forge test: 0 failed, N passed. Coverage: branch 97%"
89
- pass_criterion: "forge test exits 0; branch coverage ≥ 95%"
90
-
91
- - id: run-invariant-property-tests
92
- instruction: >
93
- Write Foundry invariant tests for each invariant in docs/invariants.md.
94
- Foundry will call random sequences of functions and assert the invariant
95
- holds after each call. Configure minimum 10,000 runs per invariant.
96
- Any counterexample found by Foundry is a critical bug.
97
- contract: >
98
- One Foundry invariant test function per invariant.
99
- All invariants hold after 10,000 random call sequences.
100
- Zero counterexamples found.
101
- tools: ["forge test --mt invariant --runs 10000"]
102
- expected_output: "No counterexamples found. Invariant tests: all PASS"
103
- pass_criterion: "forge test exits 0 with no counterexample output"
104
-
105
- - id: run-gas-simulation
106
- instruction: >
107
- Run `forge snapshot` to record gas usage per test. Compare against the
108
- gas ceilings in docs/gas-contracts.md. For adversarial scenarios (max batch size,
109
- unbounded loops), run explicit gas-measurement tests using `gasleft()` instrumentation.
110
- Any function exceeding its gas ceiling is a FAIL — gas is a security invariant.
111
- contract: >
112
- Gas usage per function ≤ ceiling in docs/gas-contracts.md.
113
- forge snapshot diff vs. main shows no O(N) growth in single-SLOAD functions.
114
- tools: ["forge snapshot", "forge test --gas-report", "gasleft() instrumentation"]
115
- expected_output: "gas-report.json: {function, actual_gas, ceiling, pass}"
116
- pass_criterion: "All pass fields = true in gas-report.json"
117
-
118
- - id: run-fork-simulation
119
- instruction: >
120
- Fork mainnet (or the target network) at a recent block using a public RPC.
121
- Deploy the contract to the fork. Run integration scenarios that depend on
122
- mainnet state (e.g., oracle prices, existing token balances, DEX liquidity).
123
- Assert that stochastic outputs (gas variation under network congestion,
124
- slippage under low liquidity) remain within the gas bounds defined.
125
- contract: >
126
- Forked tests pass on the mainnet fork.
127
- Gas variation under congestion simulation ≤ 15% above baseline.
128
- tools: ["forge test --fork-url $MAINNET_RPC", "anvil --fork-url"]
129
- expected_output: "Fork test results: all PASS. Gas variance report under load."
130
- pass_criterion: "forge test exits 0 on fork; gas variance ≤ 15%"
131
-
132
- - id: evidence
133
- title: "Persist Audit Trail and Gas Snapshots"
134
- rationale: >
135
- Smart contract audit evidence must be immutable and versioned. Gas snapshots
136
- committed to git make regressions visible in pull request diffs.
137
- steps:
138
- - id: commit-gas-snapshot
139
- instruction: >
140
- Commit the Foundry gas snapshot (.gas-snapshot) to the repository.
141
- In CI, run `forge snapshot --check` which exits non-zero if gas has
142
- regressed from the committed snapshot. This makes gas regressions
143
- visible in every pull request.
144
- contract: ".gas-snapshot exists in repository root; CI runs forge snapshot --check"
145
- tools: ["forge snapshot", "git add .gas-snapshot"]
146
- expected_output: ".gas-snapshot file committed; CI job 'gas-regression-check' passes"
147
- pass_criterion: ".gas-snapshot present; forge snapshot --check exits 0 in CI"
148
-
149
- - id: persist-test-reports
150
- instruction: >
151
- Save to docs/audit/:
152
- - forge-test-report.json (all test results)
153
- - gas-report.json (function gas vs ceiling)
154
- - invariant-results.json (which invariants tested, how many runs)
155
- Include git commit SHA and Solidity compiler version in each file.
156
- contract: "docs/audit/ exists with all 3 JSON files after every test run"
157
- tools: ["forge test --json", "jq"]
158
- expected_output: "docs/audit/forge-test-report.json with timestamp and commit SHA"
159
- pass_criterion: "Files exist and parse; commit SHA present"
1
+ tag: WEB3
2
+ section: verification
3
+ title: "Smart Contract Formal Test + Gas Simulation"
4
+ description: >
5
+ Web3 verification has two dimensions. Deterministic: smart contract function
6
+ behavior is formally specifiable — ABI types, state transition invariants,
7
+ and revert conditions are exact contracts checkable by automated tests.
8
+ Stochastic: gas costs vary with network congestion and state size; they must
9
+ be simulated at scale to identify DoS vectors and confirm cost bounds remain
10
+ within user-acceptable thresholds under adversarial conditions.
11
+ uncertainty_levels:
12
+ - deterministic
13
+ - stochastic
14
+ completeness_ceiling: 0.88
15
+
16
+ phases:
17
+
18
+ - id: contract-definition
19
+ title: "Define ABI Contracts, Invariants, and Gas Bounds"
20
+ rationale: >
21
+ A smart contract is immutable once deployed. Verification contracts must be
22
+ more rigorous than any other domain: post-deployment bugs cannot be patched,
23
+ only mitigated. State machine invariants, access control rules, and gas bounds
24
+ must be written as formal properties before a single line of Solidity is written.
25
+ steps:
26
+ - id: define-abi-contracts
27
+ instruction: >
28
+ For every public and external function, define:
29
+ - Preconditions: all require() and revert() conditions with natural-language meaning
30
+ - Postconditions: what state changes are guaranteed on success
31
+ - Events emitted: name, indexed fields, non-indexed fields
32
+ - Reentrancy status: is this function safe to call while executing?
33
+ Store in docs/abi-contracts.md. One section per function.
34
+ contract: >
35
+ docs/abi-contracts.md exists with one section per public/external function.
36
+ Every function has preconditions, postconditions, and reentrancy status.
37
+ tools: ["filesystem", "natspec comments in Solidity"]
38
+ expected_output: "## transfer(address to, uint256 amount)\n**Pre:** caller balance ≥ amount\n**Post:** balances[caller] -= amount; balances[to] += amount"
39
+ pass_criterion: "File exists; every public function in the ABI has a corresponding section"
40
+
41
+ - id: define-invariants
42
+ instruction: >
43
+ Write the global invariants that must hold after every transaction:
44
+ - Conservation: totalSupply == sum(balances) (for token contracts)
45
+ - Access control: only owner can call admin functions
46
+ - State machine: cannot transition from COMPLETED to ACTIVE
47
+ - Economic: protocol fee ≤ 3% of any individual transaction
48
+ These become the property tests run after every state transition in Foundry.
49
+ contract: >
50
+ docs/invariants.md lists all global invariants with formal notation.
51
+ Each invariant has: name, condition, and a counterexample that would violate it.
52
+ tools: ["filesystem"]
53
+ expected_output: "| conservation | totalSupply == sum(all balances) | minting without incrementing supply |"
54
+ pass_criterion: "File exists with ≥1 invariant per contract with counterexample"
55
+
56
+ - id: define-gas-bounds
57
+ instruction: >
58
+ For each function, define maximum acceptable gas consumption:
59
+ - Simple reads: ≤ 30,000 gas
60
+ - Simple writes (single SSTORE): ≤ 50,000 gas
61
+ - Complex operations: document the formula and ceiling with justification
62
+ Store in docs/gas-contracts.md. Include adversarial scenarios:
63
+ e.g., "calling batchTransfer with 500 recipients must cost ≤ 5,000,000 gas."
64
+ contract: "docs/gas-contracts.md with numeric gas ceiling per function and adversarial scenario"
65
+ tools: ["filesystem"]
66
+ expected_output: "| batchTransfer(500) | 5,000,000 gas | adversarial max recipients |"
67
+ pass_criterion: "File exists; every user-callable function has a numeric gas ceiling"
68
+
69
+ - id: execution
70
+ title: "Foundry Test Suite + Gas Simulation"
71
+ rationale: >
72
+ Foundry runs Solidity tests at EVM speed. Property-based tests (invariant tests)
73
+ automatically generate counterexamples to global invariants. Forge gas reports
74
+ provide exact gas consumption per function. Hardhat fork simulation tests
75
+ behavior under mainnet state to detect integration assumptions.
76
+ steps:
77
+ - id: run-foundry-unit-tests
78
+ instruction: >
79
+ Write and run Foundry unit tests for every function. Each test covers:
80
+ - Happy path
81
+ - Each revert/require condition (expect the revert with the specific error)
82
+ - Edge cases (zero values, max uint256, zero address, self-transfer)
83
+ Run with `forge test -vvv`. All tests must pass with 0 failures.
84
+ contract: >
85
+ forge test exits 0. Every function has ≥3 test cases covering happy path,
86
+ revert conditions, and edge cases. Coverage ≥ 95% branch coverage.
87
+ tools: ["forge test -vvv", "forge coverage --report lcov"]
88
+ expected_output: "forge test: 0 failed, N passed. Coverage: branch 97%"
89
+ pass_criterion: "forge test exits 0; branch coverage ≥ 95%"
90
+
91
+ - id: run-invariant-property-tests
92
+ instruction: >
93
+ Write Foundry invariant tests for each invariant in docs/invariants.md.
94
+ Foundry will call random sequences of functions and assert the invariant
95
+ holds after each call. Configure minimum 10,000 runs per invariant.
96
+ Any counterexample found by Foundry is a critical bug.
97
+ contract: >
98
+ One Foundry invariant test function per invariant.
99
+ All invariants hold after 10,000 random call sequences.
100
+ Zero counterexamples found.
101
+ tools: ["forge test --mt invariant --runs 10000"]
102
+ expected_output: "No counterexamples found. Invariant tests: all PASS"
103
+ pass_criterion: "forge test exits 0 with no counterexample output"
104
+
105
+ - id: run-gas-simulation
106
+ instruction: >
107
+ Run `forge snapshot` to record gas usage per test. Compare against the
108
+ gas ceilings in docs/gas-contracts.md. For adversarial scenarios (max batch size,
109
+ unbounded loops), run explicit gas-measurement tests using `gasleft()` instrumentation.
110
+ Any function exceeding its gas ceiling is a FAIL — gas is a security invariant.
111
+ contract: >
112
+ Gas usage per function ≤ ceiling in docs/gas-contracts.md.
113
+ forge snapshot diff vs. main shows no O(N) growth in single-SLOAD functions.
114
+ tools: ["forge snapshot", "forge test --gas-report", "gasleft() instrumentation"]
115
+ expected_output: "gas-report.json: {function, actual_gas, ceiling, pass}"
116
+ pass_criterion: "All pass fields = true in gas-report.json"
117
+
118
+ - id: run-fork-simulation
119
+ instruction: >
120
+ Fork mainnet (or the target network) at a recent block using a public RPC.
121
+ Deploy the contract to the fork. Run integration scenarios that depend on
122
+ mainnet state (e.g., oracle prices, existing token balances, DEX liquidity).
123
+ Assert that stochastic outputs (gas variation under network congestion,
124
+ slippage under low liquidity) remain within the gas bounds defined.
125
+ contract: >
126
+ Forked tests pass on the mainnet fork.
127
+ Gas variation under congestion simulation ≤ 15% above baseline.
128
+ tools: ["forge test --fork-url $MAINNET_RPC", "anvil --fork-url"]
129
+ expected_output: "Fork test results: all PASS. Gas variance report under load."
130
+ pass_criterion: "forge test exits 0 on fork; gas variance ≤ 15%"
131
+
132
+ - id: evidence
133
+ title: "Persist Audit Trail and Gas Snapshots"
134
+ rationale: >
135
+ Smart contract audit evidence must be immutable and versioned. Gas snapshots
136
+ committed to git make regressions visible in pull request diffs.
137
+ steps:
138
+ - id: commit-gas-snapshot
139
+ instruction: >
140
+ Commit the Foundry gas snapshot (.gas-snapshot) to the repository.
141
+ In CI, run `forge snapshot --check` which exits non-zero if gas has
142
+ regressed from the committed snapshot. This makes gas regressions
143
+ visible in every pull request.
144
+ contract: ".gas-snapshot exists in repository root; CI runs forge snapshot --check"
145
+ tools: ["forge snapshot", "git add .gas-snapshot"]
146
+ expected_output: ".gas-snapshot file committed; CI job 'gas-regression-check' passes"
147
+ pass_criterion: ".gas-snapshot present; forge snapshot --check exits 0 in CI"
148
+
149
+ - id: persist-test-reports
150
+ instruction: >
151
+ Save to docs/audit/:
152
+ - forge-test-report.json (all test results)
153
+ - gas-report.json (function gas vs ceiling)
154
+ - invariant-results.json (which invariants tested, how many runs)
155
+ Include git commit SHA and Solidity compiler version in each file.
156
+ contract: "docs/audit/ exists with all 3 JSON files after every test run"
157
+ tools: ["forge test --json", "jq"]
158
+ expected_output: "docs/audit/forge-test-report.json with timestamp and commit SHA"
159
+ pass_criterion: "Files exist and parse; commit SHA present"
@@ -1,41 +1,41 @@
1
- tag: ZERO-TRUST
2
- section: instructions
3
- blocks:
4
- - id: deny-by-default-iam
5
- tier: recommended
6
- title: "Deny-by-Default IAM Policies"
7
- content: |
8
- ## Deny-by-Default IAM Policies
9
-
10
- - Start with zero permissions. Every identity (user, service, Lambda) begins with no access and receives only explicit allows.
11
- - Write IAM policies with explicit deny statements for sensitive operations. Explicit denies override any allows — use them as guardrails.
12
- - Scope every IAM policy to specific resources using ARNs. Never use wildcard (*) for resources in production policies.
13
- - Enforce condition keys on every policy: require specific VPCs, IP ranges, MFA, or time windows for access.
14
- - Implement IAM policy boundaries (permission boundaries) to cap the maximum permissions any role can receive, regardless of attached policies.
15
- - Automate IAM policy review: scan for overly permissive policies (Action: *, Resource: *) in CI and block deployment.
16
-
17
- - id: explicit-allow-rules
18
- tier: recommended
19
- title: "Explicit Allow Rules & Least Privilege"
20
- content: |
21
- ## Explicit Allow Rules & Least Privilege
22
-
23
- - Document every allow rule with a business justification: why this identity needs this action on this resource.
24
- - Group related permissions into managed policies named by function (e.g., `OrderServiceReadDynamo`, `PaymentServiceInvokeKMS`).
25
- - Use temporary credentials (STS AssumeRole) instead of long-lived access keys. Set maximum session duration to the minimum needed.
26
- - Implement just-in-time (JIT) access for elevated privileges: temporary role escalation with automatic expiry and audit logging.
27
- - Review and prune unused permissions quarterly using IAM Access Analyzer or equivalent. Remove any permission not used in 90 days.
28
- - Tag all IAM roles and policies with owner, team, service, and last-review-date for governance and accountability.
29
-
30
- - id: network-zero-trust
31
- tier: optional
32
- title: "Network-Level Zero Trust"
33
- content: |
34
- ## Network-Level Zero Trust
35
-
36
- - Do not rely on network location (VPC, subnet) as a trust boundary. Authenticate and authorize every request regardless of origin.
37
- - Encrypt all internal service-to-service communication with mutual TLS (mTLS). No plaintext traffic, even within a VPC.
38
- - Implement service mesh or API gateway for policy enforcement at the network layer: rate limiting, authentication, authorization.
39
- - Use private endpoints for AWS services (VPC endpoints) to keep traffic off the public internet.
40
- - Segment workloads into isolated security groups with minimal ingress/egress rules. Default deny all, then add specific allows.
41
- - Monitor and alert on unexpected network flows: new connections between services, unusual data transfer volumes, connections to unknown endpoints.
1
+ tag: ZERO-TRUST
2
+ section: instructions
3
+ blocks:
4
+ - id: deny-by-default-iam
5
+ tier: recommended
6
+ title: "Deny-by-Default IAM Policies"
7
+ content: |
8
+ ## Deny-by-Default IAM Policies
9
+
10
+ - Start with zero permissions. Every identity (user, service, Lambda) begins with no access and receives only explicit allows.
11
+ - Write IAM policies with explicit deny statements for sensitive operations. Explicit denies override any allows — use them as guardrails.
12
+ - Scope every IAM policy to specific resources using ARNs. Never use wildcard (*) for resources in production policies.
13
+ - Enforce condition keys on every policy: require specific VPCs, IP ranges, MFA, or time windows for access.
14
+ - Implement IAM policy boundaries (permission boundaries) to cap the maximum permissions any role can receive, regardless of attached policies.
15
+ - Automate IAM policy review: scan for overly permissive policies (Action: *, Resource: *) in CI and block deployment.
16
+
17
+ - id: explicit-allow-rules
18
+ tier: recommended
19
+ title: "Explicit Allow Rules & Least Privilege"
20
+ content: |
21
+ ## Explicit Allow Rules & Least Privilege
22
+
23
+ - Document every allow rule with a business justification: why this identity needs this action on this resource.
24
+ - Group related permissions into managed policies named by function (e.g., `OrderServiceReadDynamo`, `PaymentServiceInvokeKMS`).
25
+ - Use temporary credentials (STS AssumeRole) instead of long-lived access keys. Set maximum session duration to the minimum needed.
26
+ - Implement just-in-time (JIT) access for elevated privileges: temporary role escalation with automatic expiry and audit logging.
27
+ - Review and prune unused permissions quarterly using IAM Access Analyzer or equivalent. Remove any permission not used in 90 days.
28
+ - Tag all IAM roles and policies with owner, team, service, and last-review-date for governance and accountability.
29
+
30
+ - id: network-zero-trust
31
+ tier: optional
32
+ title: "Network-Level Zero Trust"
33
+ content: |
34
+ ## Network-Level Zero Trust
35
+
36
+ - Do not rely on network location (VPC, subnet) as a trust boundary. Authenticate and authorize every request regardless of origin.
37
+ - Encrypt all internal service-to-service communication with mutual TLS (mTLS). No plaintext traffic, even within a VPC.
38
+ - Implement service mesh or API gateway for policy enforcement at the network layer: rate limiting, authentication, authorization.
39
+ - Use private endpoints for AWS services (VPC endpoints) to keep traffic off the public internet.
40
+ - Segment workloads into isolated security groups with minimal ingress/egress rules. Default deny all, then add specific allows.
41
+ - Monitor and alert on unexpected network flows: new connections between services, unusual data transfer volumes, connections to unknown endpoints.
@@ -1,15 +1,15 @@
1
- tag: ZERO-TRUST
2
- section: mcp-servers
3
- servers:
4
- - name: aws-iam
5
- description: "AWS IAM policy analysis and management for zero-trust policy enforcement"
6
- command: npx
7
- args: ["-y", "mcp-server-aws"]
8
- tags: [ZERO-TRUST, INFRA]
9
- category: security
10
- tier: recommended
11
- env:
12
- AWS_REGION: ""
13
- AWS_ACCESS_KEY_ID: ""
14
- AWS_SECRET_ACCESS_KEY: ""
15
- url: "https://github.com/modelcontextprotocol/servers"
1
+ tag: ZERO-TRUST
2
+ section: mcp-servers
3
+ servers:
4
+ - name: aws-iam
5
+ description: "AWS IAM policy analysis and management for zero-trust policy enforcement"
6
+ command: npx
7
+ args: ["-y", "mcp-server-aws"]
8
+ tags: [ZERO-TRUST, INFRA]
9
+ category: security
10
+ tier: recommended
11
+ env:
12
+ AWS_REGION: ""
13
+ AWS_ACCESS_KEY_ID: ""
14
+ AWS_SECRET_ACCESS_KEY: ""
15
+ url: "https://github.com/modelcontextprotocol/servers"