@securityreviewai/securityreview-kit 0.1.50 → 0.1.51
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.
package/dist/scaffold/rules.js
CHANGED
|
@@ -108,15 +108,15 @@ function additionalContext(config) {
|
|
|
108
108
|
"",
|
|
109
109
|
`Configured project: ${project.name} (${project.slug}, ${project.id})`,
|
|
110
110
|
"",
|
|
111
|
-
"For any request with security impact,
|
|
111
|
+
"For any request with security impact, this is a hard pre-write gate. Do not create, edit, or patch code until steps 1-3 are complete:",
|
|
112
112
|
"",
|
|
113
113
|
`1. Resolve the tenant/project with ${TOOL_PROJECT} using project_id="${project.id}" or project_slug="${project.slug}".`,
|
|
114
114
|
`2. Fetch VibeReview guardrails with ${TOOL_GUARDRAILS}, shortlist relevant guardrails, and preserve that shortlist.`,
|
|
115
115
|
"3. Run PWNISMS threat modelling before implementation.",
|
|
116
116
|
"4. Implement secure code using the threat model and shortlisted guardrails.",
|
|
117
|
-
`5. Write one markdown artifact under .vibreview/scans/ and call ${TOOL_SYNC} immediately after writing it.`,
|
|
117
|
+
`5. Write one markdown artifact under .vibreview/scans/ and call ${TOOL_SYNC} with the raw markdown string immediately after writing it.`,
|
|
118
118
|
"",
|
|
119
|
-
"No deferral. No local profiling. The main agent owns the final markdown sync.",
|
|
119
|
+
"No deferral. No code before guardrails. No JSON summaries for sync. No local profiling. The main agent owns the final markdown sync.",
|
|
120
120
|
].join("\\n");
|
|
121
121
|
}
|
|
122
122
|
function codexPayload(config, hookEventName) {
|
package/package.json
CHANGED
|
@@ -6,12 +6,14 @@ These instructions are always active for security-relevant coding work. Keep thi
|
|
|
6
6
|
|
|
7
7
|
## Core Workflow
|
|
8
8
|
|
|
9
|
-
For any task that touches auth, authorization, input handling, secrets, network, data storage, dependencies, new APIs/endpoints, infrastructure, or code handling untrusted data
|
|
9
|
+
For any task that touches auth, authorization, input handling, secrets, network, data storage, dependencies, new APIs/endpoints, infrastructure, or code handling untrusted data, this workflow is a hard pre-write gate.
|
|
10
|
+
|
|
11
|
+
Do not write, edit, patch, or generate implementation code until guardrails have been fetched and shortlisted and PWNISMS threat modelling has been completed. If the user asks for code immediately, still run the pre-write gate first.
|
|
10
12
|
|
|
11
13
|
1. **Fetch Vibe Guardrails first.**
|
|
12
14
|
- Read and follow `{{GUARDRAILS_SELECTION_SKILL_DIR}}/SKILL.md`.
|
|
13
15
|
- Resolve the SRAI project with `find_project_by_name` using `name="<SRAI_PROJECT_NAME>"`.
|
|
14
|
-
- Call `get_guardrails`, shortlist only the relevant project guardrails, then
|
|
16
|
+
- Call `get_guardrails`, shortlist only the relevant project guardrails, then preserve the exact returned guardrail entries.
|
|
15
17
|
- Preserve that exact shortlist in context for implementation and the final VibeReview sync step.
|
|
16
18
|
|
|
17
19
|
2. **Run PWNISMS threat modelling before implementation.**
|
|
@@ -21,6 +23,7 @@ For any task that touches auth, authorization, input handling, secrets, network,
|
|
|
21
23
|
- Cross-reference each meaningful threat with the shortlisted guardrails.
|
|
22
24
|
|
|
23
25
|
3. **Implement secure code using both inputs.**
|
|
26
|
+
- This step may start only after steps 1 and 2 are complete.
|
|
24
27
|
- Treat applicable `must` guardrails as mandatory.
|
|
25
28
|
- Treat applicable `must_not` guardrails as hard prohibitions.
|
|
26
29
|
- Use the PWNISMS findings to guide design, validation, authorization, logging, secrets handling, dependency choices, and abuse controls.
|
|
@@ -28,12 +31,12 @@ For any task that touches auth, authorization, input handling, secrets, network,
|
|
|
28
31
|
|
|
29
32
|
4. **Write and sync the VibeReview markdown last.**
|
|
30
33
|
- Read and follow `{{VIBEREVIEW_SYNC_SKILL_DIR}}/SKILL.md`.
|
|
31
|
-
- After threat modelling is created or updated, or after guardrails are enforced during implementation, the main agent must write or update a structured `.md` artifact under
|
|
34
|
+
- After threat modelling is created or updated, or after guardrails are enforced during implementation, the main agent must write or update a structured `.md` artifact under `.vibreview/scans/`.
|
|
32
35
|
- Do not delegate markdown authoring to a subagent. The same agent that performed the work should author the artifact so the context stays intact.
|
|
33
36
|
- Use the skill's structure and validation checklist rather than improvising the markdown format.
|
|
34
37
|
- Reuse the exact existing guardrails shortlisted earlier, include any `ide_generated` guardrails, and only include grounded code snippets from actual code.
|
|
35
|
-
- Call `sync_ai_ide_markdown` directly with the finished markdown
|
|
36
|
-
- If sync fails, keep the file in
|
|
38
|
+
- Call `sync_ai_ide_markdown` directly with the finished raw markdown content before finalizing the task. Do not sync JSON summaries, JSON objects, or extracted event JSON.
|
|
39
|
+
- If sync fails, keep the file in `.vibreview/scans/`, report the failure, and do not pretend synchronization succeeded.
|
|
37
40
|
|
|
38
41
|
## When To Skip
|
|
39
42
|
|
|
@@ -52,6 +55,6 @@ The normal coding workflow is guardrails selection, PWNISMS threat modelling, se
|
|
|
52
55
|
| Purpose | Tools |
|
|
53
56
|
|---|---|
|
|
54
57
|
| Project resolution | `find_project_by_name`, `list_projects`, `create_project`, `get_project` |
|
|
55
|
-
| Guardrails | `get_guardrails
|
|
58
|
+
| Guardrails | `get_guardrails` |
|
|
56
59
|
| VibeReview sync | `sync_ai_ide_markdown` |
|
|
57
60
|
| Profiler only | `update_vibe_profile`, `write_default_pack` are used by init-time profiling, not normal coding tasks |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
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
|
|
3
|
+
description: Analyze the developer request, infer the security categories and likely threats involved, shortlist the most relevant project guardrails, then preserve the exact returned guardrail records before implementation. Use for every security-relevant code task before code is written and preserve the shortlist for the final VibeReview sync.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Guardrails Selection
|
|
@@ -9,13 +9,15 @@ Configured SRAI project name: `<SRAI_PROJECT_NAME>`
|
|
|
9
9
|
|
|
10
10
|
Use this skill whenever code will be created or modified and the task has any security surface.
|
|
11
11
|
|
|
12
|
+
This skill is a hard pre-write gate. Do not write, edit, patch, or generate implementation code until this skill has produced the active guardrail shortlist and the PWNISMS skill has used that shortlist for threat modelling.
|
|
13
|
+
|
|
12
14
|
This skill exists to stop the IDE from treating the full `get_guardrails` result as an unstructured blob. The workflow is:
|
|
13
15
|
|
|
14
16
|
1. Understand the request deeply.
|
|
15
17
|
2. Infer which security categories are in play.
|
|
16
18
|
3. Predict the threats that might occur for this exact task.
|
|
17
19
|
4. Shortlist only the guardrails that mitigate those threats.
|
|
18
|
-
5.
|
|
20
|
+
5. Preserve the exact shortlisted guardrails returned by the project guardrail bundle.
|
|
19
21
|
6. Carry that same shortlist forward into implementation and the final VibeReview markdown sync.
|
|
20
22
|
|
|
21
23
|
Do not skip the analysis step. Do not rely on title-matching alone. Do not dump every guardrail into the final answer.
|
|
@@ -94,7 +96,7 @@ The shortlist should be threat-led, not catalog-led.
|
|
|
94
96
|
1. Call `find_project_by_name` with `name="<SRAI_PROJECT_NAME>"` to obtain `project_id`.
|
|
95
97
|
2. Call `get_guardrails` with `project_id`.
|
|
96
98
|
|
|
97
|
-
Treat `get_guardrails` as the broad catalog. Do not treat
|
|
99
|
+
Treat `get_guardrails` as the broad project catalog. Do not treat the whole catalog as the final set of instructions. The returned entries are already the authoritative guardrail records for this project; shortlist from those exact records and preserve their ids, titles, rule types, categories, and instructions.
|
|
98
100
|
|
|
99
101
|
Assume each returned guardrail includes the fields needed for selection, including a stable identifier for follow-up retrieval, plus:
|
|
100
102
|
|
|
@@ -124,15 +126,11 @@ Examples:
|
|
|
124
126
|
- If the task introduces parsing, uploads, template expansion, or object hydration, prioritize input validation, file handling, deserialization, and denial-of-service guardrails.
|
|
125
127
|
- 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
128
|
|
|
127
|
-
### Step 3:
|
|
128
|
-
|
|
129
|
-
For every shortlisted existing guardrail, call `get_guardrail_by_id` to retrieve the exact guardrail that will govern implementation.
|
|
129
|
+
### Step 3: Preserve exact shortlisted guardrails
|
|
130
130
|
|
|
131
|
-
|
|
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.
|
|
131
|
+
For every shortlisted existing guardrail, preserve the exact guardrail record returned by `get_guardrails`.
|
|
134
132
|
|
|
135
|
-
Implementation must be driven by
|
|
133
|
+
Implementation must be driven by that exact shortlist, not by vague memory from the broad catalog listing. Do not re-query guardrails after implementation starts unless the shortlist is missing or the task scope materially changes.
|
|
136
134
|
|
|
137
135
|
### Step 4: Track the active shortlist in context
|
|
138
136
|
|
|
@@ -151,7 +149,7 @@ This shortlist is the source of truth for the rest of the session.
|
|
|
151
149
|
|
|
152
150
|
## Implementation Rules
|
|
153
151
|
|
|
154
|
-
Once the shortlist is
|
|
152
|
+
Once the exact shortlist is preserved:
|
|
155
153
|
|
|
156
154
|
- Every applicable `must` guardrail is mandatory.
|
|
157
155
|
- Every applicable `must_not` guardrail is a hard prohibition.
|
|
@@ -162,7 +160,7 @@ When deciding whether a guardrail applies, prefer security-preserving inclusion
|
|
|
162
160
|
|
|
163
161
|
## VibeReview Sync Contract
|
|
164
162
|
|
|
165
|
-
The final sync step must reuse the shortlist from this skill. It must not call `get_guardrails`
|
|
163
|
+
The final sync step must reuse the shortlist from this skill. It must not call `get_guardrails` again unless the task scope materially changed.
|
|
166
164
|
|
|
167
165
|
Before `sync_ai_ide_markdown` is called, ensure the main agent context clearly contains:
|
|
168
166
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: PWNISMS Threat Modelling
|
|
3
|
-
description: Security-first threat modelling workflow for code and architecture tasks. Walks all 7 PWNISMS categories, enforces vibe guardrails (secure by code), and synchronizes findings via a direct VibeReview markdown sync. Use
|
|
3
|
+
description: Security-first threat modelling workflow for code and architecture tasks. Walks all 7 PWNISMS categories, enforces vibe guardrails (secure by code), and synchronizes findings via a direct VibeReview markdown sync. Use after guardrail selection and before implementation.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# PWNISMS — Security-First Threat Modelling
|
|
7
7
|
|
|
8
8
|
For EVERY security-relevant task (feature, bug fix, refactor, infra change, architecture design), run a threat model with PWNISMS.
|
|
9
9
|
|
|
10
|
+
- This is a pre-implementation gate. Do not write, edit, patch, or generate implementation code until guardrail selection has completed and this PWNISMS pass has been completed.
|
|
10
11
|
- Walk through all 7 categories explicitly.
|
|
11
12
|
- If a category is not applicable, state it briefly and move on.
|
|
12
13
|
- Anchor analysis to linked files, diffs, PRs, API specs, and diagrams whenever available.
|
|
@@ -20,7 +21,7 @@ Before deep analysis, ensure the project-specific guardrail shortlist exists:
|
|
|
20
21
|
|
|
21
22
|
1. Use `{{GUARDRAILS_SELECTION_SKILL_DIR}}/SKILL.md`.
|
|
22
23
|
2. Resolve the project with `find_project_by_name` using `name="<SRAI_PROJECT_NAME>"`.
|
|
23
|
-
3. Call `get_guardrails`, shortlist intentionally for this task, then
|
|
24
|
+
3. Call `get_guardrails`, shortlist intentionally for this task, then preserve the exact returned guardrail records in context.
|
|
24
25
|
4. Keep the shortlisted existing guardrails in context for implementation and the final VibeReview markdown sync.
|
|
25
26
|
|
|
26
27
|
Do not perform project-profile exploration as part of PWNISMS. The old profile tools are not part of this workflow. Ground the threat model in the user request, repository code, diffs, architecture docs the user provides, and the shortlisted guardrails.
|
|
@@ -154,7 +155,7 @@ Dependency and delivery threats:
|
|
|
154
155
|
|
|
155
156
|
After completing the PWNISMS analysis and before writing code:
|
|
156
157
|
|
|
157
|
-
1. **Review the shortlisted
|
|
158
|
+
1. **Review the exact shortlisted guardrails** produced by `{{GUARDRAILS_SELECTION_SKILL_DIR}}/SKILL.md`.
|
|
158
159
|
2. **Classify applicability** — For each shortlisted guardrail, determine if it applies to the current task.
|
|
159
160
|
3. **Apply during code generation:**
|
|
160
161
|
- `must` rules → mandatory implementation requirements. Every applicable `must` guardrail must be satisfied.
|
|
@@ -199,7 +200,7 @@ When discussing designs before code exists:
|
|
|
199
200
|
|
|
200
201
|
## Phase 5 — VibeReview Sync (Post Threat Modelling)
|
|
201
202
|
|
|
202
|
-
**MANDATORY:** After every threat modeling step that produces or modifies threat content, the main agent must update the
|
|
203
|
+
**MANDATORY:** After every threat modeling step that produces or modifies threat content, the main agent must update the `.vibreview/scans/*.md` artifact and call `sync_ai_ide_markdown` directly with raw markdown content.
|
|
203
204
|
|
|
204
205
|
### What triggers the VibeReview sync
|
|
205
206
|
|
|
@@ -207,20 +208,22 @@ When discussing designs before code exists:
|
|
|
207
208
|
- Existing threat model updated or extended (new threats, refined mitigations, additional components)
|
|
208
209
|
- Guardrails applied during a code-generation task (existing or IDE-generated)
|
|
209
210
|
|
|
211
|
+
Do not call sync before implementation is complete unless the user explicitly asked only for threat modelling/design output. For coding tasks, the order is guardrail selection, PWNISMS, implementation, markdown sync.
|
|
212
|
+
|
|
210
213
|
### What the VibeReview markdown must contain
|
|
211
214
|
|
|
212
|
-
The main agent writes a structured `.md` artifact under
|
|
215
|
+
The main agent writes a structured `.md` artifact under `.vibreview/scans/` and uploads the raw markdown string through `sync_ai_ide_markdown`. That markdown should contain:
|
|
213
216
|
|
|
214
217
|
- **Threat model findings**: threats mitigated, PWNISMS categories, severities, mitigations applied
|
|
215
218
|
- **Best practices achieved**: structured practice entries with `practice_name`, `description`, and `category`
|
|
216
219
|
- **Secure code snippets**: security-relevant code with explanations
|
|
217
|
-
- **Guardrails applied**: all guardrails enforced during this session — both existing ones shortlisted earlier via `get_guardrails`
|
|
220
|
+
- **Guardrails applied**: all guardrails enforced during this session — both existing ones shortlisted earlier via `get_guardrails` (`source: "existing"`) and new ones the IDE agent created on the fly (`source: "ide_generated"`), each with satisfaction status
|
|
218
221
|
- **Workflow metadata**: `chat_session_id`, `event_name` or `title`, required `summary`, and optional `workflow_name` / `workflow_description`
|
|
219
222
|
|
|
220
223
|
### How to sync
|
|
221
224
|
|
|
222
225
|
1. Read and follow `{{VIBEREVIEW_SYNC_SKILL_DIR}}/SKILL.md`.
|
|
223
|
-
2. Write or update a file under
|
|
226
|
+
2. Write or update a file under `.vibreview/scans/`, ideally `.vibreview/scans/<chat_session_id>-<slugified-title-or-event-name>.md`.
|
|
224
227
|
3. Put `chat_session_id`, `summary`, and either `title` or `event_name` in frontmatter.
|
|
225
228
|
4. Include the required sections:
|
|
226
229
|
- `Best Practices Achieved`
|
|
@@ -234,9 +237,9 @@ The main agent writes a structured `.md` artifact under `vibereview/` and upload
|
|
|
234
237
|
- every guardrail includes `title`, `rule_type`, `source`, and `satisfied`
|
|
235
238
|
- OWASP mappings use exact IDs and names
|
|
236
239
|
- snippets are grounded in actual code, not invented text
|
|
237
|
-
- no sibling `.md` files in
|
|
238
|
-
6. Call `sync_ai_ide_markdown` directly with the finished markdown
|
|
239
|
-
7. If sync fails, leave the artifact in
|
|
240
|
+
- no sibling `.md` files in `.vibreview/scans/` were read just to infer format or content
|
|
241
|
+
6. Call `sync_ai_ide_markdown` directly with the finished raw markdown content. Do not pass JSON, extracted event objects, or summaries as the markdown.
|
|
242
|
+
7. If sync fails, leave the artifact in `.vibreview/scans/` and report the failure clearly.
|
|
240
243
|
|
|
241
244
|
---
|
|
242
245
|
|
|
@@ -251,6 +254,6 @@ Before finalizing output, confirm:
|
|
|
251
254
|
- [ ] Residual risk and follow-up actions are stated.
|
|
252
255
|
- [ ] Vibe guardrails were fetched and enforced (all applicable `must`/`must_not` rules satisfied).
|
|
253
256
|
- [ ] Guardrail compliance summary is included in the response (existing + IDE-generated).
|
|
254
|
-
- [ ] The VibeReview markdown was written under
|
|
257
|
+
- [ ] The VibeReview markdown was written under `.vibreview/scans/` and `sync_ai_ide_markdown` was called successfully with raw markdown content.
|
|
255
258
|
|
|
256
259
|
If ANY box cannot be checked, you MUST flag the gap to the user with a specific remediation recommendation before finalizing the code.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: vibereview-sync
|
|
3
|
-
description: Write and synchronize a structured VibeReview markdown artifact under
|
|
3
|
+
description: Write and synchronize a structured VibeReview markdown artifact under .vibreview/scans/ for the current security-relevant session. Use only after guardrail selection, PWNISMS threat modelling, and guardrail-enforced implementation are complete.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# VibeReview Markdown Sync
|
|
@@ -9,18 +9,20 @@ Configured SRAI project name: `<SRAI_PROJECT_NAME>`
|
|
|
9
9
|
|
|
10
10
|
Use this skill whenever threat modelling output exists or security guardrail compliance must be synchronized to SRAI.
|
|
11
11
|
|
|
12
|
-
This skill exists to make the markdown deterministic, grounded, and parseable without depending on a separate subagent. The same agent that performed the work should author the markdown and call `sync_ai_ide_markdown` directly.
|
|
12
|
+
This skill exists to make the markdown deterministic, grounded, and parseable without depending on a separate subagent. The same agent that performed the work should author the markdown and call `sync_ai_ide_markdown` directly with raw markdown content.
|
|
13
|
+
|
|
14
|
+
For coding tasks, do not use this skill until the required sequence is complete: guardrail selection, PWNISMS threat modelling, implementation, then markdown sync.
|
|
13
15
|
|
|
14
16
|
## Core Rules
|
|
15
17
|
|
|
16
|
-
1. Write the artifact under
|
|
18
|
+
1. Write the artifact under `.vibreview/scans/`.
|
|
17
19
|
2. Author the markdown from the current task context only.
|
|
18
|
-
3. Do not read other `.md` files in
|
|
20
|
+
3. Do not read other `.md` files in `.vibreview/scans/` to infer structure, copy content, or merge state.
|
|
19
21
|
4. If the current session file path is already known, update that one file directly.
|
|
20
22
|
5. If the current session file does not exist yet, create a new file using a stable name such as:
|
|
21
23
|
|
|
22
24
|
```text
|
|
23
|
-
|
|
25
|
+
.vibreview/scans/<chat_session_id>-<slugified-title-or-event-name>.md
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
6. Validate the markdown before calling `sync_ai_ide_markdown`.
|
|
@@ -28,7 +30,7 @@ vibereview/<chat_session_id>-<slugified-title-or-event-name>.md
|
|
|
28
30
|
|
|
29
31
|
## Why You Must Not Read Sibling Files
|
|
30
32
|
|
|
31
|
-
Other markdown files in
|
|
33
|
+
Other markdown files in `.vibreview/scans/` may belong to different sessions, different workflows, or partially complete work. Reading them introduces drift and causes downstream extraction failures.
|
|
32
34
|
|
|
33
35
|
Treat each VibeReview artifact as self-contained. The current artifact must be fully authorable from:
|
|
34
36
|
|
|
@@ -350,8 +352,8 @@ Allowed values:
|
|
|
350
352
|
|
|
351
353
|
Before calling `sync_ai_ide_markdown`, verify all of the following:
|
|
352
354
|
|
|
353
|
-
- The file is under
|
|
354
|
-
- You did not read sibling markdown files in
|
|
355
|
+
- The file is under `.vibreview/scans/`.
|
|
356
|
+
- You did not read sibling markdown files in `.vibreview/scans/`.
|
|
355
357
|
- `chat_session_id` exists in frontmatter.
|
|
356
358
|
- `summary` exists in frontmatter.
|
|
357
359
|
- `event_name` or `title` exists in frontmatter.
|
|
@@ -372,7 +374,8 @@ Before calling `sync_ai_ide_markdown`, verify all of the following:
|
|
|
372
374
|
|
|
373
375
|
After validation:
|
|
374
376
|
|
|
375
|
-
1. Save the markdown artifact under
|
|
376
|
-
2. Call `sync_ai_ide_markdown` directly with
|
|
377
|
-
3.
|
|
378
|
-
4. If sync
|
|
377
|
+
1. Save the markdown artifact under `.vibreview/scans/`.
|
|
378
|
+
2. Call `sync_ai_ide_markdown` directly with the raw markdown string in the `markdown` argument.
|
|
379
|
+
3. Do not pass JSON, a JSON string, a summary object, extracted event data, or metadata-only content as `markdown`.
|
|
380
|
+
4. If sync succeeds, report success briefly.
|
|
381
|
+
5. If sync fails, report failure clearly and leave the markdown artifact intact for retry.
|