Skip to content

Latest commit

 

History

History
160 lines (125 loc) · 9.52 KB

cryptography.md

File metadata and controls

160 lines (125 loc) · 9.52 KB

Cryptography and post-quantum readiness

This page answers two questions that security reviews ask: which cryptography Agentmetry uses, and what changes when a quantum computer can break today's public-key algorithms. It covers the open-source sensor in this repository in full, and Agentmetry Enterprise at the level a reviewer needs.

Checked on 2026-12-03 against master at 378f52a (0.22.0 plus unreleased changes). The code is the source of truth and this page is not: the commands at the end re-check every row.

Summary

  • Agentmetry implements no cryptographic primitive of its own. Hashing, HMAC and randomness come from Python's hashlib, hmac and secrets. TLS comes from the OpenSSL that the Python runtime links. Enterprise signatures come from pyca cryptography.
  • Every hash is SHA-256. The sensor uses no MD5 and no SHA-1.
  • The open-source sensor uses no public-key cryptography of its own. The one asymmetric algorithm in the product is Ed25519, in Enterprise's opt-in per-host event signing.
  • For post-quantum, the trail's tamper evidence needs no change: it rests on SHA-256 and HMAC-SHA256. Two things would change: Enterprise's Ed25519 signatures and the key exchange inside TLS. The plan, and what starts it, are below.

Open-source sensor

Use Algorithm Where Key or secret Quantum exposure
Trail hash chain (prev_sha256, record_sha256) SHA-256 over canonical JSON core/audit/trail_chain.py none None in practice
Merkle tree and anchor checkpoints (tree_size, root_sha256) SHA-256 with RFC 6962 leaf and node prefixes core/audit/trail_merkle.py, core/audit/trail_anchor.py none None in practice. An external anchor (anchoring.md) carries its operator's own signature, which is theirs to migrate
Tool-argument fingerprint (tool.input_hash) HMAC-SHA256 when AGENTMETRY_HASH_KEY is set, plain SHA-256 otherwise core/audit/hashing.py, hooks/ingest.py the fleet hash key None in practice
Hook spool rows HMAC-SHA256, verified in constant time before replay core/audit/spool.py, hooks/ingest.py the API key or the install's ingest token None in practice
API key and OTel receiver key checks constant-time comparison core/auth.py, core/audit/otel_ingest.py the API key None in practice
Random secrets: ingest token, dashboard login codes and session ids, canary decoy values Python secrets (the operating system's CSPRNG) core/api_token.py, core/dashboard_session.py, core/canary.py n/a None in practice
Dashboard sessions at rest the session id is stored as its SHA-256 core/dashboard_session.py none None in practice
Microsoft Agent Governance Toolkit import verifies AGT's own HMAC-SHA256 row signatures in constant time core/audit/adapters/agt.py AGT's signing secret, supplied by the operator None in practice
Content fingerprints: workspace digest, MCP config and tool-schema fingerprints, evidence packs, trail segments, scanned scripts and wheels, canary rollback records SHA-256 core/audit/hashing.py, core/diagnostics/, core/audit/evidence_pack.py, core/audit/trail_rotation.py, core/scanner/, core/canary.py none None in practice
Event signing extension point none in the core. An extension registers a signer; the signed message is agentmetry-event-v1\n plus the chain's canonical JSON core/audit/signing.py the extension's Depends on the extension (see Enterprise)
TLS to a SIEM, a webhook or the console whatever the runtime's OpenSSL negotiates. Certificate verification is on by default; the Elastic, Splunk and Chronicle sinks let an operator turn it off for a lab core/audit/sinks.py, through httpx none of ours Key exchange breakable: traffic recorded now could be decrypted later
Release integrity PyPI Trusted Publishing from release.yml. PyPI holds Sigstore provenance tying each file to that workflow (checked for the 0.22.0 wheel and source archive) .github/workflows/release.yml none stored: GitHub's OIDC identity Sigstore's algorithms are Sigstore's to migrate

Paths are relative to apps/orchestrator/agentmetry/ unless they start with .github/.

Agentmetry Enterprise

Enterprise is a separate, proprietary product that builds on the sensor's extension points. Its source is not public, so this section describes what it does rather than where.

Use Algorithm Key or secret Quantum exposure
Per-host event signing (opt-in) Ed25519 over the message above, sent beside the event as {"alg": "ed25519", "key_id": ..., "sig": ...} a per-host device key on that host Breakable: a large enough quantum computer could forge a host's signature
Key ids SHA-256 of the raw public key, first 16 hex characters none Identifier only
Console and ingest tokens at rest HMAC-SHA256 keyed by a per-token random salt, over a 32-byte random secret, compared in constant time the token secret None in practice
Console sessions and CSRF 32-byte random tokens. The session id is stored as its SHA-256; CSRF is compared in constant time none None in practice
GitHub webhook receiver HMAC-SHA256 from X-Hub-Signature-256, compared in constant time the webhook secret None in practice

What a quantum computer changes

Hashes and HMACs. Grover's algorithm gives at most a square-root speedup on brute-force search. SHA-256, and HMAC-SHA256 with 32-byte secrets, keep a wide margin after it, and NIST's post-quantum transition does not ask anyone to replace them. The trail's tamper evidence (hash chain, Merkle checkpoints, external anchors) is built on these, so it needs no change.

Ed25519 signatures. Shor's algorithm breaks Ed25519 on a cryptographically relevant quantum computer. Someone with one could forge a host's signature on an event. Nothing confidential is exposed, because a signature carries no secret about the event. What weakens is attribution: proof that a given host sent a stored event, for events kept until such a machine exists. The hash chain and an anchor obtained earlier still show that the trail was not rewritten after the anchor was published.

TLS key exchange. Classical key exchange (X25519, ECDHE) can be broken later from a recording, which is why this risk is called "harvest now, decrypt later". What travels is canonical events: tool names, commands and identities, with tool arguments sent as hashes unless full argument capture is turned on.

How ready this is

Already in place:

  • Signatures travel beside the event with an algorithm tag, so a second algorithm can sit alongside Ed25519 without changing the wire format.
  • The signed message starts with a version prefix (agentmetry-event-v1), so a new scheme can sign a different message without being confused with the old one.
  • The core does no signing itself. Signing is a registered extension, so changing the algorithm does not touch the sensor.

Gaps:

  • Enterprise's key store assumes Ed25519. It accepts 32-byte keys only and verifies only alg: ed25519.
  • The runtimes we measured cannot offer post-quantum key exchange. On 2026-12-03, the Windows Python builds that run the sensor on the maintainer's machine, 3.12.1 and 3.14.3, linked OpenSSL 3.0.11 and 3.0.18. OpenSSL 3.0 has no ML-KEM; ML-KEM, including the hybrid group X25519MLKEM768, arrived in OpenSSL 3.5. Python links the OpenSSL it was built with, so check your own runtime with the command below.

Plan, and what starts it

The migration starts when one of these happens, not before:

  • a customer's security review requires a post-quantum migration plan with dates;
  • signed events go to a tenant that keeps them for years;
  • a hosted console is deployed for a customer.

Steps:

  1. Key store. Record the algorithm with each registered key, check key length per algorithm, and verify by alg. Existing Ed25519 keys stay valid.
  2. Signatures. Add a hybrid scheme, Ed25519 plus ML-DSA (FIPS 204), where both must verify. ML-DSA-44 has a 1,312-byte public key and a 2,420-byte signature, against 32 and 64 bytes for Ed25519, so signing chain checkpoints at an interval, rather than every event, may be the better design: each record_sha256 already binds every earlier event.
  3. TLS. Terminate a hosted console's TLS on a front end that offers X25519MLKEM768, and ship the sensor runtime on a Python build that links OpenSSL 3.5 or later.
  4. This page. Re-run the commands below and update the date and versions.

Re-check commands

From the repository root:

git grep -hoE "hashlib\.(md5|sha1|sha224|sha256|sha384|sha512|new|blake2b|blake2s)" -- apps/orchestrator/agentmetry | Group-Object | Select-Object Count, Name
git grep -nE "hmac\.|secrets\.|from cryptography|import cryptography|verify_tls" -- apps/orchestrator/agentmetry

For the runtime that runs the sensor:

& "<runtime>\Scripts\python.exe" -c "import ssl,sys; print(sys.version.split()[0], ssl.OPENSSL_VERSION)"

For a release's provenance on PyPI, replace the version and file name:

curl.exe -s https://pypi.org/integrity/agentmetry/0.22.0/agentmetry-0.22.0-py3-none-any.whl/provenance

References

Check the current text of each before quoting a date from it.

  • NIST FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA), published in August 2024.
  • NIST IR 8547, the transition timeline for quantum-vulnerable algorithms.
  • The EU coordinated implementation roadmap for the transition to post-quantum cryptography.