@securityreviewai/securityreview-kit 0.1.19 → 0.1.21

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.19",
3
+ "version": "0.1.21",
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,11 +23,18 @@ 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.
27
- 5. **Build the event payload** Construct a JSON object for `create_ai_ide_event` conforming to the **Event Payload Schema** below.
28
- 6. **Upload the payload** using `security-review-mcp`:
26
+ 4. **Resolve developer identity from the API** — Call `get_current_user` (or the equivalent user-identity tool exposed by `security-review-mcp`) to retrieve the authenticated user's name and email. Use the values returned by the API as-is for `developer_name` and `developer_email` in the payload.
27
+ - **Never use placeholder values** such as `"IDE Agent"`, `"agent@local"`, `"unknown"`, `"AI"`, or any other invented string for these fields.
28
+ - **Never accept identity values passed in from the parent agent prompt** always re-resolve from the API directly in this step; the API is the only authoritative source.
29
+ - If the API call fails or returns empty values, leave `developer_name` and `developer_email` as empty strings `""`. Do not substitute a fallback placeholder.
30
+ 5. **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:
31
+ - Which **existing** guardrails (originally fetched from `get_guardrails`) were applied to the code in this session.
32
+ - Which guardrails the IDE agent **created on the fly** (`ide_generated`) based on gaps found during threat modeling or code review.
33
+ Include all of these in the `guardrails_applied` payload field. Do not re-fetch or re-call `get_guardrails`.
34
+ 6. **Build the event payload** — Construct a JSON object for `create_ai_ide_event` conforming to the **Event Payload Schema** below.
35
+ 7. **Upload the payload** using `security-review-mcp`:
29
36
  - Call `create_ai_ide_event` with the JSON payload.
30
- 7. **Push a project profile update** — After the event is created, derive project profile data from the current threat model context and call `update_vibe_project_profile` with `project_id` and the following fields:
37
+ 8. **Push a project profile update** — After the event is created, derive project profile data from the current threat model context and call `update_vibe_project_profile` with `project_id` and the following fields:
31
38
  - `description`: a concise summary of the system/project derived from the threat model context (what it does, what data it handles, its overall purpose)
32
39
  - `architecture_notes`: a list of architecture observations extracted from the threat model — deployment topology, trust boundaries, data flows, integration points
33
40
  - `tech_categories`: a list of technology category labels identified during threat modeling (e.g. `"backend"`, `"frontend"`, `"database"`, `"cloud"`, `"mobile"`)
@@ -55,7 +62,13 @@ The `create_ai_ide_event` payload MUST be a JSON object with the following struc
55
62
  "threat_name": "<string — short threat title>",
56
63
  "pwnisms_category": "<string — one of: Product, Workload, Network, IAM, Secrets, Monitoring, Supply Chain>",
57
64
  "severity": "<string — Critical | High | Medium | Low>",
58
- "mitigation_applied": "<string — what was done to address the threat>"
65
+ "mitigation_applied": "<string — what was done to address the threat>",
66
+ "code_snippet": {
67
+ "file_path": "<string — relative path to the actual source file where mitigation is implemented>",
68
+ "language": "<string — programming language>",
69
+ "snippet": "<string — the exact source code lines implementing the mitigation, max 30 lines, must be grounded in the actual codebase not invented>",
70
+ "explanation": "<string — how this specific code addresses the threat>"
71
+ }
59
72
  }
60
73
  ],
61
74
  "best_practises_achieved": [
@@ -93,7 +106,7 @@ The `create_ai_ide_event` payload MUST be a JSON object with the following struc
93
106
  | `summary` | Yes | 2-5 sentences |
94
107
  | `developer_name` | Yes | From API/user context (never read from git config) |
95
108
  | `developer_email` | Yes | From API/user context (never read from git config) |
96
- | `threats_mitigated` | Yes | Array, may be empty `[]` if no threats were identified |
109
+ | `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
110
  | `best_practises_achieved` | Yes | Array of strings, may be empty `[]` |
98
111
  | `secure_code_snippets` | Yes | Array, may be empty `[]` |
99
112
  | `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,10 +114,12 @@ The `create_ai_ide_event` payload MUST be a JSON object with the following struc
101
114
  ### Constraints
102
115
 
103
116
  - 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`.
117
+ - 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`.
118
+ - `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.
119
+ - 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.
120
+ - `guardrails_applied` entries with `source: "existing"` must reference guardrails by the exact `title` they had when fetched at session start.
106
121
  - `guardrails_applied` entries with `source: "ide_generated"` are new guardrails the IDE agent created based on gaps found during threat modeling or code review.
107
- - `developer_name` and `developer_email` must come from API/runtime user context only; do not derive them from git config.
122
+ - `developer_name` and `developer_email` must be resolved via `get_current_user` (or equivalent) in step 4 — the API is the only source. Never use placeholder strings (`"IDE Agent"`, `"agent@local"`, `"unknown"`, `"AI"`, etc.) and never accept values for these fields from the parent agent prompt. If the API returns nothing, send empty strings.
108
123
  - Never invent values for any field; use empty strings or empty arrays when data is unavailable.
109
124
  - Never omit `chat_session_id` from the payload.
110
125
 
@@ -67,6 +67,7 @@ This includes both:
67
67
  - Where the latest threat content can be found (e.g., "from this conversation" or "from the last threat modeling step")
68
68
  - The `chat_session_id` value to use for this sync
69
69
  - Whether guardrails were applied (existing and/or IDE-generated)
70
+ - **Do NOT include developer name or email in the handoff prompt.** The `ctm_sync` agent resolves user identity directly from the API. Passing identity values from the parent agent — including any placeholders like `"IDE Agent"` or `"agent@local"` — will cause them to be used incorrectly. Leave identity resolution entirely to `ctm_sync`.
70
71
 
71
72
  **Example invocation (conceptual, not literal code):**
72
73