vulkro-sf scan
Scans an SFDX project or retrieved metadata folder for security findings across Apex, LWC, Aura, Visualforce, Flow and metadata. The analysis runs on your machine: source, metadata and findings never leave it.
vulkro-sf scan ./force-app
vulkro-sf scan . --format sarif > vulkro-sf.sarif
vulkro-sf scan . --gate-vs origin/main # CI: fail only on new findings
A path inside an SFDX project widens to the project root, because the rest of the project is part of the same deployable unit. Use --subtree to scan exactly the path given. For live-org posture, use the vulkro-sf org commands.
Flags
| Flag | What it does |
|---|---|
[PATH] | SFDX project or retrieved metadata. Default .. |
--format <fmt> | table (default), json, sarif, ocsf (OCSF 1.3.0 events, one per line), or a pull-request format: github-annotations, gh-pr-inline, gh-pr, gitlab-mr, bitbucket-pr, azure-pr (pipe into your SCM, for example | gh pr comment -F -). |
--min-confidence <high|medium|low> | Lowest confidence to report. Default medium. Low-confidence findings stay out of the output and the exit code; SARIF keeps them as suppressed results. |
--gate-vs <ref> | Scan the project again at a git ref and exit 1 only on findings new since then. Also set by VULKRO_SF_GATE_BASE. Needs vulkro-sf 0.27.3 or later. |
--metadata-only | Scan metadata only, for folders or org snapshots with no Apex. |
--subtree | Scan exactly PATH, not the whole project. |
--no-suppress | Ignore // vulkro:disable annotations and report everything. Same as VULKRO_NO_SUPPRESS=1. |
--org <alias> | Read the live org (through your sf login) to grade attack paths by who really holds each grant. Findings are unchanged; paths are raised or lowered one severity step. |
--post-to <target> | After the scan, post a summary to slack=<url>, teams=<url>, jira=<KEY>, pagerduty or saved. Repeatable. Never changes the exit code. |
--include-pmd, --include-eslint, --include-retirejs | Also run that locally installed tool with a bundled security-only config and merge its findings. Off by default. |
--ai-explain | Add an advisory note on why each finding matters for the security review. See below. |
--ai-code-segregation | Report which findings landed on files marked as AI-generated, per tool. Marker-based; calls no model. |
Environment variables (detector switches, notification credentials, the rules bundle) are listed by vulkro-sf env scan.
Suppressing a finding
Put an annotation on or above the line (use <!-- ... --> in XML and HTML):
// vulkro:disable next-line <rule-id>
// vulkro:disable-line <rule-id>
// vulkro:disable-file <rule-id>
Run with --no-suppress in CI to see what the annotations hide.
AI notes (--ai-explain)
After the scan, the local model set up with vulkro-sf ai writes a plain-language note on why each candidate finding (CRUD and FLS, SOQL injection, sharing, Flow system mode, and findings with unknown reachability) matters for the AgentExchange (formerly AppExchange) Security Review.
--format jsonadds anai_advisoryobject to annotated findings.--format tableprints the notes to stderr; stdout is unchanged.- SARIF and the pull-request formats ignore the flag.
Findings, severities and the exit code never change. --ai-model and --ai-url override the model for one run; --no-ai turns it off. The flag is ignored with --gate-vs and --metadata-only.
Exit codes
| Code | Meaning |
|---|---|
0 | No findings at or above --min-confidence. |
1 | Findings reported, or no active trial or Pro (license_required). |
2 | Error. |
Inside a git hook, a machine without a licence is not refused: the hook prints one notice and lets the commit through.
See also: antipatterns, appexchange-report, SARIF output
Command reference
Generated from vulkro-sf scan --help (vulkro-sf 0.33.0). Run scripts/gen-docs.sh in the product repository to refresh it; do not edit this section by hand.
Scan a Salesforce project (SFDX source or retrieved metadata) for security findings.
vulkro-sf scan [OPTIONS] [PATH]
Arguments
| Argument | Description |
|---|---|
[PATH] | Path to the SFDX project or retrieved metadata (defaults to the current directory) Default: .. |
Options
| Flag | Description |
|---|---|
-f, --format <FORMAT> | Output format. Reports: table, json, sarif, ocsf (OCSF 1.3.0 Detection Finding events, one JSON object per line, for a Security Mesh, a SIEM or a security data lake). PR / MR decoration (pipe into your SCM, e.g. | gh pr comment -F -): github-annotations, gh-pr-inline, gh-pr, gitlab-mr, bitbucket-pr, azure-pr. Under --gate-vs, the github-annotations and gh-pr-inline formats post only the new findings; the gh-pr / gitlab-mr / bitbucket-pr / azure-pr summary formats are full-scan only. The PR / MR formats are Pro (capability pr-comments, the same capability vulkro gates these renderers on). Exit codes are unchanged by the format: 0 = no findings, 1 = findings, 2 = error. Default: table. |
--min-confidence <LEVEL> | Minimum confidence to report: high, medium (the default) or low. The default is the same view vulkro scan shows: Low-confidence findings (weak single-signal matches, heuristic shapes the engine could not confirm, development-only dependency CVEs) are left out of the table, JSON and PR formats and out of the exit code, and SARIF keeps them as suppressed results. Pass --min-confidence low to report everything, Low included; high is the strictest report. Applies to --gate-vs (to the new findings) and --metadata-only too. Exit codes count only what the floor shows: 0 = none shown, 1 = findings shown, 2 = error. Possible values: high, medium, low. |
--metadata-only | Scan only Salesforce metadata (Apex source not required). Reaches folders or a retrieved org snapshot that hold metadata but no Apex (the console-only, no-version-control case) |
--no-suppress | Disable the in-source // vulkro:disable annotation filter. Equivalent to setting VULKRO_NO_SUPPRESS=1. Use this in CI to verify what would otherwise be hidden by annotations. |
--subtree | Scan exactly the path given, even when it sits inside an SFDX project. By default a path below an sfdx-project.json widens to that project root, because the Apex, LWC and metadata outside the path are part of the same deployable unit and a health score over a fraction of the project does not describe the project. With --subtree the score line says which subtree it covers. Exit codes are unchanged: 0 = no findings, 1 = findings, 2 = error. |
--gate-vs <GATE_VS> | Compare findings against a baseline scan of the same paths at the given git ref and exit non-zero only on findings that are new vs the baseline: the diff-scoped CI gate, capability sf-presubmit. The ref must resolve via git rev-parse <ref> (a branch, tag, or commit SHA). Composes with --format and --metadata-only. Overrides the VULKRO_SF_GATE_BASE env var, which turns on the same gate. Inside a git hook (the pre-commit hook vulkro-sf init writes) a machine without a licence is not refused: the hook checks nothing and one line says so. For what a metadata change grants and to whom (access changes), run vulkro-sf review --range <ref>...HEAD |
--post-to <TARGET> | After the scan, post a privacy-safe summary of the findings. Repeat the flag for several targets. Recognised values: |
--include-pmd | Also run the wrapper for the platform's own Apex code analyzer and merge its findings into the report. Shells out to your locally installed pmd binary with a bundled security-only Apex ruleset. Off by default so a plain scan is self-contained and shells out to nothing. |
--include-eslint | Also run the ESLint wrapper over LWC and Aura JavaScript and merge its findings into the report. Shells out to your locally installed eslint with a bundled security-only config. Off by default so a plain scan is self-contained and shells out to nothing. |
--include-retirejs | Also run the RetireJS wrapper over static resources, LWC and Aura JavaScript and merge its findings into the report. This is the one wrapper with no native equivalent: the SCA path matches lockfile entries, and a managed package's vendored jQuery or Angular copy appears in no manifest. |
--ai-code-segregation | Emit an AI-code segregation report alongside the normal scan output: which findings landed on AI-authored files, broken down per tool. Marker-based only: a file counts as AI-authored when a comment or header carries an explicit tool marker (Claude / Copilot / Cursor / Aider / ChatGPT, or a generic "AI-generated" annotation). Code style is never guessed. Covers Apex classes and triggers plus LWC and Aura component JavaScript. Rendered as markdown to stderr after the scan; stdout and the exit code are unchanged (0 = no findings, 1 = findings reported, 2 = error) |
--ai-explain | Advisory AI overlay: after the deterministic scan, ask the local AI layer to explain, in plain Salesforce language, why the candidate findings matter for an AppExchange Security Review. OPT-IN and ADDITIVE. The deterministic findings, their severities, SARIF, the --gate-vs gate, and the exit code are unchanged; --format json gains an additive per-finding ai_advisory object only where an advisory was produced, and the table format prints the narratives to stderr so stdout stays byte-identical. Requires vulkro-sf ai setup. A loopback model runs even under VULKRO_OFFLINE; a cloud endpoint is refused offline. Ignored with --gate-vs / --metadata-only |
--ai-model <MODEL> | AI model tag override for --ai-explain (highest precedence) |
--ai-url <URL> | AI runtime base url override for --ai-explain (OpenAI-compatible). A loopback url is allowed under VULKRO_OFFLINE; a cloud url is refused offline. |
--no-ai | Disable the AI layer for this run even if --ai-explain is passed (deterministic scan only) |
-t, --target-org <ALIAS> | Salesforce org alias or username to fuse into the attack-path graph, read-only through your own sf CLI login (capability sf-live-org, like every live-org command). The org answers who really holds each profile / permission set the graph's paths rest on (and org-wide: ModifyAllData, ViewAllData, API Enabled, Use Any API Client, Approve Uninstalled Connected Apps, AuthorApex, CustomizeApplication), OAuth token use and refresh-token age per connected app / External Client App, and how many records a public site's guest user still owns (a COUNT() only). It reads user, permission and OAuth token rows, never a business record. A path nobody holds is lowered one severity step; a path whose grant is widely held, whose guest owns records or whose app is in use is raised one step. Findings are unchanged; the JSON gains attack_graph.live, paths[].live and live-graded edges. With VULKRO_SF_GUEST_EXPLOIT=1 the guest-exploit fusion also reads the org's live guest grants. Refused under --offline / VULKRO_OFFLINE. Omit for a source-only scan. Applies to the full scan (not --gate-vs or --metadata-only). Exit codes are unchanged: 0 = no findings, 1 = findings, 2 = error (including a missing sf CLI or the air-gap switch). An org the CLI cannot reach is a stderr warning and a source-only graph, never an exit code change. |
--no-timestamp | Pin the clock fields of the output (scanned_at) to the Unix epoch, so two scans of the same tree are byte-identical: for cache keys and baseline diffs. Same as VULKRO_DETERMINISTIC=1 |
--force | Scan even when the path holds no Salesforce source or metadata (no sfdx-project.json, Apex, LWC, Aura, Flow, Visualforce or -meta.xml file). Without it such a path is refused with exit 2, because the Salesforce product would otherwise report a non-Salesforce tree with general rules; use vulkro scan there. |
-v, --verbose... | Bump stderr log verbosity. -v enables debug-level tracing for the vulkro + vulkro_sf targets; -vv enables trace. Honoured only when RUST_LOG is unset (an explicit RUST_LOG always wins) |
-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. |
-h, --help | Print help (see a summary with '-h') |
Full vulkro-sf scan --help
Scan a Salesforce project (SFDX source or retrieved metadata) for security findings.
Scan an SFDX project or retrieved metadata folder for security findings.
Exit codes: 0 = success, no findings; 1 = findings reported; 2 = error. "Findings" means the findings at or above `--min-confidence`, so a scan whose only findings are Low confidence exits 0 by default, exactly as `vulkro scan` does.
Confidence floor: by default the report shows findings at Medium confidence or above, the same default view as `vulkro scan` and the desktop console. Low-confidence findings are left out of the table, JSON and the PR formats and do not count toward the exit code; SARIF keeps them as suppressed results, and the console keeps them one control away. `--min-confidence low` reports everything.
Source-annotation suppressions: by default, a finding whose line carries `// vulkro:disable next-line <rule-id>`, `// vulkro:disable-line <rule-id>`, or `// vulkro:disable-file <rule-id>` (and the `<!-- ... -->` form for XML / HTML / `*-meta.xml`) is dropped from the displayed report. Use `--no-suppress` (or set `VULKRO_NO_SUPPRESS=1`) to keep every finding, which is the right setting for CI lanes that need to confirm what the annotations are hiding. With `--gate-vs <ref>` the command runs a second scan against the project tree at the given git ref, diffs the two finding sets by `(file, line, signal)`, and exits 1 only when the working tree surfaces findings that are NOT present in the baseline. This is the "fail on new findings only" CI gate: pre-existing findings on the baseline keep the exit code at 0 so the gate never blocks a PR on technical debt the author did not introduce (capability `sf-presubmit`). Every scan needs a licence: without one it refuses with exit 1 and `vulkro: license_required`, except inside a git hook (recognised by `VULKRO_GIT_HOOK`, or by the `GIT_INDEX_FILE` git exports to every commit hook), where it checks nothing, prints one notice and lets the commit through. The pull-request and annotation formats are capability `pr-comments`.
Environment variables (detector switches, the org context, the `--post-to` credentials, the legacy detector gates and the rules bundle) are listed by `vulkro-sf env scan` (also `vulkro-sf help env`).
Usage: vulkro-sf scan [OPTIONS] [PATH]
Arguments:
[PATH]
Path to the SFDX project or retrieved metadata (defaults to the current directory)
[default: .]
Options:
-f, --format <FORMAT>
Output format. Reports: table, json, sarif, ocsf (OCSF 1.3.0 Detection Finding events, one JSON object per line, for a Security Mesh, a SIEM or a security data lake). PR / MR decoration (pipe into your SCM, e.g. `| gh pr comment -F -`): github-annotations, gh-pr-inline, gh-pr, gitlab-mr, bitbucket-pr, azure-pr. Under `--gate-vs`, the github-annotations and gh-pr-inline formats post only the new findings; the gh-pr / gitlab-mr / bitbucket-pr / azure-pr summary formats are full-scan only. The PR / MR formats are Pro (capability `pr-comments`, the same capability `vulkro` gates these renderers on). Exit codes are unchanged by the format: 0 = no findings, 1 = findings, 2 = error
[default: table]
--min-confidence <LEVEL>
Minimum confidence to report: `high`, `medium` (the default) or `low`. The default is the same view `vulkro scan` shows: Low-confidence findings (weak single-signal matches, heuristic shapes the engine could not confirm, development-only dependency CVEs) are left out of the table, JSON and PR formats and out of the exit code, and SARIF keeps them as suppressed results. Pass `--min-confidence low` to report everything, Low included; `high` is the strictest report. Applies to `--gate-vs` (to the new findings) and `--metadata-only` too. Exit codes count only what the floor shows: 0 = none shown, 1 = findings shown, 2 = error
[possible values: high, medium, low]
--metadata-only
Scan only Salesforce metadata (Apex source not required). Reaches folders or a retrieved org snapshot that hold metadata but no Apex (the console-only, no-version-control case)
--no-suppress
Disable the in-source `// vulkro:disable` annotation filter. Equivalent to setting `VULKRO_NO_SUPPRESS=1`. Use this in CI to verify what would otherwise be hidden by annotations
--subtree
Scan exactly the path given, even when it sits inside an SFDX project. By default a path below an `sfdx-project.json` widens to that project root, because the Apex, LWC and metadata outside the path are part of the same deployable unit and a health score over a fraction of the project does not describe the project. With `--subtree` the score line says which subtree it covers. Exit codes are unchanged: 0 = no findings, 1 = findings, 2 = error
--gate-vs <GATE_VS>
Compare findings against a baseline scan of the same paths at the given git ref and exit non-zero only on findings that are new vs the baseline: the diff-scoped CI gate, capability `sf-presubmit`. The ref must resolve via `git rev-parse <ref>` (a branch, tag, or commit SHA). Composes with `--format` and `--metadata-only`. Overrides the `VULKRO_SF_GATE_BASE` env var, which turns on the same gate. Inside a git hook (the pre-commit hook `vulkro-sf init` writes) a machine without a licence is not refused: the hook checks nothing and one line says so. For what a metadata change grants and to whom (access changes), run `vulkro-sf review --range <ref>...HEAD`
--post-to <TARGET>
After the scan, post a privacy-safe summary of the findings. Repeat the flag for several targets. Recognised values:
--post-to slack=<webhook-url> (or VULKRO_SF_SLACK_WEBHOOK) --post-to teams=<webhook-url> (or VULKRO_SF_TEAMS_WEBHOOK) --post-to jira=<PROJECT_KEY> (+ VULKRO_SF_JIRA_BASE_URL / _EMAIL / _TOKEN env vars) --post-to pagerduty (VULKRO_SF_PD_ROUTING_KEY) --post-to saved every target saved in the console (Settings > Notifications)
Each value falls back to the console's saved settings (~/.vulkro/sf-notify.json) when neither the flag nor the env var gives it. Jira files one issue per Critical finding and skips a finding that already has an open issue (labelled vulkro-fp-<fingerprint>). The payload holds only severity counts, signal IDs, relative paths, line numbers and short messages. A notification failure is a stderr warning and never changes the exit code (0 = no findings, 1 = findings, 2 = error). Env variables: `vulkro-sf env notify`.
--include-pmd
Also run the wrapper for the platform's own Apex code analyzer and merge its findings into the report. Shells out to your locally installed `pmd` binary with a bundled security-only Apex ruleset. Off by default so a plain scan is self-contained and shells out to nothing.
Analyzer discovery order: the `VULKRO_PMD_BIN` env var (absolute path to the binary) wins; otherwise the first `pmd` on PATH is used. If neither resolves, the scan prints an actionable warning naming what is missing and how to install it, then continues with the native detectors (exit code unchanged: 0 = no findings, 1 = findings reported, 2 = scan error).
--include-eslint
Also run the ESLint wrapper over LWC and Aura JavaScript and merge its findings into the report. Shells out to your locally installed `eslint` with a bundled security-only config. Off by default so a plain scan is self-contained and shells out to nothing.
ESLint discovery order: the `VULKRO_ESLINT_BIN` env var (absolute path to the binary) wins; otherwise the first `eslint` on PATH is used. If neither resolves, the scan prints an actionable warning naming what is missing and how to install it, then continues with the native detectors (exit code unchanged: 0 = no findings, 1 = findings reported, 2 = scan error).
--include-retirejs
Also run the RetireJS wrapper over static resources, LWC and Aura JavaScript and merge its findings into the report. This is the one wrapper with no native equivalent: the SCA path matches lockfile entries, and a managed package's vendored jQuery or Angular copy appears in no manifest.
RetireJS discovery order: the `VULKRO_RETIREJS_BIN` env var (absolute path to the binary) wins; then `retire` on PATH; then `npx retire`. If none resolve, the scan prints an actionable warning naming what is missing and how to install it, then continues with the native detectors (exit code unchanged: 0 = no findings, 1 = findings reported, 2 = scan error).
--ai-code-segregation
Emit an AI-code segregation report alongside the normal scan output: which findings landed on AI-authored files, broken down per tool. Marker-based only: a file counts as AI-authored when a comment or header carries an explicit tool marker (Claude / Copilot / Cursor / Aider / ChatGPT, or a generic "AI-generated" annotation). Code style is never guessed. Covers Apex classes and triggers plus LWC and Aura component JavaScript. Rendered as markdown to stderr after the scan; stdout and the exit code are unchanged (0 = no findings, 1 = findings reported, 2 = error)
--ai-explain
Advisory AI overlay: after the deterministic scan, ask the local AI layer to explain, in plain Salesforce language, why the candidate findings matter for an AppExchange Security Review. OPT-IN and ADDITIVE. The deterministic findings, their severities, SARIF, the `--gate-vs` gate, and the exit code are unchanged; `--format json` gains an additive per-finding `ai_advisory` object only where an advisory was produced, and the table format prints the narratives to stderr so stdout stays byte-identical. Requires `vulkro-sf ai setup`. A loopback model runs even under VULKRO_OFFLINE; a cloud endpoint is refused offline. Ignored with `--gate-vs` / `--metadata-only`
--ai-model <MODEL>
AI model tag override for `--ai-explain` (highest precedence)
--ai-url <URL>
AI runtime base url override for `--ai-explain` (OpenAI-compatible). A loopback url is allowed under VULKRO_OFFLINE; a cloud url is refused offline
--no-ai
Disable the AI layer for this run even if `--ai-explain` is passed (deterministic scan only)
-t, --target-org <ALIAS>
Salesforce org alias or username to fuse into the attack-path graph, read-only through your own `sf` CLI login (capability `sf-live-org`, like every live-org command). The org answers who really holds each profile / permission set the graph's paths rest on (and org-wide: ModifyAllData, ViewAllData, API Enabled, Use Any API Client, Approve Uninstalled Connected Apps, AuthorApex, CustomizeApplication), OAuth token use and refresh-token age per connected app / External Client App, and how many records a public site's guest user still owns (a COUNT() only). It reads user, permission and OAuth token rows, never a business record. A path nobody holds is lowered one severity step; a path whose grant is widely held, whose guest owns records or whose app is in use is raised one step. Findings are unchanged; the JSON gains `attack_graph.live`, `paths[].live` and `live`-graded edges. With `VULKRO_SF_GUEST_EXPLOIT=1` the guest-exploit fusion also reads the org's live guest grants. Refused under `--offline` / VULKRO_OFFLINE. Omit for a source-only scan. Applies to the full scan (not `--gate-vs` or `--metadata-only`). Exit codes are unchanged: 0 = no findings, 1 = findings, 2 = error (including a missing `sf` CLI or the air-gap switch). An org the CLI cannot reach is a stderr warning and a source-only graph, never an exit code change
--no-timestamp
Pin the clock fields of the output (`scanned_at`) to the Unix epoch, so two scans of the same tree are byte-identical: for cache keys and baseline diffs. Same as `VULKRO_DETERMINISTIC=1`
--force
Scan even when the path holds no Salesforce source or metadata (no `sfdx-project.json`, Apex, LWC, Aura, Flow, Visualforce or `-meta.xml` file). Without it such a path is refused with exit 2, because the Salesforce product would otherwise report a non-Salesforce tree with general rules; use `vulkro scan` there
-v, --verbose...
Bump stderr log verbosity. `-v` enables debug-level tracing for the `vulkro` + `vulkro_sf` targets; `-vv` enables trace. Honoured only when `RUST_LOG` is unset (an explicit `RUST_LOG` always wins)
-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
-h, --help
Print help (see a summary with '-h')