CoreLayer AI Security logoCoreLayer AI Security

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.

Terminal
secureai scan <target> [flags]

<target> is a file, a directory, or a glob. Directories are walked recursively.

Common uses

Terminal
# 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.html

Flags

FlagDefaultDescription
--configsecureai.config.yamlPath to the config file. See Configuration.
--fail-onnoneExit non-zero when a finding reaches this severity: informational|low|medium|high|critical. Overrides fail_on in the config file.
--formatterminalOutput format: terminal|json|jsonl.
--reportnoneAlso write a full assessment report to this path (.html). See Reports.
--rulesallComma-separated rule IDs to run, overriding the config file.
--no-busoffDo 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.

RuleNameOWASP
R-01Prompt Injection RiskLLM01
R-02Instruction OverrideLLM01
R-03Unsafe Role AssignmentLLM01
R-04Missing Refusal LogicLLM06
R-05Over-Permissive ToolsLLM06
R-06Sensitive Data ExposureLLM02
R-07Unrestricted Output FormatLLM05
R-08Missing Context BoundariesLLM04
R-09Ambiguous Capability ScopeLLM09

Each rule's detection logic and how to fix what it flags is on Scan rules.

Reading the output

Terminal
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:line or file:start-end, so editors and CI annotations can link straight to it.
  • Gate is only printed when --fail-on or a config fail_on is in effect.

Pre-commit hook

Install a git hook so a scan runs before every commit in the current repository:

Terminal
secureai scan install-hook

What 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.