@securityreviewai/vibereview-cli 0.1.0
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/LICENSE +201 -0
- package/README.md +189 -0
- package/SECURITY.md +46 -0
- package/bin/vibereview.js +7 -0
- package/dist/catalog/guardrails.br +0 -0
- package/dist/src/cli.js +103 -0
- package/dist/src/commands/generate.js +36 -0
- package/dist/src/commands/init.js +142 -0
- package/dist/src/core/assets.js +19 -0
- package/dist/src/core/catalog.js +51 -0
- package/dist/src/core/code-guardrails.js +154 -0
- package/dist/src/core/detector.js +214 -0
- package/dist/src/core/evidence.js +107 -0
- package/dist/src/core/fs.js +16 -0
- package/dist/src/core/generation-prompt.js +35 -0
- package/dist/src/core/generator.js +42 -0
- package/dist/src/core/hash.js +18 -0
- package/dist/src/core/integration.js +197 -0
- package/dist/src/core/matcher.js +33 -0
- package/dist/src/core/repository.js +36 -0
- package/dist/src/core/workspace.js +157 -0
- package/dist/src/providers/claude.js +27 -0
- package/dist/src/providers/codex.js +27 -0
- package/dist/src/providers/copilot.js +44 -0
- package/dist/src/providers/cursor.js +27 -0
- package/dist/src/providers/index.js +23 -0
- package/dist/src/providers/process.js +16 -0
- package/dist/src/providers/types.js +2 -0
- package/dist/src/runners/claude.js +22 -0
- package/dist/src/runners/codex.js +25 -0
- package/dist/src/runners/copilot.js +21 -0
- package/dist/src/runners/cursor.js +20 -0
- package/dist/src/runners/index.js +26 -0
- package/dist/src/runners/process.js +34 -0
- package/dist/src/runners/types.js +2 -0
- package/dist/src/types.js +2 -0
- package/dist/src/ui.js +22 -0
- package/docs/provider-contracts.md +55 -0
- package/package.json +49 -0
- package/runtime/hook-context.cjs +44 -0
- package/schemas/code-guardrails-v1.json +45 -0
- package/skills/guardrail-generator/SKILL.md +237 -0
- package/skills/guardrail-generator/agents/openai.yaml +3 -0
- package/skills/guardrail-generator/evals/evals.json +23 -0
- package/skills/guardrail-generator/references/output-contract.md +40 -0
- package/skills/vibereview-guardrails/SKILL.md +58 -0
- package/skills/vibereview-guardrails/agents/openai.yaml +3 -0
- package/skills/vibereview-osv-scan/SKILL.md +60 -0
- package/skills/vibereview-osv-scan/agents/openai.yaml +3 -0
- package/skills/vibereview-osv-scan/scripts/osv-scan.mjs +77 -0
- package/skills/vibereview-report/SKILL.md +49 -0
- package/skills/vibereview-report/agents/openai.yaml +3 -0
- package/skills/vibereview-report/references/report-contract.md +100 -0
- package/skills/vibereview-secure-code/SKILL.md +57 -0
- package/skills/vibereview-secure-code/agents/openai.yaml +3 -0
- package/skills/vibereview-threat-model/SKILL.md +60 -0
- package/skills/vibereview-threat-model/agents/openai.yaml +3 -0
- package/skills/vibereview-threat-model/references/pwnisms.md +46 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# VibeReview Markdown report contract
|
|
2
|
+
|
|
3
|
+
The report is Markdown with YAML frontmatter. Keep the frontmatter and Summary; add, revise, reorder, or remove the other sections when needed to represent the session's current security state. Do not retain empty or stale sections merely to match the example.
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
---
|
|
7
|
+
schema_version: "1"
|
|
8
|
+
chat_session_id: "<stable ID for this IDE chat>"
|
|
9
|
+
workflow_name: "<stable short name for this chat's feature workflow>"
|
|
10
|
+
title: "<current human-readable feature title>"
|
|
11
|
+
project: "<workspace project name>"
|
|
12
|
+
provider: "<cursor|codex|claude|copilot>"
|
|
13
|
+
status: "complete|partial|analysis_only"
|
|
14
|
+
created_at: "<ISO-8601 timestamp>"
|
|
15
|
+
updated_at: "<ISO-8601 timestamp>"
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# <Title>
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
|
|
22
|
+
<What was requested, what now exists, and the overall security result.>
|
|
23
|
+
|
|
24
|
+
## Scope and Assumptions
|
|
25
|
+
|
|
26
|
+
- **Scope:** ...
|
|
27
|
+
- **Assets:** ...
|
|
28
|
+
- **Entry points:** ...
|
|
29
|
+
- **Trust boundaries:** ...
|
|
30
|
+
- **Assumptions:** ...
|
|
31
|
+
|
|
32
|
+
## Threats Mitigated
|
|
33
|
+
|
|
34
|
+
### T-01 — <Threat title>
|
|
35
|
+
|
|
36
|
+
- **PWNISMS category:** Product | Workload | Network | IAM | Secrets | Monitoring | Supply Chain
|
|
37
|
+
- **Scenario:** <actor/action/impact>
|
|
38
|
+
- **Likelihood:** low | medium | high
|
|
39
|
+
- **Impact:** low | medium | high | critical
|
|
40
|
+
- **Status:** mitigated | partial | open | not_applicable
|
|
41
|
+
- **Mitigation:** <implemented control>
|
|
42
|
+
- **Guardrails:** <IDs or None>
|
|
43
|
+
- **Evidence:** <repository paths/tests/configuration>
|
|
44
|
+
|
|
45
|
+
## Best Practices Achieved
|
|
46
|
+
|
|
47
|
+
- **<Practice>:** <what was implemented and where>
|
|
48
|
+
|
|
49
|
+
## Dependency Security (OSV.dev)
|
|
50
|
+
|
|
51
|
+
### `<ecosystem>:<package>@<evaluated version>`
|
|
52
|
+
|
|
53
|
+
- **Change:** added | upgraded | downgraded | replaced
|
|
54
|
+
- **Result:** clear | remediated | residual_risk | unverified
|
|
55
|
+
- **Advisories:** <OSV IDs and severity, or None found>
|
|
56
|
+
- **Decision:** <accepted version, replacement, removal, or unresolved reason>
|
|
57
|
+
- **Verification:** <initial scan and required re-scan outcome>
|
|
58
|
+
|
|
59
|
+
Use `Not applicable — no dependency changes` when the feature did not change dependencies. Never use `clear` for a failed query, unknown severity, missing exact version, or an unscanned remediation version.
|
|
60
|
+
|
|
61
|
+
## Secure Code Changes
|
|
62
|
+
|
|
63
|
+
### `<repository-relative path>`
|
|
64
|
+
|
|
65
|
+
<Short explanation of the security-relevant change. Include a small fenced excerpt only when it materially helps the reader.>
|
|
66
|
+
|
|
67
|
+
## Guardrails Applied
|
|
68
|
+
|
|
69
|
+
### `<guardrail id>` — <title>
|
|
70
|
+
|
|
71
|
+
- **Source:** pack | code_generated | custom
|
|
72
|
+
- **Type:** must | must_not
|
|
73
|
+
- **Category:** ...
|
|
74
|
+
- **Satisfied:** yes | no
|
|
75
|
+
- **Application:** <how the implementation complied, or why it did not>
|
|
76
|
+
- **Evidence:** <paths/tests>
|
|
77
|
+
|
|
78
|
+
## OWASP Mappings
|
|
79
|
+
|
|
80
|
+
- **<OWASP identifier and title>:** <mapped threats and controls>
|
|
81
|
+
|
|
82
|
+
## Verification
|
|
83
|
+
|
|
84
|
+
- `<command or check>` — passed | failed | not run — <important result>
|
|
85
|
+
|
|
86
|
+
## Residual Risks
|
|
87
|
+
|
|
88
|
+
- <Remaining exposure, operational dependency, deferred decision, or `None identified within the reviewed scope`.>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Field semantics
|
|
92
|
+
|
|
93
|
+
- `workflow_name` remains stable in follow-ups even if `title` changes as scope becomes clearer.
|
|
94
|
+
- The canonical filename is `<chat_session_id>.md`; `chat_session_id` and `created_at` are immutable for the session.
|
|
95
|
+
- Every update is a current-state rewrite. The agent may add, revise, or remove entries and optional sections based on the latest feature and repository state.
|
|
96
|
+
- `status: complete` means the requested implementation and relevant checks completed; it does not mean zero residual risk.
|
|
97
|
+
- `status: partial` covers incomplete implementation, failed checks, or material open mitigations.
|
|
98
|
+
- `status: analysis_only` is for threat-model/design-only requests with no implementation.
|
|
99
|
+
- **Threats Mitigated** retains open or partial threats despite the heading; their explicit statuses prevent false claims and preserve the familiar VibeReview field name.
|
|
100
|
+
- **Best Practices Achieved**, **Secure Code Changes**, **Guardrails Applied**, and **OWASP Mappings** correspond to the established VibeReview artifact fields while remaining readable Markdown.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vibereview-secure-code
|
|
3
|
+
description: Implement a security-relevant coding request using its completed PWNISMS threat model and selected local VibeReview guardrails. Use after pre-implementation threat modelling to produce secure-by-default code and verification evidence.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# VibeReview Secure-by-Default Implementation
|
|
7
|
+
|
|
8
|
+
Implement the user's requested behavior while satisfying the active VibeReview guardrails and threat mitigations. Security controls should be part of the normal code path, not an optional hardening layer.
|
|
9
|
+
|
|
10
|
+
## Preconditions
|
|
11
|
+
|
|
12
|
+
- The current prompt has been evaluated for security relevance.
|
|
13
|
+
- Applicable guardrails have been selected from the local workspace.
|
|
14
|
+
- The PWNISMS pass has identified the threats and required mitigations.
|
|
15
|
+
- If dependencies change, exact proposed versions have been checked with `vibereview-osv-scan`, including a re-scan of any selected remediation version.
|
|
16
|
+
|
|
17
|
+
If the prompt has no implementation work, do not manufacture code. If it asks only for a threat model or design, proceed directly to the report after the requested analysis.
|
|
18
|
+
|
|
19
|
+
## Implement from the security boundary inward
|
|
20
|
+
|
|
21
|
+
1. Identify the exact entry point or state transition being changed.
|
|
22
|
+
2. Establish trusted identity, authorization, ownership, or tenant context before protected access.
|
|
23
|
+
3. Validate and normalize untrusted data at the boundary using established local mechanisms.
|
|
24
|
+
4. Preserve security-significant ordering such as verify-before-parse, authorize-before-read, and persist-before-side-effect where applicable.
|
|
25
|
+
5. Route sensitive operations through repository-specific helpers and wrappers required by code-specific or custom guardrails.
|
|
26
|
+
6. Make safe behavior the default and unsafe bypasses difficult or impossible for ordinary callers.
|
|
27
|
+
7. Add bounded failure handling, abuse controls, safe errors, and redacted observability proportionate to the threat model.
|
|
28
|
+
8. Avoid introducing a dependency when existing platform or repository functionality is sufficient. When a dependency changes, use the OSV-verified version, preserve the project's lock and integrity workflow, and record verification honestly. Never describe an unreachable or inconclusive OSV check as clean.
|
|
29
|
+
|
|
30
|
+
Do not weaken or bypass a `must`/`must_not` rule for convenience. Do not silently broaden scope beyond the requested feature.
|
|
31
|
+
|
|
32
|
+
## Verify guardrail satisfaction
|
|
33
|
+
|
|
34
|
+
After implementation, evaluate every shortlisted guardrail:
|
|
35
|
+
|
|
36
|
+
- `satisfied: true` only when the resulting code demonstrably complies;
|
|
37
|
+
- `satisfied: false` when it does not, with the reason and consequence;
|
|
38
|
+
- note the implementation path, test, or configuration that provides evidence.
|
|
39
|
+
|
|
40
|
+
Update each threat status:
|
|
41
|
+
|
|
42
|
+
- `mitigated` when the implemented control and relevant verification address it;
|
|
43
|
+
- `partial` when material exposure remains;
|
|
44
|
+
- `open` when no mitigation was implemented;
|
|
45
|
+
- `not_applicable` only when later evidence shows the scenario cannot occur.
|
|
46
|
+
|
|
47
|
+
Do not claim a threat is mitigated merely because the intended control was discussed.
|
|
48
|
+
|
|
49
|
+
## Verification
|
|
50
|
+
|
|
51
|
+
Run proportionate checks available in the repository: focused tests, type checking, linting, schema validation, authorization-negative cases, malformed-input cases, replay/idempotency cases, or other checks tied to the actual mitigations.
|
|
52
|
+
|
|
53
|
+
Record commands and outcomes accurately. Never label checks as passed when they were not run, were blocked, or failed.
|
|
54
|
+
|
|
55
|
+
## Handoff
|
|
56
|
+
|
|
57
|
+
Pass the final implementation state, changed paths, verification results, OSV dependency evidence, threat statuses, guardrail satisfaction, best practices achieved, OWASP mappings, and residual risks to `vibereview-report`. The report must describe the code that now exists, not the plan that existed before implementation.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vibereview-threat-model
|
|
3
|
+
description: Perform a focused pre-implementation PWNISMS threat model for a security-relevant coding request using the active local VibeReview guardrail shortlist. Use after guardrail selection and before code is written or changed.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# VibeReview PWNISMS Threat Model
|
|
7
|
+
|
|
8
|
+
Threat-model the requested change before implementation. Produce an implementation-focused model, not an architecture inventory or exhaustive attack catalog.
|
|
9
|
+
|
|
10
|
+
## Preconditions
|
|
11
|
+
|
|
12
|
+
- `vibereview-guardrails` has produced the exact active shortlist from `.vibereview/guardrails.yml`.
|
|
13
|
+
- Scope is concrete enough to identify the affected behavior and code paths. Make narrow, explicit assumptions when details are unavailable; ask only when a missing choice would materially change the implementation.
|
|
14
|
+
- Do not edit implementation files until this pass is complete.
|
|
15
|
+
|
|
16
|
+
## Establish context
|
|
17
|
+
|
|
18
|
+
Capture the requested behavior, affected components, actors, privileges, protected assets, entry points, exits, trust boundaries, sensitive state changes, assumptions, and active guardrails. Use repository evidence relevant to the requested change. Do not perform full architecture profiling.
|
|
19
|
+
|
|
20
|
+
## Walk all PWNISMS categories
|
|
21
|
+
|
|
22
|
+
Check every category, but keep non-applicable categories to a one-line reason. Detailed checks are in [references/pwnisms.md](references/pwnisms.md).
|
|
23
|
+
|
|
24
|
+
1. **Product** — input/output, injection, deserialization, business logic, replay, races, errors, file handling.
|
|
25
|
+
2. **Workload** — runtime identity, isolation, storage, queues, jobs, resource exhaustion, deployment posture.
|
|
26
|
+
3. **Network** — exposed interfaces, TLS, CORS, SSRF, redirects, ingress/egress, rate and size limits.
|
|
27
|
+
4. **IAM** — authentication, authorization, ownership, tenancy, roles, sessions, service identity, privilege escalation.
|
|
28
|
+
5. **Secrets** — acquisition, storage, use, rotation, leakage, logs, defaults, client exposure.
|
|
29
|
+
6. **Monitoring** — security events, auditability, redaction, abuse signals, alertability, failure visibility.
|
|
30
|
+
7. **Supply Chain** — new or changed dependencies, build steps, actions, images, provenance, unsafe generated code.
|
|
31
|
+
|
|
32
|
+
## Create actionable threats
|
|
33
|
+
|
|
34
|
+
Keep threats that are plausible for this feature and materially affect design or implementation. Each retained threat needs:
|
|
35
|
+
|
|
36
|
+
- stable local identifier such as `T-01`;
|
|
37
|
+
- PWNISMS category;
|
|
38
|
+
- threat scenario stated as actor/action/impact;
|
|
39
|
+
- affected asset or boundary;
|
|
40
|
+
- likelihood: `low`, `medium`, or `high`;
|
|
41
|
+
- impact: `low`, `medium`, `high`, or `critical`;
|
|
42
|
+
- concrete mitigation for this implementation;
|
|
43
|
+
- mapped guardrail IDs, when applicable; and
|
|
44
|
+
- initial status: `planned`, `mitigated`, `partial`, `open`, or `not_applicable`.
|
|
45
|
+
|
|
46
|
+
Prioritize roughly three to seven meaningful threats. More is acceptable only when the feature truly spans several distinct boundaries. Do not inflate counts with generic variations.
|
|
47
|
+
|
|
48
|
+
## Map guardrails and gaps
|
|
49
|
+
|
|
50
|
+
For each threat, identify which shortlisted `must` or `must_not` rule constrains it. A guardrail may mitigate several threats, and a threat may need several guardrails.
|
|
51
|
+
|
|
52
|
+
When a realistic threat lacks a guardrail, treat its mitigation as a feature-specific secure-design decision. Do not mutate the workspace guardrail file or invent a permanent `code_specific` rule during this workflow; regeneration is handled by `vibereview guardrails generate`.
|
|
53
|
+
|
|
54
|
+
If the requested behavior cannot be implemented safely without changing product requirements, credentials, infrastructure, or another user-owned decision, surface that decision before coding. Otherwise continue with the safest in-scope implementation.
|
|
55
|
+
|
|
56
|
+
## Handoff
|
|
57
|
+
|
|
58
|
+
If the proposal adds, replaces, upgrades, or downgrades a dependency, pass that exact dependency delta to `vibereview-osv-scan` before implementation. General supply-chain reasoning is not a substitute for checking the resolved version.
|
|
59
|
+
|
|
60
|
+
Pass the threat set, assumptions, active guardrail shortlist, and mitigation requirements to `vibereview-secure-code`. Keep this analysis in working context; the user-facing durable form is the Markdown report written after implementation.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# PWNISMS checks
|
|
2
|
+
|
|
3
|
+
Use these as prompts for feature-level analysis, not as a requirement to manufacture findings.
|
|
4
|
+
|
|
5
|
+
## Product
|
|
6
|
+
|
|
7
|
+
- Can untrusted input reach interpreters, queries, templates, file paths, redirects, or object construction?
|
|
8
|
+
- Can a caller bypass workflow order, replay an action, race a state transition, or alter server-owned fields?
|
|
9
|
+
- Are errors safe for users while remaining diagnosable?
|
|
10
|
+
- Are upload, download, archive, and serialization boundaries constrained?
|
|
11
|
+
|
|
12
|
+
## Workload
|
|
13
|
+
|
|
14
|
+
- Does the change alter runtime privileges, service accounts, filesystem access, queues, schedulers, or background jobs?
|
|
15
|
+
- Can expensive work be triggered without bounds, idempotency, backpressure, or cancellation?
|
|
16
|
+
- Does sensitive state persist with the intended isolation and lifecycle?
|
|
17
|
+
|
|
18
|
+
## Network
|
|
19
|
+
|
|
20
|
+
- Are inbound origin, method, size, and rate boundaries explicit?
|
|
21
|
+
- Can user-controlled destinations, redirects, DNS, or proxy behavior cause SSRF or credential forwarding?
|
|
22
|
+
- Are transport security, exposure, and service-to-service authentication appropriate?
|
|
23
|
+
|
|
24
|
+
## IAM
|
|
25
|
+
|
|
26
|
+
- Is identity established from a trusted source and revalidated at the sensitive boundary?
|
|
27
|
+
- Are object ownership, tenant scope, roles, and service permissions checked server-side?
|
|
28
|
+
- Can session, token, callback, or account-linking flows be confused or escalated?
|
|
29
|
+
|
|
30
|
+
## Secrets
|
|
31
|
+
|
|
32
|
+
- Could credentials enter source, generated files, browser code, URLs, errors, telemetry, or logs?
|
|
33
|
+
- Does the feature use the repository's established secret/key abstraction and preserve rotation or revocation?
|
|
34
|
+
- Are secret values separated by tenant, environment, and purpose where required?
|
|
35
|
+
|
|
36
|
+
## Monitoring
|
|
37
|
+
|
|
38
|
+
- Are successful and failed security-relevant actions attributable without logging secrets or unnecessary personal data?
|
|
39
|
+
- Can abuse, repeated denial, privilege changes, and high-impact state transitions be detected?
|
|
40
|
+
- Will failures be observable rather than silently swallowed?
|
|
41
|
+
|
|
42
|
+
## Supply Chain
|
|
43
|
+
|
|
44
|
+
- Does the change introduce or update packages, images, actions, plugins, generated artifacts, or build scripts?
|
|
45
|
+
- Are versions and integrity controlled by the repository's normal lock/provenance mechanism?
|
|
46
|
+
- Is generated or third-party code validated before it gains privileged access?
|