@securityreviewai/securityreview-kit 0.1.48 → 0.1.49

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 (78) hide show
  1. package/dist/api.js +44 -0
  2. package/dist/commands/guardrails.js +13 -0
  3. package/dist/commands/init.js +88 -0
  4. package/dist/commands/profile.js +14 -0
  5. package/dist/commands/status.js +27 -0
  6. package/dist/commands/sync.js +6 -0
  7. package/dist/config.js +18 -0
  8. package/dist/fs.js +43 -0
  9. package/dist/index.js +44 -0
  10. package/dist/profile.js +113 -0
  11. package/dist/scaffold/claude-code.js +37 -0
  12. package/dist/scaffold/codex.js +35 -0
  13. package/dist/scaffold/cursor.js +39 -0
  14. package/dist/scaffold/gemini.js +10 -0
  15. package/dist/scaffold/index.js +22 -0
  16. package/dist/scaffold/mcp.js +15 -0
  17. package/dist/scaffold/rules.js +165 -0
  18. package/dist/scaffold/vibreview.js +24 -0
  19. package/dist/scaffold/vscode.js +22 -0
  20. package/dist/scaffold/windsurf.js +10 -0
  21. package/dist/sync/index.js +34 -0
  22. package/dist/sync/payload.js +23 -0
  23. package/dist/sync/state.js +12 -0
  24. package/dist/types.js +1 -0
  25. package/package.json +24 -30
  26. package/templates/claude/CLAUDE.md +13 -0
  27. package/templates/claude/agents/guardrail_profiler.md +12 -0
  28. package/templates/claude/agents/threat_modeler.md +5 -0
  29. package/templates/claude/skills/vibreview/SKILL.md +21 -0
  30. package/templates/claude/skills/vibreview/guardrail_patterns.md +12 -0
  31. package/templates/cursor/rules/vibreview-security.mdc +8 -0
  32. package/README.md +0 -105
  33. package/bin/securityreview-kit.js +0 -5
  34. package/src/cli.js +0 -109
  35. package/src/commands/init.js +0 -851
  36. package/src/commands/status.js +0 -99
  37. package/src/commands/switch-project.js +0 -207
  38. package/src/generators/mcp/claude.js +0 -85
  39. package/src/generators/mcp/claude.test.js +0 -64
  40. package/src/generators/mcp/codex.js +0 -70
  41. package/src/generators/mcp/codex.test.js +0 -43
  42. package/src/generators/mcp/cursor.js +0 -29
  43. package/src/generators/mcp/cursor.test.js +0 -50
  44. package/src/generators/mcp/gemini.js +0 -28
  45. package/src/generators/mcp/vscode.js +0 -29
  46. package/src/generators/mcp/windsurf.js +0 -27
  47. package/src/generators/rules/antigravity.js +0 -22
  48. package/src/generators/rules/claude.js +0 -87
  49. package/src/generators/rules/claude.test.js +0 -60
  50. package/src/generators/rules/codex.js +0 -141
  51. package/src/generators/rules/codex.test.js +0 -59
  52. package/src/generators/rules/content.js +0 -110
  53. package/src/generators/rules/content.md +0 -57
  54. package/src/generators/rules/cursor.js +0 -128
  55. package/src/generators/rules/gemini.js +0 -13
  56. package/src/generators/rules/guardrails-init-profile.md +0 -56
  57. package/src/generators/rules/guardrails-profiler/SKILL.md +0 -130
  58. package/src/generators/rules/guardrails-profiler/references/signal-registry.json +0 -514
  59. package/src/generators/rules/guardrails-selection/SKILL.md +0 -187
  60. package/src/generators/rules/guardrails-selection/references/category-threat-map.md +0 -232
  61. package/src/generators/rules/guardrails_rule.md +0 -94
  62. package/src/generators/rules/hooks.json +0 -11
  63. package/src/generators/rules/skill.md +0 -256
  64. package/src/generators/rules/srai-profile.md +0 -32
  65. package/src/generators/rules/vibereview-sync/SKILL.md +0 -378
  66. package/src/generators/rules/vscode.js +0 -101
  67. package/src/generators/rules/vscode.test.js +0 -54
  68. package/src/generators/rules/windsurf.js +0 -13
  69. package/src/utils/constants.js +0 -95
  70. package/src/utils/cursor-agent-path.js +0 -67
  71. package/src/utils/cursor-cli-permissions.js +0 -28
  72. package/src/utils/detect.js +0 -27
  73. package/src/utils/fs-helpers.js +0 -82
  74. package/src/utils/guardrails-profiler-bundle.js +0 -84
  75. package/src/utils/ide-cli-install.js +0 -138
  76. package/src/utils/profiler-agent.js +0 -446
  77. package/src/utils/profiler-agent.test.js +0 -81
  78. package/src/utils/srai.js +0 -252
@@ -1,187 +0,0 @@
1
- ---
2
- name: guardrails-selection
3
- description: Analyze the developer request, infer the security categories and likely threats involved, shortlist the most relevant project guardrails, then hydrate the exact guardrails with get_guardrail_by_id before implementation. Use for every security-relevant code task before code is written and preserve the shortlist for the final VibeReview sync.
4
- ---
5
-
6
- # Guardrails Selection
7
-
8
- Configured SRAI project name: `<SRAI_PROJECT_NAME>`
9
-
10
- Use this skill whenever code will be created or modified and the task has any security surface.
11
-
12
- This skill exists to stop the IDE from treating the full `get_guardrails` result as an unstructured blob. The workflow is:
13
-
14
- 1. Understand the request deeply.
15
- 2. Infer which security categories are in play.
16
- 3. Predict the threats that might occur for this exact task.
17
- 4. Shortlist only the guardrails that mitigate those threats.
18
- 5. Fetch the exact shortlisted guardrails with `get_guardrail_by_id`.
19
- 6. Carry that same shortlist forward into implementation and the final VibeReview markdown sync.
20
-
21
- Do not skip the analysis step. Do not rely on title-matching alone. Do not dump every guardrail into the final answer.
22
-
23
- ## Inputs You Must Analyze First
24
-
25
- Before calling `get_guardrails`, extract the actual development intent from the prompt and surrounding code:
26
-
27
- - What is being built, changed, fixed, or refactored?
28
- - Which components are affected: API, UI, background jobs, auth flow, webhook, file upload, admin tooling, AI agent flow, infra code, data pipeline?
29
- - Which trust boundaries are crossed?
30
- - Which sensitive assets are touched: tokens, credentials, sessions, PII, tenancy boundaries, audit logs, secrets, internal APIs, signed URLs, payment state, workflow approvals?
31
- - Which technologies and patterns are involved in the existing code?
32
- - What abuse cases are plausible if this change is implemented poorly?
33
-
34
- You are not only selecting guardrails for the obvious functionality. You are selecting guardrails for the threats that might materialize around that functionality.
35
-
36
- ## Category Inference Workflow
37
-
38
- Derive a category set for the task before shortlisting guardrails. Common categories include:
39
-
40
- - `authentication`
41
- - `authorization`
42
- - `session_management`
43
- - `input_validation`
44
- - `output_encoding`
45
- - `secrets`
46
- - `cryptography`
47
- - `logging`
48
- - `monitoring`
49
- - `file_uploads`
50
- - `deserialization`
51
- - `data_access`
52
- - `rate_limiting`
53
- - `network`
54
- - `client_side`
55
- - `business_logic`
56
- - `tenant_isolation`
57
- - `admin_workflows`
58
-
59
- Use both the user request and the codebase patterns to infer the category set. A task can involve multiple categories even if the prompt mentions only one feature.
60
-
61
- Examples:
62
-
63
- - “Add magic-link login” likely involves `authentication`, `session_management`, `cryptography`, `logging`, `rate_limiting`, and `client_side`.
64
- - “Add org admin API to update member roles” likely involves `authorization`, `tenant_isolation`, `logging`, `business_logic`, and `data_access`.
65
- - “Add CSV import” likely involves `input_validation`, `file_uploads`, `data_access`, `deserialization`, `logging`, and denial-of-service protections.
66
- - “Add client-side token refresh” likely involves `authentication`, `session_management`, `client_side`, `logging`, and `cryptography`.
67
-
68
- ## Threat Mapping Requirement
69
-
70
- After identifying categories, infer the threat families that might occur. Use the reference file at `{{GUARDRAILS_SELECTION_SKILL_DIR}}/references/category-threat-map.md` every time you need to reason about category-to-threat mapping.
71
-
72
- Your goal is not to enumerate every possible weakness. Your goal is to pick the threats that should influence guardrail selection for this task.
73
-
74
- At minimum, consider whether the task can create:
75
-
76
- - authentication bypass
77
- - authorization bypass
78
- - privilege escalation
79
- - information disclosure
80
- - repudiation gaps
81
- - denial of service
82
- - unsafe client-side trust
83
- - insecure logging or audit gaps
84
- - injection-triggered security failures
85
- - serialization-triggered security failures
86
- - business-logic-triggered bypasses
87
-
88
- The shortlist should be threat-led, not catalog-led.
89
-
90
- ## Guardrail Selection Procedure
91
-
92
- ### Step 1: Resolve the project and load the catalog
93
-
94
- 1. Call `find_project_by_name` with `name="<SRAI_PROJECT_NAME>"` to obtain `project_id`.
95
- 2. Call `get_guardrails` with `project_id`.
96
-
97
- Treat `get_guardrails` as the broad catalog. Do not treat it as the final set of instructions.
98
-
99
- Assume each returned guardrail includes the fields needed for selection, including a stable identifier for follow-up retrieval, plus:
100
-
101
- - `title`
102
- - `rule_type`
103
- - `category`
104
- - `instruction`
105
-
106
- If an identifier is absent, fall back to the best available stable reference exposed by the tool, but prefer the real guardrail id whenever available.
107
-
108
- ### Step 2: Build a shortlist
109
-
110
- Shortlist guardrails using all of the following:
111
-
112
- - direct category match with the task
113
- - mitigation value against the likely threats you inferred
114
- - relevance to the technologies and code paths being touched
115
- - support for adjacent controls that prevent bypass chains
116
- - duplication removal
117
-
118
- Do not select a guardrail only because it sounds generally useful. Select it because it materially constrains the risky part of the current task.
119
-
120
- Examples:
121
-
122
- - If the task touches login, token issuance, password reset, session refresh, or identity proofing, prioritize authentication, session, crypto, logging, and brute-force defense guardrails.
123
- - If the task changes role checks, tenant scoping, admin APIs, resource ownership, or query filters, prioritize authorization, tenant isolation, data access, business-logic, and audit guardrails.
124
- - If the task introduces parsing, uploads, template expansion, or object hydration, prioritize input validation, file handling, deserialization, and denial-of-service guardrails.
125
- - If the task moves security decisions into the browser or mobile client, prioritize client-side trust, token storage, server-side revalidation, and privilege-boundary guardrails.
126
-
127
- ### Step 3: Hydrate exact shortlisted guardrails
128
-
129
- For every shortlisted existing guardrail, call `get_guardrail_by_id` to retrieve the exact guardrail that will govern implementation.
130
-
131
- - Use `get_guardrail_by_id` for the shortlisted ids only.
132
- - If the tool supports batching, batch the shortlisted ids.
133
- - If the tool only supports one id at a time, call it once per shortlisted id.
134
-
135
- Implementation must be driven by the hydrated shortlist from `get_guardrail_by_id`, not by vague memory from the broad catalog listing.
136
-
137
- ### Step 4: Track the active shortlist in context
138
-
139
- Maintain an explicit in-context list of the shortlisted existing guardrails that will govern the task. For each shortlisted existing guardrail, keep:
140
-
141
- - `id`
142
- - `title`
143
- - `rule_type`
144
- - `category`
145
- - `instruction`
146
- - `why_selected`
147
-
148
- Also track any new guardrails created during the task as `ide_generated`.
149
-
150
- This shortlist is the source of truth for the rest of the session.
151
-
152
- ## Implementation Rules
153
-
154
- Once the shortlist is hydrated:
155
-
156
- - Every applicable `must` guardrail is mandatory.
157
- - Every applicable `must_not` guardrail is a hard prohibition.
158
- - If two shortlisted guardrails appear to conflict, explain the conflict and resolve it before coding.
159
- - If the task reveals a real gap not covered by the shortlisted existing guardrails, create an `ide_generated` guardrail and apply it immediately.
160
-
161
- When deciding whether a guardrail applies, prefer security-preserving inclusion over risky omission. If it plausibly mitigates a realistic path to abuse for the current task, keep it in scope.
162
-
163
- ## VibeReview Sync Contract
164
-
165
- The final sync step must reuse the shortlist from this skill. It must not call `get_guardrails` or `get_guardrail_by_id` again.
166
-
167
- Before `sync_ai_ide_markdown` is called, ensure the main agent context clearly contains:
168
-
169
- - the exact existing guardrails shortlisted earlier
170
- - which of them were applied
171
- - whether each one was satisfied
172
- - any notes about partial compliance, conflicts, or rationale
173
- - every `ide_generated` guardrail created during the task
174
-
175
- If a guardrail was shortlisted but not fully satisfied, still include it in the handoff with `satisfied: false` and a note. Do not silently drop it.
176
-
177
- ## Selection Quality Bar
178
-
179
- A good selection does all of the following:
180
-
181
- - covers the feature’s real threat surface, not just its visible functionality
182
- - captures adjacent controls that stop bypass chains
183
- - avoids irrelevant noise
184
- - produces a small, defensible set of guardrails that can actually guide implementation
185
- - leaves the final VibeReview markdown with an exact list of what the IDE selected and enforced
186
-
187
- If your shortlist feels generic, it is probably incomplete or over-broad. Re-check the prompt, the code patterns, and the threat map.
@@ -1,232 +0,0 @@
1
- # Guardrail Selection Threat Map
2
-
3
- Use this file when deciding which guardrail categories apply to the current task and which threat families should influence the shortlist.
4
-
5
- The intent is not to produce a full threat model here. The intent is to make sure likely exploit paths influence which guardrails are fetched by id and enforced during implementation.
6
-
7
- ## How to use this map
8
-
9
- 1. Start from the feature or code change.
10
- 2. Infer the categories involved in the implementation.
11
- 3. Use the mappings below to identify likely threat families.
12
- 4. Shortlist guardrails that directly or adjacently mitigate those threats.
13
- 5. Fetch those guardrails with `get_guardrail_by_id`.
14
-
15
- ## STRIDE-style mappings for guardrail selection
16
-
17
- ### Spoofing
18
-
19
- Usually maps to authentication and session-related controls.
20
-
21
- Threat patterns to consider:
22
-
23
- - identity-related attacks
24
- - session and token attacks
25
- - business-logic attacks leading to authentication bypass
26
- - injection attacks leading to authentication bypass
27
- - serialization attacks leading to authentication bypass
28
- - cryptographic attacks leading to authentication bypass
29
- - lapses in logging leading to authentication bypass
30
- - client-side trust leading to authentication bypass
31
-
32
- Categories commonly shortlisted:
33
-
34
- - `authentication`
35
- - `session_management`
36
- - `cryptography`
37
- - `logging`
38
- - `client_side`
39
- - `business_logic`
40
- - `input_validation`
41
- - `deserialization`
42
-
43
- ### Tampering
44
-
45
- Usually maps to authorization, integrity, and unsafe state change controls.
46
-
47
- Threat patterns to consider:
48
-
49
- - broken object level access control patterns
50
- - broken functional level access control patterns
51
- - injection-driven authorization bypass
52
- - serialization-driven authorization bypass
53
- - business-logic-driven authorization bypass
54
- - client-side trust leading to unauthorized state changes
55
-
56
- Categories commonly shortlisted:
57
-
58
- - `authorization`
59
- - `tenant_isolation`
60
- - `data_access`
61
- - `business_logic`
62
- - `logging`
63
- - `input_validation`
64
- - `deserialization`
65
- - `client_side`
66
-
67
- ### Repudiation
68
-
69
- Usually appears when spoofing and tampering are possible but the system cannot prove what happened.
70
-
71
- Threat patterns to consider:
72
-
73
- - weak or missing audit trails for auth and authorization decisions
74
- - missing actor attribution on sensitive state changes
75
- - mutable or incomplete event records
76
- - inability to correlate session, actor, and resource changes
77
-
78
- Categories commonly shortlisted:
79
-
80
- - `logging`
81
- - `monitoring`
82
- - `authentication`
83
- - `authorization`
84
- - `admin_workflows`
85
-
86
- ### Information Disclosure
87
-
88
- Usually maps to authorization, data exposure, logging, and unsafe client-side trust.
89
-
90
- Threat patterns to consider:
91
-
92
- - broken object level access control patterns
93
- - broken functional level access control patterns
94
- - injection-driven information disclosure
95
- - serialization-driven information disclosure
96
- - business-logic-driven information disclosure
97
- - lapses in logging leading to disclosure
98
- - client-side trust causing exposure of protected data
99
-
100
- Categories commonly shortlisted:
101
-
102
- - `authorization`
103
- - `tenant_isolation`
104
- - `data_access`
105
- - `logging`
106
- - `input_validation`
107
- - `deserialization`
108
- - `client_side`
109
- - `output_encoding`
110
-
111
- ### Denial of Service
112
-
113
- Usually maps to workload protection, parsing safety, quota controls, and expensive query behavior.
114
-
115
- Threat patterns to consider:
116
-
117
- - broken access control patterns that expose heavy operations
118
- - injection or data-access paths that amplify resource consumption
119
- - serialization-driven memory or parser exhaustion
120
- - business-logic-driven abuse of expensive workflows
121
- - logging lapses that hide repeated abuse
122
-
123
- Categories commonly shortlisted:
124
-
125
- - `rate_limiting`
126
- - `input_validation`
127
- - `file_uploads`
128
- - `deserialization`
129
- - `data_access`
130
- - `network`
131
- - `monitoring`
132
- - `logging`
133
- - `business_logic`
134
-
135
- ### Elevation of Privilege
136
-
137
- Usually maps to authorization, role boundaries, trust decisions, and privileged workflow controls.
138
-
139
- Threat patterns to consider:
140
-
141
- - access control bypasses from broken object or function level access
142
- - injection-based privilege escalation
143
- - client-side induced privilege escalation
144
- - serialization-induced privilege escalation
145
- - business-logic-triggered privilege escalation
146
- - logging lapses that conceal privilege abuse
147
-
148
- Categories commonly shortlisted:
149
-
150
- - `authorization`
151
- - `tenant_isolation`
152
- - `admin_workflows`
153
- - `business_logic`
154
- - `client_side`
155
- - `input_validation`
156
- - `deserialization`
157
- - `logging`
158
-
159
- ## Fast examples
160
-
161
- ### Add password reset flow
162
-
163
- Likely categories:
164
-
165
- - `authentication`
166
- - `session_management`
167
- - `cryptography`
168
- - `logging`
169
- - `rate_limiting`
170
-
171
- Likely threat families:
172
-
173
- - spoofing
174
- - repudiation
175
- - information disclosure
176
-
177
- ### Add admin endpoint to change user role
178
-
179
- Likely categories:
180
-
181
- - `authorization`
182
- - `tenant_isolation`
183
- - `admin_workflows`
184
- - `logging`
185
- - `business_logic`
186
-
187
- Likely threat families:
188
-
189
- - tampering
190
- - repudiation
191
- - elevation of privilege
192
- - information disclosure
193
-
194
- ### Add bulk import endpoint
195
-
196
- Likely categories:
197
-
198
- - `input_validation`
199
- - `file_uploads`
200
- - `deserialization`
201
- - `data_access`
202
- - `logging`
203
- - `rate_limiting`
204
-
205
- Likely threat families:
206
-
207
- - tampering
208
- - information disclosure
209
- - denial of service
210
-
211
- ### Move entitlement checks to the frontend
212
-
213
- Likely categories:
214
-
215
- - `authorization`
216
- - `client_side`
217
- - `tenant_isolation`
218
- - `logging`
219
-
220
- Likely threat families:
221
-
222
- - tampering
223
- - information disclosure
224
- - elevation of privilege
225
-
226
- ## Selection reminders
227
-
228
- - A feature can require guardrails from multiple categories.
229
- - Shortlist for exploit chains, not isolated weaknesses.
230
- - Logging often matters because poor auditability can turn spoofing, tampering, or privilege abuse into repudiation.
231
- - Client-side logic often needs server-side guardrails even if the visible change is in the UI.
232
- - If no existing guardrail covers a realistic recurring threat, create an `ide_generated` guardrail and carry it into the final VibeReview markdown sync.
@@ -1,94 +0,0 @@
1
- # Vibe Guardrails — Secure by Code
2
-
3
- **Enforce project-specific security guardrails during every code-generation task.**
4
-
5
- This rule complements the PWNISMS threat model ("secure by design") with concrete, project-level coding dos and don'ts ("secure by code"). Guardrails are maintained in SRAI and fetched via `security-review-mcp`.
6
-
7
- ---
8
-
9
- ## When this rule applies
10
-
11
- This rule is **active for every code-generation or code-modification task** — including:
12
-
13
- - Implementing new features or endpoints
14
- - Fixing bugs that touch security-relevant code
15
- - Refactoring code that handles auth, input, secrets, data storage, or network
16
- - Generating boilerplate, scaffolding, or templates that will run in production
17
-
18
- ### When to skip
19
-
20
- Skip guardrail enforcement for tasks with **no code output** (documentation, Q&A, formatting, renaming).
21
-
22
- ---
23
-
24
- ## Required behavior
25
-
26
- ### 1. Use the guardrails-selection skill at the start of every code task
27
-
28
- Before writing or modifying code, you must read and follow `{{GUARDRAILS_SELECTION_SKILL_DIR}}/SKILL.md`.
29
-
30
- That skill is mandatory because the IDE must not leave guardrail selection to chance. The required workflow is:
31
-
32
- - **Analyze the task first** — infer what the user is actually building, what components are touched, what categories are involved, and what threats might occur.
33
- - **Resolve the project** — use `find_project_by_name` with `name="<SRAI_PROJECT_NAME>"` to obtain `project_id`.
34
- - **Load the broad catalog** — call `get_guardrails` with `project_id`.
35
- - **Shortlist intentionally** — choose only the guardrails that mitigate the categories and likely threats for the current task.
36
- - **Hydrate the exact shortlist** — call `get_guardrail_by_id` for the shortlisted guardrail ids so implementation uses the exact selected guardrails, not a vague reading of the full catalog.
37
- - **Preserve the shortlist** — keep the selected existing guardrails in context so the final VibeReview markdown can include the same guardrails later without re-querying.
38
-
39
- The broad `get_guardrails` result is only the candidate catalog. The active implementation guardrails must come from the shortlisted `get_guardrail_by_id` result.
40
-
41
- Each guardrail used for implementation should preserve these fields:
42
-
43
- | Field | Description |
44
- |---|---|
45
- | `id` | Stable guardrail identifier used with `get_guardrail_by_id` |
46
- | `title` | Short name of the guardrail |
47
- | `rule_type` | `must` (mandatory) or `must_not` (prohibition) |
48
- | `category` | Grouping label (e.g. `authentication`, `input_validation`, `secrets`) or `null` |
49
- | `instruction` | The actionable coding directive |
50
-
51
- If `get_guardrails` returns additional metadata such as `source_ref`, use it as supporting context during selection.
52
-
53
- ### 2. Apply guardrails during code generation
54
-
55
- - **`must` rules (DOs):** Treat as mandatory implementation requirements. Every line of generated code must satisfy all applicable `must` guardrails.
56
- - **`must_not` rules (DON'Ts):** Treat as hard prohibitions. Generated code must never violate a `must_not` guardrail.
57
- - If a guardrail conflicts with the user's explicit instruction, **flag the conflict** to the user and ask for confirmation before proceeding.
58
- - If no guardrails are returned (empty list), proceed normally using baseline PWNISMS controls.
59
-
60
- ### 3. Cross-reference with PWNISMS
61
-
62
- Guardrails and PWNISMS are complementary:
63
-
64
- - Guardrails provide **project-specific, concrete rules** derived from prior threat reviews, compliance requirements, and team decisions.
65
- - PWNISMS provides **universal threat-category coverage** to catch gaps that guardrails may not yet cover.
66
- - When PWNISMS analysis reveals a gap not covered by any existing guardrail, **create a new guardrail on the fly** and apply it immediately (marked `source: "ide_generated"` in the VibeReview markdown).
67
-
68
- ### 4. Report guardrail compliance
69
-
70
- After code generation, include a brief guardrails compliance summary:
71
-
72
- - List which guardrails were applied (by title), distinguishing existing vs IDE-generated.
73
- - Flag any guardrails that could not be fully satisfied and explain why.
74
- - Do not drop shortlisted existing guardrails from session context. The final VibeReview markdown must include the same shortlist, including any unsatisfied items with notes.
75
-
76
- ---
77
-
78
- ## Guardrail lifecycle — updates and new guardrails
79
-
80
- Guardrails are living artifacts. The IDE agent can create, apply, and update them:
81
-
82
- - **New guardrail**: When threat modeling or code review reveals a recurring security pattern not yet captured, the IDE agent creates and applies a new guardrail on the fly. These are reported to SRAI in the final VibeReview markdown with `source: "ide_generated"`.
83
- - **Edit suggestion**: When an existing guardrail is too broad, too narrow, or outdated, suggest an update to the user.
84
- - All guardrails — existing and IDE-generated — must be preserved in the VibeReview markdown under a single `Guardrails Applied` section that the server can normalize into `guardrails_applied`.
85
-
86
- ---
87
-
88
- ## Tool Reference
89
-
90
- | Tool | Purpose |
91
- |---|---|
92
- | `get_guardrails` | Fetch the broad project guardrails catalog (requires `project_id`) |
93
- | `get_guardrail_by_id` | Fetch the exact shortlisted guardrails that will govern implementation |
94
- | `find_project_by_name` | Resolve project by name to get `project_id` |
@@ -1,11 +0,0 @@
1
- {
2
- "version": 1,
3
- "hooks": {
4
- "sessionStart": [
5
- {
6
- "command": "printf '%s\\n' '{\"additional_context\":\"## MANDATORY SECURITY GATE (Session Policy)\\n\\nFor ANY user request that has security impact (auth, crypto, input handling, secrets, network, data storage, dependencies, new APIs/endpoints, or any code handling untrusted data):\\n\\n**Plan order:**\\n1. **Fetch Vibe Guardrails (first)** - Use .cursor/skills/guardrails-selection/SKILL.md. Analyze the task, call get_guardrails from security-review-mcp to load the broad catalog, shortlist the relevant guardrails, then call get_guardrail_by_id for the shortlist. These exact shortlisted guardrails are the hard constraints on generated code.\\n2. **PWNISMS threat modeling (second)** - Run threat modeling as a guide before writing code. Use .cursor/skills/threat-modelling/SKILL.md. Cross-reference guardrails with PWNISMS findings to identify gaps. Document findings to inform secure implementation.\\n3. **Implement secure code (third)** - Use the threat model findings AND shortlisted guardrails as guides to create secure code. Every must guardrail must be satisfied; no must_not guardrail may be violated.\\n4. **VibeReview sync (last)** - Read .cursor/skills/vibereview-sync/SKILL.md. The main agent must write a structured `.md` artifact under `vibereview/`, must not read sibling markdown files there just to infer format, must validate that all required metadata and sections are present, and must call `sync_ai_ide_markdown` directly after implementation is done. Include the exact shortlisted guardrails from earlier plus any IDE-generated guardrails in the markdown; do not query guardrails again during sync.\\n\\nNo blocking. No deferral. Guardrails enforce secure code; threat modeling guides the design; the main agent owns the final markdown sync to SRAI. Both sync and guardrail compliance are mandatory and should be part of your to-do.\"}'",
7
- "timeout": 5
8
- }
9
- ]
10
- }
11
- }