@securityreviewai/securityreview-kit 0.1.18 → 0.1.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@securityreviewai/securityreview-kit",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "Bootstrap security-review-mcp for AI IDEs and CLI tools",
5
5
  "author": "Debarshi Das <debarshi.das@we45.com>",
6
6
  "license": "UNLICENSED",
@@ -23,7 +23,10 @@ When invoked:
23
23
  - `name`: a short, meaningful heading derived from the **high-level feature or topic** being worked on in this session (e.g. `"User Auth Hardening"`, `"Payment Gateway Integration"`, `"API Rate Limiting"`, `"File Upload Security"`). Use 2–5 words, title-case. Do **not** use sequential labels like `session1/session2`. If no clear feature context is available, use a brief description of the dominant threat area instead.
24
24
  - `description`: must include `chat_session_id:<chat_session_id>` so future syncs can attach to this workflow. Add a brief human-readable note if helpful. Do not add the word ctm anywhere.
25
25
  - Store the returned `workflow_id` for the upload step.
26
- 4. **Fetch current guardrails** — Call `get_guardrails` with `project_id` to retrieve the project's current vibe guardrails. These inform the `guardrails_applied` field in the event payload.
26
+ 4. **Identify guardrails for the payload** — Do **not** call `get_guardrails` here. Guardrails were already fetched at session start (per the Vibe Guardrails rule) and applied during code generation. From the parent agent context, identify:
27
+ - Which **existing** guardrails (originally fetched from `get_guardrails`) were applied to the code in this session.
28
+ - Which guardrails the IDE agent **created on the fly** (`ide_generated`) based on gaps found during threat modeling or code review.
29
+ Include all of these in the `guardrails_applied` payload field. Do not re-fetch or re-call `get_guardrails`.
27
30
  5. **Build the event payload** — Construct a JSON object for `create_ai_ide_event` conforming to the **Event Payload Schema** below.
28
31
  6. **Upload the payload** using `security-review-mcp`:
29
32
  - Call `create_ai_ide_event` with the JSON payload.
@@ -48,14 +51,20 @@ The `create_ai_ide_event` payload MUST be a JSON object with the following struc
48
51
  "chat_session_id": "<string — stable session identifier, same for all events in this chat>",
49
52
  "title": "<string — concise title describing what was threat-modeled or implemented, 5-15 words>",
50
53
  "summary": "<string — 2-5 sentence summary of the threat model findings, key risks identified, mitigations applied, and any guardrails enforced>",
51
- "developer_name": "<string — from git config user.name unless explicitly specified by user>",
52
- "developer_email": "<string — from git config user.email unless explicitly specified by user>",
54
+ "developer_name": "<string — from API/user context provided by MCP or host runtime>",
55
+ "developer_email": "<string — from API/user context provided by MCP or host runtime>",
53
56
  "threats_mitigated": [
54
57
  {
55
58
  "threat_name": "<string — short threat title>",
56
59
  "pwnisms_category": "<string — one of: Product, Workload, Network, IAM, Secrets, Monitoring, Supply Chain>",
57
60
  "severity": "<string — Critical | High | Medium | Low>",
58
- "mitigation_applied": "<string — what was done to address the threat>"
61
+ "mitigation_applied": "<string — what was done to address the threat>",
62
+ "code_snippet": {
63
+ "file_path": "<string — relative path to the actual source file where mitigation is implemented>",
64
+ "language": "<string — programming language>",
65
+ "snippet": "<string — the exact source code lines implementing the mitigation, max 30 lines, must be grounded in the actual codebase not invented>",
66
+ "explanation": "<string — how this specific code addresses the threat>"
67
+ }
59
68
  }
60
69
  ],
61
70
  "best_practises_achieved": [
@@ -91,9 +100,9 @@ The `create_ai_ide_event` payload MUST be a JSON object with the following struc
91
100
  | `chat_session_id` | Yes | From step 2 |
92
101
  | `title` | Yes | 5-15 words, descriptive |
93
102
  | `summary` | Yes | 2-5 sentences |
94
- | `developer_name` | Yes | From `git config user.name` |
95
- | `developer_email` | Yes | From `git config user.email` |
96
- | `threats_mitigated` | Yes | Array, may be empty `[]` if no threats were identified |
103
+ | `developer_name` | Yes | From API/user context (never read from git config) |
104
+ | `developer_email` | Yes | From API/user context (never read from git config) |
105
+ | `threats_mitigated` | Yes | Array, may be empty `[]` if no threats were identified. Each entry must include a `code_snippet` grounded in actual source code |
97
106
  | `best_practises_achieved` | Yes | Array of strings, may be empty `[]` |
98
107
  | `secure_code_snippets` | Yes | Array, may be empty `[]` |
99
108
  | `guardrails_applied` | Yes | Array of all guardrails enforced during this session — both existing ones from `get_guardrails` and new ones the IDE agent created. Use `source` to distinguish origin. Empty `[]` if none |
@@ -101,9 +110,12 @@ The `create_ai_ide_event` payload MUST be a JSON object with the following struc
101
110
  ### Constraints
102
111
 
103
112
  - Every `threats_mitigated` entry must map to one of the 7 PWNISMS categories.
104
- - `secure_code_snippets` must not exceed 50 lines per snippet; truncate with a comment if needed.
105
- - `guardrails_applied` entries with `source: "existing"` should reference guardrails fetched in step 4 by their exact `title`.
113
+ - Every `threats_mitigated` entry must include a `code_snippet`. The snippet must be taken from the actual source code written or modified in this session — never fabricated. If no code was written for a threat (e.g. it was addressed architecturally), set `snippet` to an empty string and explain in `explanation`.
114
+ - `secure_code_snippets` must not exceed 50 lines per snippet; `threats_mitigated[].code_snippet.snippet` must not exceed 30 lines; truncate with a comment if needed.
115
+ - Do not call `get_guardrails` during CTM sync. Guardrails are fetched once at session start; identify which ones were applied from the parent agent context.
116
+ - `guardrails_applied` entries with `source: "existing"` must reference guardrails by the exact `title` they had when fetched at session start.
106
117
  - `guardrails_applied` entries with `source: "ide_generated"` are new guardrails the IDE agent created based on gaps found during threat modeling or code review.
118
+ - `developer_name` and `developer_email` must come from API/runtime user context only; do not derive them from git config.
107
119
  - Never invent values for any field; use empty strings or empty arrays when data is unavailable.
108
120
  - Never omit `chat_session_id` from the payload.
109
121