Skip to content

Translate threats into security tests

Turn a threat into a test draft with GuardLink 2.6.0. Translation authors files; executing the reviewed check against an authorized target is a separate step.

  • GuardLink installed and initialized in a repository with an @exposes annotation.
  • For probe authoring, cxg 1.8.0 with its updated pentest pipeline. Translate reads the installed probe guide and refuses if it cannot find it.
  • This capture uses a #idor exposure in server.py; replace the selector with your threat id. No model or target was contacted to capture these prompts.

Ask your current agent to author the check

Section titled “Ask your current agent to author the check”
Terminal window
guardlink translate --stdout --no-code-graph --threat idor --contract scanner
You are a senior offensive security engineer translating GuardLink declared exposures into CERT-X-GEN (CXG) templates.

Truncated after the generation-only instruction. The rest contains the selected threat model, source context, output directory and scanner contract. --stdout launches no author and writes or validates no template. Hand its prompt to the agent already in your session. It refuses combinations with headless, agent, IDE or clipboard launch flags. The MCP equivalent is guardlink_translate, which returns a prompt to its caller.

Scanner is the default contract. Scanner templates send their own requests and report findings; YAML needs an author object with a nonempty name. JavaScript probes instead define async function cxgProbe(cxg) and submit candidates to the engine’s proof rules. They are different execution contracts.

Save this as context.json:

{
"version": 1,
"threats": [
{
"id": "idor",
"route": {"method": "GET", "path": "/notes/42"},
"identity": {
"requirements": ["An entitled owner and an attacker"],
"available": [{"name": "entitled", "role": "owner"}]
},
"output_contract": "probe"
}
]
}

These are authoring premises, not credentials or permission to send traffic. Replace route and profile names with the facts of your application.

Terminal window
guardlink translate --stdout --no-code-graph --context context.json \
--contract probe --threat idor
You are authoring CERT-X-GEN pentest JavaScript probes from GuardLink threats.
Only author files. Never execute templates or send traffic to a target.

Truncated after the generation-only instruction. The prompt includes only matching context rows. You can use an exposure selector such as idor@server.py:3 to select one annotation rather than every exposure of a threat. Unknown or feature-excluded selectors are refused.

Context packs can also carry parameters, payload hints, a success condition, entry-to-sink paths, graph facts, and prior attempts. A previous confirmed or refuted outcome is supplied evidence to investigate, not a new engine verdict. Only authenticated bindings count toward @requires_auth_count; the reserved anonymous binding requests a clean guest. See probe identities.

Without --no-code-graph, optional existing graph facts can supplement the prompt. Translate does not build or install a graph. Inspect context_graph in MCP/headless results and stderr diagnostics for missing or partial facts. An explicit --context pack supplies your chosen context directly.

Convert a scanner check into a probe draft

Section titled “Convert a scanner check into a probe draft”

For an existing scanner file named scanner.py:

Terminal window
guardlink translate --stdout --contract probe --from scanner.py --no-code-graph
You are authoring CERT-X-GEN pentest JavaScript probes from GuardLink threats.
Only author files. Never execute templates or send traffic to a target.

Truncated after the generation-only instruction. --from accepts files or recursively selected scanner directories and requires explicit --contract probe. It passes source text as untrusted authoring input; it does not execute or mechanically convert the scanner.

Preserve the complete source @guardlink_threat reference, including its @file:line suffix, in exactly one probe header. Converted drafts stay under .guardlink/cxg-templates/, including when --out selects a subdirectory. Review the source-to-probe mapping and proof plan. An unsupported proof plan must say why; matching a response body cannot become engine proof by assertion.

For unattended authoring, --headless requires --agent claude, codex or gemini. Results identify the source or threat, its template_dir, changed templates, status and failures. A successful process exit alone is insufficient: GuardLink also checks the provider’s terminal completion and written output. safety_stops is telemetry; read it separately from completion.status. A written draft still has not executed. Prompt-only workflows cannot validate files the external author has not written yet.

Review target scope, identity bindings, capabilities and proof requirements. Scan the selected file for scanner checks; replay reviewed probes for the probe contract. Validation checks syntax and schema; a runtime result establishes what happened. Translation does not record a Bravos ledger verdict or approve a pull request.

The single curated suite is security/ by default. security_tests_dir in .guardlink/config.json selects another repository-relative directory. Keep it outside .bravos/, .guardlink/ and .git/, and run GuardLink sync after changing the setting. No files move automatically. Only deliberately promoted, verified regressions belong there; drafts and run output remain separate.

Run that entire suite with the repository’s configured runner before opening or updating a pull request. Retain useful regressions after a fix removes the original exposure. Report an absent suite as not applicable, and unavailable, skipped or partial execution as incomplete. An existing suite that cannot complete blocks readiness; generation alone cannot satisfy the check.