Skip to content

Feed guardlink findings into cxg

cxg pentest does not guess what to test. It starts from guardlink’s threat model: the exposures a developer annotated in the code, exported as SARIF, become the hypotheses cxg tries to confirm at runtime. This page covers the basic handoff: what guardlink emits, where cxg reads it, and how to tell it worked.

guardlink exports its findings as SARIF 2.1.0. For cxg, export the pentest profile:

Terminal window
guardlink sarif . --profile pentest -o whitebox/findings.sarif
✓ Wrote SARIF to whitebox/findings.sarif
SARIF: 5 result(s) — 1 error(s), 0 warning(s)
Pentest profile: 1 mitigated exposure(s), 1 boundary claim(s), 2 agent-reach target(s) appended; hypothesis ledger absent

Run against a two-file demo with one open exposure, one mitigated exposure, one directed @boundary, two route-declaring @flows, and one LLM agent tool, using guardlink 2.2.0. The default profile, github, writes only the open exposure: SARIF: 1 result(s).

The file is a standard SARIF document. Its open findings carry guardlink’s rules, guardlink/unmitigated-exposure, guardlink/unmitigated-critical, and guardlink/confirmed-exploitable, each tied to an @exposes annotation, with the asset, threat, and source location the developer recorded. Each such result is a hypothesis: this asset may be exposed to this threat, here. The pentest profile appends what cxg can also use:

Rule What cxg 1.5.0 does with it
guardlink/mitigated-exposure A covered exposure: a hypothesis to test that the @mitigates or @accepts control holds. The result names that control under suppressions. --mitigation-mode mitigated selects only these
guardlink/boundary-claim A declared trust boundary to test, never an exposure. See declared boundaries
guardlink/agent-reach Not modelled. Skipped and counted, never read as mitigated

guardlink 2.2.0 also writes declared context into each result: the @flows chain as codeFlows, the @boundary, @assumes, @handles and @transfers notes on the asset as relatedLocations, and the handler as logicalLocations. cxg 1.5.0 reads those instead of scraping comments near the annotation, so a hypothesis no longer picks up notes declared on a neighbouring handler. An older SARIF without them is read as before.

cxg looks for the file at one fixed path relative to the codebase you pass:

<codebase>/whitebox/findings.sarif

So a run pointed at --codebase ./app reads ./app/whitebox/findings.sarif. Export guardlink’s SARIF to exactly that path, and cxg picks it up with no further flags.

The first lines of a cxg pentest run report what it loaded. From the export above:

[1] guardlink: 2 SARIF hypotheses, 6 inline, 2 endpoints
[1h] @flows: 2 flow edge(s), 2 chainable, 2 declaring a route; 0 not chainable, 0 unreadable
[1] guardlink: skipped 2 result(s) of 1 unmodelled rule(s), none assumed mitigated: guardlink/agent-reach (2)
[1h] guardlink boundary claims: 1 read as boundaries to verify, not as exposures
[1h] guardlink declared context: 2 result(s); chains from codeFlows on 2, typed notes from relatedLocations on 2, a function name on 2. @comment and @validates are still read from source comments.
[1h] guardlink declared boundaries: 1 read from the SARIF graph, 1 with a declared direction, 0 with an inferred outer side, 0 with no direction (undirected, with no side guardlink can infer is outside)
[1i] boundary hypotheses: 2 built from 1 of 1 declared boundary; each is a claim to test, never evidence that a route is safe

Truncated after the guardlink lines; the run goes on to the auth pre-flight.

2 SARIF hypotheses is the open exposure and the mitigated one. The skipped line is the one to read when you upgrade guardlink: a rule cxg does not model, such as guardlink/agent-reach, or one a newer guardlink adds, is set aside and named. Before 1.5.0 such a result became a hypothesis marked mitigated, a clean bill cxg had never earned. If the file is missing or empty you get:

[1] guardlink: 0 SARIF hypotheses, 0 inline, 0 endpoints

and the run exits 1 with no templates to work from. The pipeline has nothing to test. A 0 here almost always means the SARIF was never written to <codebase>/whitebox/findings.sarif, so check that path first.

Route-declaring flows join route discovery

Section titled “Route-declaring flows join route discovery”

A @flows line whose mechanism is a route, such as @flows #client -> #orders via GET./orders/<id>, gives cxg the route for the handler it sits on. The [1h] @flows: line counts them, and names by file and line any flow that cannot chain or could not be read. Add a flow with no via and one with an unspaced arrow to the demo, and the line becomes:

[1h] @flows: 3 flow edge(s), 2 chainable, 2 declaring a route; 1 not chainable, 1 unreadable
not chainable app.py:32 #client -> #orders — no `via` mechanism declared, so there is no channel to chain on
unreadable app.py:33 # @flows #client->#orders via x — not a form the @flows definition accepts (`guardlink validate` names the problem)

With --discover-routes, a route a flow declares is added to the discovered surface when no scanned route already serves it. cxg reads @flows to guardlink’s grammar, so an annotation guardlink rejects is reported as unreadable rather than read differently.

A directed @boundary from #client to #orders says everything past it is protected. For each boundary with a known outside, cxg 1.5.0 builds one auth_api hypothesis per route on the inside, and the probe calls that route with no credential and then as the lowest-privilege identity. In the run above, one boundary produced two hypotheses, one per route into #orders. These rank below every declared threat, and a boundary is never read as evidence that a route is safe. A boundary between two declared assets has no known direction and produces none.

From there the hypotheses are ranked against your --goal, and the ones selected are handed to the AI generator, which reads the source each one points at and writes a probe to test it at runtime. That is where the handoff ends and the pentest pipeline begins. See pentest a web application.

The value of starting from guardlink rather than a generic scan is that every probe traces to a specific, human-recorded exposure in the code, not to a pattern that might match anything. The developer said where the risk is; cxg goes and checks whether it holds.