BUILD: secureai scan
Static analysis for prompts, tool definitions, and templates. It runs offline, and prompt content stays on the machine, so you can use it on every commit.
secureai scan <target> [flags]<target> is a file, a directory, or a glob. Directories are walked recursively.
Common uses
# Scan a directory of prompts
secureai scan ./prompts
# Scan a single file
secureai scan prompts/system_prompt.md
# Fail the command if anything High or worse is found
secureai scan ./prompts --fail-on high
# Machine-readable output for a pipeline
secureai scan ./prompts --format json > findings.json
# Only run the prompt-injection rules
secureai scan ./prompts --rules R-01,R-02,R-03
# Write a full HTML assessment alongside the terminal output
secureai scan ./prompts --report assessment.htmlFlags
| Flag | Default | Description |
|---|---|---|
--config | secureai.config.yaml | Path to the config file. See Configuration. |
--fail-on | none | Exit non-zero when a finding reaches this severity: informational|low|medium|high|critical. Overrides fail_on in the config file. |
--format | terminal | Output format: terminal|json|jsonl. |
--report | none | Also write a full assessment report to this path (.html). See Reports. |
--rules | all | Comma-separated rule IDs to run, overriding the config file. |
--no-bus | off | Do not emit a SecurityEvent to the local Intelligence Bus. |
The report is written before the gate
--report produces its file even when --fail-on trips and the command exits 1. A failing build still leaves you the artefact that explains why.
What it looks for
Nine rules, R-01 through R-09, each mapped to an OWASP LLM Top 10 category.
| Rule | Name | OWASP |
|---|---|---|
R-01 | Prompt Injection Risk | LLM01 |
R-02 | Instruction Override | LLM01 |
R-03 | Unsafe Role Assignment | LLM01 |
R-04 | Missing Refusal Logic | LLM06 |
R-05 | Over-Permissive Tools | LLM06 |
R-06 | Sensitive Data Exposure | LLM02 |
R-07 | Unrestricted Output Format | LLM05 |
R-08 | Missing Context Boundaries | LLM04 |
R-09 | Ambiguous Capability Scope | LLM09 |
Each rule's detection logic and how to fix what it flags is on Scan rules.
Reading the output
BUILD: static risk scan
14 files scanned · 18 findings · score 64/100
CRITICAL R-02 Instruction Override
prompts/system_prompt.md:12-18 · LLM01 Prompt Injection
The prompt contains no precedence rule, so user text asking the
model to ignore prior instructions is honoured.
HIGH R-06 Sensitive Data Exposure
prompts/support.md:31 · LLM02 Sensitive Information Disclosure
gate: fail-on=high → FAILED- Score is out of 100 and higher is safer. It weights findings by severity across the files scanned.
- Location is
file:lineorfile:start-end, so editors and CI annotations can link straight to it. - Gate is only printed when
--fail-onor a configfail_onis in effect.
Pre-commit hook
Install a git hook so a scan runs before every commit in the current repository:
secureai scan install-hookWhat gets scanned
Prompt files (.md, .txt, .prompt), tool and agent configuration (.yaml, .yml, .json), and templates. Files it cannot parse are skipped rather than failing the run.
Nothing leaves the machine
Analysis is local and pattern-based. There is no model call or prompt upload. Only the resulting findings are sent to your dashboard, and --no-upload suppresses even that.