Skip to content

    Type a page, a command such as keryn scan, or a rule id.

    keryn forge scan

    Describes Keryn 0.5.2 and keryn-rules 0.8.0. Changelog

    View as Markdown

    Forge over compiled code: scan a jar, class directory or .NET assembly with every shipped rule (findings, SARIF, gate); facts, KSQL queries, graph export (local only).

    keryn forge scan <jar|class directory|dll>... [--sarif <file>] [--json <file>] [--fail-on error|warning|none] [--accept-missing-deps all|<prefix,...>] [--allow-incomplete]
    Usage: keryn forge capabilities
    keryn forge analyze <path...> [--bundle <bundles.json>...] [--out <bundles.json>]
    keryn forge query <bundles.json> <rule.ksql> [--limits <limits.json>]
    keryn forge dfd <bundles.json>
    keryn forge export <bundles.json>
    keryn forge scan <jar|class directory|dll>... [--sarif <file>] [--json <file>] [--markdown <file>] [--fail-on error|warning|none]
    [--accept-missing-deps all|<prefix,...>] [--partition-prefix <path prefix>] [--engine-json <file>]
    [--allow-incomplete] [--limits <limits.json>] [--timestamp <iso>]
    Forge builds one semantic security graph from fact bundles (source IR, tsc facts, JVM .class/.jar, LLVM .ll) and answers KSQL
    queries over it. Everything runs locally in the vendored keryn-engines wasm; files are read from disk, nothing is uploaded.
    capabilities frontends and features this build has, with their status
    analyze read the files under each <path>, hand them to the frontends and print {bundles, stats, unclaimed}; --bundle adds
    pre-made bundles; --out writes the JSON there (summary on stderr) so 'query' and 'export' can read it
    query run a rule file against the graph rebuilt from the bundles: a keryn.dev/ksql-result/v1 document (verdict per source/sink
    pair: flow, unknown, no_flow; unknown is never clean). --limits takes a JSON file of analysis limits
    dfd the data-flow / authority projection and the trust-canvas document derived from the bundles ({projection, trust_model})
    export the canonical keryn.dev/forge-graph/v1 document (byte-identical across native and wasm)
    scan analyse the compiled inputs and run every shipped rule: each flow is a finding at proof level 3 with its path, written
    through the ordinary report writers. A pair that could not be decided (unknown) is never clean: it is counted in coverage
    with its reason and the run is incomplete, as are a rule cut short, a referenced class that is not among the inputs
    (--accept-missing-deps all treats libraries you left out as outside the program) and an input no frontend reads.
    --partition-prefix org/acme/web/ analyses each class under that prefix (with its inner classes) as its own program
    together with every input outside it, and merges the results: taint cannot pass between two such classes through a
    shared helper. Input names are relative to the directory given. --engine-json writes the engine's own document.
    A .NET assembly needs the full-producer module (vendor/keryn-engines-forge-full). Exit 0 when the gate passes; 1 findings
    at or above --fail-on; 3 incomplete coverage or budget exhaustion; 4 engine failure. --allow-incomplete accepts
    incomplete report coverage. With --exit-warn, a passing gate with warnings or accepted incomplete coverage exits 10.
    Exit 0; 2 usage or caller error (invalid_input, schema_mismatch, parse, type, unsupported); 3 budget_exhausted; 4 internal, cancelled,
    or 'forge exports not built' (this build does not include the Forge engine; use a release build). The error code is printed on stderr as 'keryn: forge: <code>: ...'.
    Terminal window
    # Flows from request values to sinks in the application's own classes, libraries treated as outside it.
    keryn forge scan build/libs/app.jar --accept-missing-deps all --sarif forge.sarif
    Code Meaning
    0 the gate passed, with no finding at or above –fail-on and any incomplete coverage accepted
    1 a flow at or above –fail-on
    2 usage error or an input that cannot be read
    3 incomplete: an unknown pair, a rule cut short, a missing dependency, an unread input (all accepted by –allow-incomplete), or the analysis budget
    4 engine failure, or the forge module is not built
    10 with –exit-warn, the gate passed with warnings or accepted incomplete coverage