Skip to main content

Rule packs

Rule packs are YAML files that teach the source detector which calls and identifiers count as crypto. What you will do: put a file in the right folder, copy an existing rule, scan. Use the field reference below when you need a detail. Hands-on walkthrough: Adding a rule.

Where to put a file

Shipped C / C++ packs (v0.3.0)

For C and C++, match.package is an ecosystem tag (openssl, libsodium, mbedtls, botan). Calls are usually unqualified; the tag does not need an import path. Release binaries ship embedded packs. If you scan from a source checkout, on-disk rules/ wins so edits apply without rebuilding. --rules adds extra directories after the defaults (it does not replace them). See CLI flags.

Annotated example

  • language picks which files this pack applies to.
  • id on each rule must stay stable (SARIF baselines).
  • primitive must be a canonical name, or UNKNOWN.
  • match is how cryptarium finds the site (call or identifier).

How loading works

  1. Find on-disk rules/ by walking up from the working directory, or use the embedded packs.
  2. Skip libraries/ when loading source packs (that file is for deps).
  3. Append any --rules directories.
  4. For each source file, run packs for that language (plus aliases: TS→javascript, cpp→c).
  5. Prefer tree-sitter AST matches; regex fallback forces low confidence.

Library catalog

rules/libraries/catalog.yaml is separate from source packs:
Today the deps detector uses go.mod and entries with ecosystem: go. Presence means “this library is in the graph,” not “this algorithm is used.”
Use high only when the match alone establishes the algorithm and its important parameters.
kind: callFor OpenSSL, libsodium, mbedTLS, and Botan, package is an ecosystem tag. Unqualified C/C++ calls still match.kind: identifier
Some packs write from: keyword. That form is not wired in the matcher yet. Prefer from: argument or omit parameters and keep confidence honest.