vulkro fix
Print suggested code fixes as patches, check that each one works, or apply the safe ones in place.
vulkro fix . # print fixes as unified diffs (read-only)
vulkro fix . --verify # re-scan a patched copy: fixed / not-fixed / regressed
vulkro fix . --apply # write only the patches proven fixed
By default it never changes your files. Pipe the output to git apply, or copy hunks by hand.
Three ways to fix
Remedies. For the common injection, redirect, SSRF, XSS, cookie, CORS, TLS, JWT, mass-assignment and missing-auth findings in JavaScript, TypeScript, Python, Go and Java, each finding gets a remedy: a diff when the code shape is recognised, otherwise steps with a before and after example. --verify applies the patches to a temporary copy, scans it again and labels each patch fixed (finding gone, no new Medium or higher finding on the changed lines), not-fixed or regressed. --apply writes only the fixed ones; a file that changed since the scan is skipped.
Templates (--write). A closed list of mechanical rewrites applied in place, such as cookie flags, MD5 or SHA-1 to SHA-256, yaml.load to yaml.safe_load, simple string-built SQL to parameters, and turning off debug=True. Any ambiguity is a refusal with a reason, not a guess. --dry-run previews them.
AI (--ai). For findings no template covers, your AI model proposes a diff. It is shown as verified only if a deterministic re-scan clears the finding with no new finding and an AI review agrees; otherwise it is refused with a reason. --ai alone is read-only; --ai --write applies only verified AI diffs, after the templates. See vulkro ai.
Flags
| Flag | Description |
|---|---|
[PATH] | Project root. Default .. |
--finding <ID> | Only this finding (repeatable; alias --id). IDs come from vulkro scan --format json. |
--rule <RULE> | Only findings of this rule, for example js-taint-sql-001 (repeatable). |
--kind <KIND> | Only cors-wildcard, debug-on, hardcoded-secret or jwt-verify-disabled. |
--verify | Re-scan a patched copy and label each patch. Never touches your files. |
--apply | Write the patches --verify proves fixed. |
--bundle <PATH> | Write a zip or directory with the verified patches, patched files, remedies as JSON and a README. |
--write / --dry-run | Apply / preview the template rewrites. |
--format <FMT> | text (default), json (each fix with finding id, rule, file:line, explanation and a git apply-ready diff) or diff (one combined patch). |
--ai, --ai-model, --ai-url | Turn on the AI tier and pick its model or runtime. |
Exit codes
| Mode | Codes |
|---|---|
Default, --dry-run, --verify, --bundle, --format diff | Always 0. |
--write | 0 nothing to fix, 1 a fix was applied, 2 IO failure or only refusals. |
--apply | 0 nothing to apply, 1 a verified patch was applied, 2 IO failure or no patch verified. |
--ai never changes the exit code.
See also: vulkro mcp serve (the suggest_fixes and verify_fix tools).
Command reference
Generated from vulkro fix --help (vulkro 0.41.0). Run scripts/gen-docs.sh in the product repository to refresh it; do not edit this section by hand.
Print suggested code fixes as patches, or apply the safe ones in place.
vulkro fix [OPTIONS] [PATH]
Arguments
| Argument | Description |
|---|---|
[PATH] | [default: .]. Default: .. |
Options
| Flag | Description |
|---|---|
--kind <KIND> | Limit suggestions to a specific kind (cors-wildcard | debug-on | hardcoded-secret | jwt-verify-disabled) |
--offline | Hard-disable every outbound network call for this run (sets VULKRO_OFFLINE=1). Blocks the CVE feed, the license heartbeat, the update check, webhooks, and any cloud AI endpoint; a loopback model (http://127.0.0.1, http://localhost) is still allowed. Equivalent to exporting VULKRO_OFFLINE=1, and the flag wins when both are set. |
--finding <ID> | Fix only specific findings, by their scan-derived finding id (from vulkro scan --format json or the organisation dashboard), or by their stable finding_id. Repeatable: --finding A --finding B. Alias: --id |
-q, --quiet | Print only warnings and errors on stderr: no progress, tips or next-step hints. Results on stdout and exit codes are unchanged. |
--no-color | Turn off coloured output. Colour is also off when NO_COLOR is set to a non-empty value or TERM=dumb. |
--rule <RULE> | Fix only findings of a rule (for example js-taint-sql-001). Repeatable. |
--verify | Verify every remedy patch: apply the patches to a temporary copy of the project, scan the copy again, and report each patch as fixed, not-fixed or regressed. Never modifies your files. |
--bundle <PATH> | Write a fix bundle (a .zip file, or an empty / new directory) with the verified fixed patches (per-finding and combined diffs), the patched files, every remedy as JSON, and a README. Implies --verify. Never modifies your files. |
--apply | Apply the remedy patches that --verify proves fixed to your working tree (atomic write per file; a file that changed since the scan is skipped). Implies --verify. Patches that are not-fixed or regressed are never applied. |
-f, --format <FORMAT> | Output format: text (unified diffs, default), json (a stable machine-applicable schema for agents and MCP consumers: each fix carries the finding id, rule, file:line, explanation, and a git apply-ready unified diff), or diff (the remedy patches as one unified diff; only the fixed ones with --verify). With --write / --dry-run the JSON envelope is bumped to schema_version 2 with additive applied / refused / summary fields. When there are remedies, the JSON gains additive remedies and remedy_summary fields and schema_version 4. Default: text. |
--write | Apply the deterministic templated rewrites in place (atomic temp file + rename). Refused items are reported with a reason. Conflicts with --dry-run. Exit code: 0 = nothing to fix, 1 = a fix was applied, 2 = IO failure or only refusals. |
--dry-run | Preview the deterministic templated rewrites without touching any file, and print an "N would apply, M refused" summary to stderr. Exit code: 0 = nothing would apply, 1 = at least one fix would apply. |
--ai | [advisory] Turn on the AI fix tier for findings the deterministic templates have no safe rewrite for. The resolved LOCAL model (see vulkro ai) proposes a minimal diff, which is then VALIDATED by a double gate: the PRIMARY oracle re-runs the deterministic scanner (the finding must disappear and no new finding may appear), and only then a SECOND, subordinate AI review checks the patch is correct and behaviour-preserving. It is shown as verified only if BOTH gates pass, otherwise as refused with a reason. The AI review can never turn a re-scan failure into a pass. --ai alone is read-only (advisory diffs); --ai --write applies ONLY verified AI diffs, each printed first, and only AFTER the deterministic templates run. Every AI diff is labelled advisory / non-deterministic / excluded-from-benchmark and NEVER changes the exit code: a refused AI fix is a refusal, not an error. A loopback model is allowed under VULKRO_OFFLINE; a cloud url is refused offline. |
--ai-model <MODEL> | AI model tag override for --ai (highest precedence). Overrides VULKRO_AI_MODEL, the saved vulkro ai use selection, and the smart default. Example: --ai-model qwen2.5-coder:7b |
--ai-url <URL> | AI runtime base url override for --ai (OpenAI-compatible). Example: --ai-url http://127.0.0.1:11434/v1. A loopback url is allowed under VULKRO_OFFLINE; a cloud url is refused offline. |
-h, --help | Print help (see a summary with '-h') |
Full vulkro fix --help
Print suggested code fixes as patches, or apply the safe ones in place.
Print fix suggestions as unified diffs, or (with `--write`) apply a strict deterministic allowlist of rewrites in place.
Default (no flag): read-only, prints unified diffs. Vulkro does not modify your files: pipe the output to `git apply`, or copy hunks by hand. `--dry-run` previews the `--write` templates without touching any file and prints an "N fixes would apply, M refused" summary to stderr.
`--write` resolves a CLOSED allowlist of templated rewrites and writes them in place ATOMICALLY (temp file + rename). The catalog: cookie Secure / HttpOnly / SameSite flags (JS options object and Python set_cookie kwargs), MD5 / SHA1 -> SHA-256, non-crypto random token -> CSPRNG, removing an explicit CSRF opt-out, parameterizing the narrowest obvious string-built SQL, yaml.load -> yaml.safe_load, hardening dangerous lxml XMLParser flags, removing 'none' from a JWT algorithms list (when another algorithm remains), flipping exact debug=True literals, fixing insecure Django cookie settings, and upgrading http:// to https:// for a short allowlist of major API hosts known to serve TLS. CORS wildcard origins always REFUSE with a pointer to the read-only placeholder diff (the real origin is deployment-specific). Every template re-inspects the actual source line and REFUSES on any ambiguity, multi-byte slice risk, multi-detector collision, or a line that changed since the scan. Refusals are printed with an actionable reason; they are not errors. There is NO LLM in this path: it hard-refuses rather than guess.
Remedies (knowledge base): for SQL injection, command injection, path traversal, open redirect, SSRF, XSS, weak random, insecure cookies, CORS, TLS and JWT verification, mass assignment and missing authentication in JavaScript / TypeScript, Python, Go and Java, `vulkro fix` also prints a remedy per finding (keyed by rule id): a concrete unified diff at the finding when the code shape is recognised (for SQL: the driver's bound-parameter form), otherwise steps and a before / after example.
`--verify` applies the remedy patches to a temporary copy of the project, scans the copy again, and gives each patch a verdict: `fixed` (the finding is gone and no new Medium-or-higher finding appeared in the changed lines), `not-fixed` or `regressed`. Your working tree is never modified by `--verify`, `--bundle` or `--format diff`. `--apply` (implies `--verify`) writes ONLY the `fixed` patches into the working tree.
Exit codes (default / `--verify` / `--bundle` / `--format diff`): 0 always (informational). With `--write`: 0 = nothing needed fixing, 1 = at least one fix applied, 2 = IO failure or only refusals when a write was requested. With `--dry-run`: 0 = no template fix would apply, 1 = at least one would apply (never 2: nothing is written). With `--apply`: 0 = no patch to apply, 1 = at least one verified patch applied, 2 = IO failure, or patches were generated but none verified as fixed.
The optional `--ai` tier (off by default) adds re-scan-validated, advisory AI diffs for findings no deterministic template covers. It NEVER changes the exit codes above: a refused AI fix is a refusal, not an error.
Usage: vulkro fix [OPTIONS] [PATH]
Arguments:
[PATH]
[default: .]
Options:
--kind <KIND>
Limit suggestions to a specific kind (cors-wildcard | debug-on | hardcoded-secret | jwt-verify-disabled)
--offline
Hard-disable every outbound network call for this run (sets VULKRO_OFFLINE=1). Blocks the CVE feed, the license heartbeat, the update check, webhooks, and any cloud AI endpoint; a loopback model (http://127.0.0.1, http://localhost) is still allowed. Equivalent to exporting VULKRO_OFFLINE=1, and the flag wins when both are set
--finding <ID>
Fix only specific findings, by their scan-derived finding id (from `vulkro scan --format json` or the organisation dashboard), or by their stable `finding_id`. Repeatable: `--finding A --finding B`. Alias: `--id`
-q, --quiet
Print only warnings and errors on stderr: no progress, tips or next-step hints. Results on stdout and exit codes are unchanged
--no-color
Turn off coloured output. Colour is also off when NO_COLOR is set to a non-empty value or TERM=dumb
--rule <RULE>
Fix only findings of a rule (for example `js-taint-sql-001`). Repeatable
--verify
Verify every remedy patch: apply the patches to a temporary copy of the project, scan the copy again, and report each patch as `fixed`, `not-fixed` or `regressed`. Never modifies your files
--bundle <PATH>
Write a fix bundle (a `.zip` file, or an empty / new directory) with the verified `fixed` patches (per-finding and combined diffs), the patched files, every remedy as JSON, and a README. Implies `--verify`. Never modifies your files
--apply
Apply the remedy patches that `--verify` proves `fixed` to your working tree (atomic write per file; a file that changed since the scan is skipped). Implies `--verify`. Patches that are `not-fixed` or `regressed` are never applied
-f, --format <FORMAT>
Output format: `text` (unified diffs, default), `json` (a stable machine-applicable schema for agents and MCP consumers: each fix carries the finding id, rule, file:line, explanation, and a `git apply`-ready unified diff), or `diff` (the remedy patches as one unified diff; only the `fixed` ones with `--verify`). With `--write` / `--dry-run` the JSON envelope is bumped to schema_version 2 with additive `applied` / `refused` / `summary` fields. When there are remedies, the JSON gains additive `remedies` and `remedy_summary` fields and schema_version 4
Possible values:
- text
- json
- diff: The knowledge-base patches as one unified diff (only the `fixed` ones with `--verify`), ready for `git apply`
[default: text]
--write
Apply the deterministic templated rewrites in place (atomic temp file + rename). Refused items are reported with a reason. Conflicts with `--dry-run`. Exit code: 0 = nothing to fix, 1 = a fix was applied, 2 = IO failure or only refusals
--dry-run
Preview the deterministic templated rewrites without touching any file, and print an "N would apply, M refused" summary to stderr. Exit code: 0 = nothing would apply, 1 = at least one fix would apply
--ai
[advisory] Turn on the AI fix tier for findings the deterministic templates have no safe rewrite for. The resolved LOCAL model (see `vulkro ai`) proposes a minimal diff, which is then VALIDATED by a double gate: the PRIMARY oracle re-runs the deterministic scanner (the finding must disappear and no new finding may appear), and only then a SECOND, subordinate AI review checks the patch is correct and behaviour-preserving. It is shown as `verified` only if BOTH gates pass, otherwise as `refused` with a reason. The AI review can never turn a re-scan failure into a pass. `--ai` alone is read-only (advisory diffs); `--ai --write` applies ONLY verified AI diffs, each printed first, and only AFTER the deterministic templates run. Every AI diff is labelled advisory / non-deterministic / excluded-from-benchmark and NEVER changes the exit code: a refused AI fix is a refusal, not an error. A loopback model is allowed under VULKRO_OFFLINE; a cloud url is refused offline
--ai-model <MODEL>
AI model tag override for `--ai` (highest precedence). Overrides VULKRO_AI_MODEL, the saved `vulkro ai use` selection, and the smart default. Example: `--ai-model qwen2.5-coder:7b`
--ai-url <URL>
AI runtime base url override for `--ai` (OpenAI-compatible). Example: `--ai-url http://127.0.0.1:11434/v1`. A loopback url is allowed under VULKRO_OFFLINE; a cloud url is refused offline
-h, --help
Print help (see a summary with '-h')