feat(cpp): C/C++ ground-truth sample for cpp_ast #1

Merged
amiryahaya merged 39 commits from cpp-sample into main 2026-10-25 08:13:57 +01:00
Owner

C/C++ ground-truth sample for the cpp_ast scanner

Adds cpp/: a ground-truth sample for Triton's cpp_ast crypto scanner (Triton PR #1347), in the same shape as the Kotlin, Swift and Dart samples. It has per-library fixtures (OpenSSL, libsodium, Botan, Crypto++, Mbed TLS, wolfSSL and others), construct fixtures and decoys, Windows CNG and Apple CommonCrypto platform fixtures, project/build-system fixtures with real version pins, a catalogue of expected findings, and a compare-scan that checks a real Triton CLI scan against the expected findings. A hardened Docker/Compose build and test setup is included.

Verified

  • make check: rc 0, 262 node tests.
  • make test: ctest 6/6 under docker (also podman) with Compose hardening (test service adds only SETUID/SETGID).
  • compare-scan, standard and comprehensive profiles: 4252 expected = 4252 reported, exact (203 files), 0 missing / extra / skipped. Two findings the scan reports outside the sample are ignored by design.

Known gaps and open items

  • Scanner behaviour gaps found by the fixtures are documented in the sample and filed as triton #1356 (correlator, casts, false positives), #1357 (--path adds to default targets, default excludes cannot be cleared), #1355 (substring excludes) and #1352 (status policy).
  • Not yet done: re-measuring timings on an idle host. The README labels the numbers measured under load. The self-test budget default is 600 s because the 0.15 CPU case failed under load.
  • The checked-in .superpowers ledger is git-ignored and not part of this PR.

Merge note

Please squash-merge. Intermediate commits are not all green: make test is red from 71f9b27 to 6952756, and fad3da0 and 90a7cf5 fail node --test. The final tree is green.

🤖 Generated with Claude Code

## C/C++ ground-truth sample for the `cpp_ast` scanner Adds `cpp/`: a ground-truth sample for Triton's `cpp_ast` crypto scanner (Triton PR #1347), in the same shape as the Kotlin, Swift and Dart samples. It has per-library fixtures (OpenSSL, libsodium, Botan, Crypto++, Mbed TLS, wolfSSL and others), construct fixtures and decoys, Windows CNG and Apple CommonCrypto platform fixtures, project/build-system fixtures with real version pins, a catalogue of expected findings, and a `compare-scan` that checks a real Triton CLI scan against the expected findings. A hardened Docker/Compose build and test setup is included. ### Verified - `make check`: rc 0, 262 node tests. - `make test`: ctest 6/6 under docker (also podman) with Compose hardening (test service adds only SETUID/SETGID). - `compare-scan`, standard and comprehensive profiles: 4252 expected = 4252 reported, exact (203 files), 0 missing / extra / skipped. Two findings the scan reports outside the sample are ignored by design. ### Known gaps and open items - Scanner behaviour gaps found by the fixtures are documented in the sample and filed as triton #1356 (correlator, casts, false positives), #1357 (`--path` adds to default targets, default excludes cannot be cleared), #1355 (substring excludes) and #1352 (status policy). - Not yet done: re-measuring timings on an idle host. The README labels the numbers measured under load. The self-test budget default is 600 s because the 0.15 CPU case failed under load. - The checked-in `.superpowers` ledger is git-ignored and not part of this PR. ### Merge note Please **squash-merge**. Intermediate commits are not all green: `make test` is red from 71f9b27 to 6952756, and fad3da0 and 90a7cf5 fail `node --test`. The final tree is green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A small HTTP/1.1 server in C++17 over POSIX sockets (no third-party HTTP
library): GET /health, a handler table, a strict bounded request parser
(64 KiB body limit for Content-Length and chunked bodies, overflow-safe
chunk sizes, conflicting framing refused, Expect 100-continue), read and
write deadlines, a 2-running/16-waiting call limiter and a forked child
per bounded call killed past its 20 s deadline. Unit and socket-level
integration tests run with ctest in the builder image; the runtime image
is FROM scratch with one static binary, non-root and read-only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Round the time left up to whole milliseconds (deadline.h) for every
poll/deadline decision in run_isolated and the server, so a call can no
longer be reported timed out up to 1 ms early. serve_main's signal waiter
is woken and joined on every exit path (run_until_signal), and
Server::run joins its workers if one cannot be created. The garbage and
limiter integration cases run concurrently / with short sleeps (76 s to
10 s). README: deliberate 405/400 cases, the slow-connection limit, pin
bumps and the fork-safety assumption.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The C/C++ catalogue (src/catalogue/*.json, 11 families, 1,063 algorithms, 4,091
implementations: 4,055 registry, 36 gap, 76 derived) generated from
scripts/catalogue/*.mjs and the drafted per-key tables in scripts/catalogue/tables/,
covering 4,041 of the 4,554 verified cpp_ast registry keys across OpenSSL (and its
compatible spellings, scan-only), libsodium, Crypto++, Botan, Mbed TLS (legacy and
PSA), liboqs and Qt (scan-only), tiny-AES-c/micro-ecc/PicoSHA2 (vendored), and the
Windows CNG/CAPI and CommonCrypto platform paths.

check-catalogue-keys checks every key against the scanner's verified snapshot
(runnable keys against the image's library builds, derived ranges, gap kinds, no
unverified keys) and, with Go, runs every implementation alone through the real
cpp_ast module (scripts/go-parity/parse-probe plus a scanner hook compiled in with
go run -overlay; nothing is written to the Triton tree). make check gains
test-scripts, check-catalogue and check-catalogue-keys; without Go or a scanner
checkout the scanner-backed parts print SKIPPED and pass.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- OpenSSL EVP constructors, fetches and by-name lookups of single DES, DESX,
  RC2, RC4, Blowfish, CAST5, SEED, MD4 and Whirlpool need the legacy provider,
  which the static image lacks: a data-driven rule (LEGACY_PROVIDER) moves
  them to scan-only (117 implementations) and checkSnapshot plus a schema test
  fail on any runnable one; the low-level DES_/RC4/MD4_/BF_ APIs stay runnable.
- Every implementation carries its parameter declarations, generated from the
  call and a context table (shared/context.mjs); the probe scans include,
  prelude, the declarations and the call exactly as shipped, runtime names
  are parameters (an initialised constant would be propagated), and the
  declarations' own findings are asserted as paramReports.
- Storage gaps split per API with their documented algorithms (SQLCipher
  AES-256-CBC, DPAPI AES-256, keychain AES-256-GCM, all SAFE); a test keeps
  one rating per algorithm name.
- Regenerated against scanner 3241eeeb (HashSLH-DSA statuses, Camellia-*
  spelling); apple fixtures are C++; rating notes (#1352, pre-standard PQC)
  and clean-export sign-off guidance documented.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The engine (src/engine: JSON, the build-time embedded catalogue and vectors,
the implementation shapes, registration checks, run/verify and the self-test
summary), the algorithm routes (GET /algorithms[/{id}], POST run and verify
as bounded calls, GET /selftest fanning out one bounded call per entry
through a new BoundedRunner hook of the HTTP server), and
scripts/gen-families.mjs: one function per runnable implementation with the
catalogue call verbatim on its own line, glue and registration after it,
scan-only files, the family index. check-families.mjs scans the shipped tree
with the real cpp_ast module. The catalogue probe now scans the shipped
function shape; catalogue: the four stitched EVP_aes_*_cbc_hmac_* ciphers
scan-only by rule, Crypto++ class headers and kdf.h/hmac.h/cmac.h includes,
argon2i's own limits in its crypto_pwhash call. C++20 for the family files,
the pinned library packages, static linking (runtime stays FROM scratch).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
src/vendor-libs/picosha2: picosha2.h and LICENSE copied unchanged from the
v1.0.1 tag archive (commit, archive sha256 and per-file sha256 in
VENDORED.md); scripts/fetch-vendored.mjs checks the copies offline (make
check-vendored) and re-fetches and verifies them (make fetch-vendored).
No repository-only file is copied, so the scanner treats exactly the library
file as vendored.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The adapters (scripts/families/{hashing,mac,kdf,rng,pki}.mjs) and the
generated family and scan-only files: all 570 runnable implementations of
these families across OpenSSL (EVP, fetch, by-name, legacy low-level),
libsodium, Crypto++, Botan 3, Mbed TLS (legacy and PSA) and PicoSHA2, each
verified against an independent known-answer vector (src/vectors/vectors.json
from scripts/vectors/gen-vectors.py: hashlib, pycryptodome, argon2-cffi,
bcrypt, gostcrypto, pyskein, the openssl CLI, pure-Python references
self-checked against published vectors, a pure-Python GOST R 34.11-94
checked against RFC 5831) or a round trip; 9 are NOT-RUNNABLE because the
image's library build lacks the algorithm their call configures (listed with
reasons). The family tests exercise every runnable implementation; the
self-test does the same through the HTTP API.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A prefix vector (an extendable output) accepts a shorter output of at least
16 bytes and never a short one or a mismatch.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The self-test is a fan-out route: the server runs one at a time (another is
503 at once) and only fan-out routes get the bounded-call runner, which now
caps a call's deadline by the caller's remaining budget; WORKERS must leave
room for the fan-out, so /health always finds a worker. The self-test has an
overall budget (SELFTEST_BUDGET_MS, default 120 s) and lists the entries it
did not verify (incomplete: RESULT: FAILED). The JSON reader rejects
duplicate members and invalid UTF-8. check-catalogue and check-families
generate into a temporary directory and compare with the working tree, so a
hand edit, a missing or an extra file fails. kdf-argon2i#2 uses literal
limits. Vectors: pycryptodome is the primary reference wherever it has the
algorithm, hashlib cross-checks, the hashlib-only records are listed. The
vendored fetch falls back to the pinned commit archive.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Family adapters now declare compileOptions (with a required note); the
generator writes src/families/families.cmake and CMakeLists includes it,
replacing hand-maintained -Wno lists. A declared object later freed by the
call renders in statement form. tiny-AES-c and micro-ecc are pinned by
commit and archive sha256 in fetch-vendored.mjs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every runnable symmetric implementation encrypts (or decrypts/unwraps) a fixed
input and is compared with a known-answer vector: pycryptodome where it has
the cipher and mode, else pure-Python ciphers (ARIA, Camellia, SEED, SM4, IDEA,
Serpent, Twofish, MARS, RC5, RC6, CAST-256, SKIPJACK, TEA, XTEA, SHACAL-2)
self-checked against their specifications' vectors, under pure-Python modes
checked against pycryptodome, pyca/cryptography and RFC vectors. 1272 pass;
2 NOT-RUNNABLE with real reasons (PSA XTS absent; libsodium AES-256-GCM needs
x86 AES-NI, accepted as CPU-dependent).

Engine: a cipher known-answer shape; a null in an implementation's record
removes the entry's field. Generator: nested-type declarations (Mode<T>::
Encryption x) hand their object on. check-families: a sized key is expected
once per key size. Catalogue: Crypto++ cipher/mode headers, SEED's encrypt
flag (no SEED_ENCRYPT exists), Camellia_ctr128's unsigned counter, valid
key lengths/modes for three mbedtls_cipher_info_from_values calls.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every runnable asymmetric implementation is checked against fixed public test
keys: known answers where the operation is deterministic (RSA PKCS#1 v1.5 and
X9.31, raw RSA, RFC 6979 ECDSA/DSA, EdDSA, X25519/X448/ECDH/DH secrets,
crypto_box, ristretto255 and Ed25519 multiples), references accepted and
changed inputs rejected where it verifies or decrypts, and keys generated
through what a call selects checked for type, curve OID and size plus a
signature or agreement round trip. References: pycryptodome, pyca
cryptography (secp256k1, brainpool), RFC 7919 ffdhe2048, pure-Python SM2 and
Ed25519 arithmetic, RFC 9496, micro-ecc's documented RFC 6979 variant;
cross-checked with Node. 679 pass, 11 NOT-RUNNABLE with real reasons (PSA DSA
and EdDSA, RSA-alt and RSASSA-PSS pk types, EVP_PKEY_RSA2).

Engine: a record's "keys" names a shared key record. Generator:
direct-initialised declarations hand their object on; Verdict and to_hex in
the glue prelude. Catalogue: Botan DL/EC key constructors take
(AlgorithmIdentifier, key bits); Crypto++ asymmetric headers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The PQC family's adapters (scripts/families/pqc.mjs, _pqc_botan.mjs, _pqc_mbedtls.mjs; the OpenSSL glue is the
asymmetric family's) and its vectors (scripts/vectors/pqcvectors.py): 259 PASS, 1 NOT-RUNNABLE (pqc-slh-dsa#6: Botan
3.12 has no default SLH-DSA parameter set).

- ML-DSA: fixed keys (pyca from_seed_bytes), pycryptodome's deterministic signatures as known answers (verified by
  pyca); ML-KEM: kyber-py keys and derandomised encapsulations (OpenSSL's "ikme") as known answers, cross-checked by
  pyca for 768/1024; SLH-DSA: the pure-Python slhdsa's keys and deterministic signatures for all 12 sets; hybrids:
  KEM round trips with draft-ietf-tls-ecdhe-mlkem's key and secret sizes; OBJ_nid2sn: NIST CSOR OIDs with the
  RFC 9881/9935/9909 ASN.1 identifiers.
- LMS (Mbed TLS verifies only): scripts/vectors/lms.py, a pure-Python RFC 8554 signer that checks itself against
  RFC 8554 Test Case 1 on import; vectors.test.mjs verifies the reference again with a JS verifier.
- Botan: ML-DSA/ML-KEM/SLH-DSA keys from the same test keys (Botan 3.12 reads the bare-seed PKCS#8 form);
  Dilithium/Kyber r3, FrodoKEM, Classic McEliece, XMSS and HSS-LMS have no independent reference here, so a key Botan
  generates from runtime strings is rebuilt through the call and must work with the generated one.
- pkey_works gains a KEM use and a public-key-size check; kem_check takes generated keys and a fixed encapsulation.
- cmake/embed.cmake: a line longer than a literal piece (an SLH-DSA-256f signature) is cut after its last ASCII
  character instead of failing the build (scripts/embed.test.mjs fails on the old code).
- routes_integration: the "pending > 100" stopgap becomes an invariant (no family is partly implemented).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The TLS family's adapters (scripts/families/tls.mjs, _tls_openssl.mjs) and records (scripts/vectors/tlsvectors.py):
93 PASS, 1 NOT-RUNNABLE (tls-ssl-3-0#0: OpenSSL 3 is built without SSL 3.0).

Every implementation is checked by an in-memory handshake (BIO pair; datagram BIO pair for DTLS) between what the call
configured and a peer the glue makes from runtime record values: the negotiated group must be the IANA registry's
name, the suite RFC 8446 B.4's (or RFC 5289's) code point, the version the RFC's version code; application data must
cross both ways; and a peer lacking the selection (another group, suite or version, at a security level that lets it
speak that version) must be refused, which a default client would not be. The server's certificate is a test
certificate pyca self-signs over the sample's RSA test key (checked again by Node). OpenSSL's security levels withhold
CCM_8 and TLS 1.0/1.1/DTLS 1.0, so those records run at level 0. The families link libssl.

gen-vectors.py: the module-backed families (pqc, tls) share one record loop.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tokens (scripts/families/tokens.mjs, scripts/vectors/tokvectors.py): 4 PASS. TOTP through the HMAC call against RFC
6238 Appendix B's six SHA-1 rows (RFC 4226 truncation in the glue); HS256 and RS256 against RFC 7515 A.1 / A.2
(transcribed in rfc7515-examples.txt, re-derived by pycryptodome and by Node), as bytes and base64url; EdDSA: the
generated Ed25519 key's JWS signature verifies, a changed signing input does not.

storage (scripts/families/storage.mjs, scripts/vectors/storevectors.py): 4 PASS. Neither format has a published
vector and both draw a random salt or header, so each has a pure-Python reference with a fixed one: Crypto++'s
Legacy/DefaultEncryptor format (Mash() key derivation, key check, CBC; Node decrypts it too) and libsodium's
secretstream (XChaCha20-Poly1305, modes.py). Decryptors must decrypt the reference and refuse a wrong passphrase or a
changed stream; encryptors' output must have the format's layout and decrypt back through such a decryptor.

Every family of the catalogue now has its adapter and its family test case.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
check-catalogue-keys.mjs gains checkForms: every runnable implementation whose generated function differs from the
plain call (a declaration handed on to `use`, `return <call>;`; 2797 of them) is probed both ways with the real
scanner, and the two must report the same keys, sizes, derived flags and derivation evidence, names, statuses and
findings (line numbers aside). Run with the probe; 0 problems against the sign-off scanner export. Its unit tests
cover a lost key size and a lost derived flag, and that a scan-only implementation is never probed twice.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
OpenSSL's DH parameter generation by generator (its default for a DH key) is a safe-prime search: 1 s to 22 s at 2048
bits in the image, against the server's 20 s per-call deadline, so GET /selftest failed asym-dh-2048 at random
(routes_integration caught it once in five runs).

- asym-dh-2048#0 names RFC 7919's ffdhe2048 (EVP_PKEY_CTX_set_dh_nid) instead of searching: the same DH-2048 finding
  (probed), instant, and its record now requires the generated prime to be ffdhe2048's. DH_PARAMGEN_TYPE_GROUP, the
  other way to name a group, crashes EVP_PKEY_CTX_set_dh_paramgen_type in the image's OpenSSL 3.5.7 (reproduced
  standalone).
- asym-dh#34, OpenSSL's library-default DH paramgen, makes the search in the call itself: it moves to
  scan-only/asymmetric_openssl_defaults.cpp, with its reason (asymmetric: 689 runnable).
- gen-catalogue.test.mjs: no runnable OpenSSL DH paramgen without a named group, and no runnable
  DH_generate_parameters_ex of 2048 bits or more (fails on the old catalogue).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On a host whose core_pattern pipes to a core-dump helper (systemd-coredump on the review VM), an aborted call's child
was still being dumped past CALL_TIMEOUT, so the parent reported 504 instead of 500 and `make build`/`make test` failed
(from Task 1). The forked child now sets RLIMIT_CORE to 0 (soft and hard) and, on Linux, PR_SET_DUMPABLE 0 before it
runs the call; a crypto worker's core would also hold key material. compose.yaml adds `ulimits: core: 0` as a
backstop. isolated_call_test checks the child's limits and dumpable flag (it failed on the old code: hard limit
unlimited, dumpable 1).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Focus 4 check probed without a version pin, so a generator change that lets the handle escape (`use(ctx)` /
`consume(ctx)` after the call, `return ctx`) and so loses a derived default could not be seen: unpinned, both forms
report the bare algorithm. Every implementation of a library a project pins (OpenSSL, Botan, Mbed TLS, libsodium,
Crypto++) is now probed both ways a second time inside that pinned project (2772 pairs, 0 problems against a clean
6c3801d3 export). A real-scanner mutation test renders asym-rsa#41 with `consume(ctx)` after the call: the check fails
it only under the pin (it fails with PIN_OF emptied, i.e. the old check).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
At --cpus 0.25 the SLH-DSA "s" sets and pqc-xmss hit the 20 s per-call deadline and /selftest ended RESULT: FAILED
with 426 entries unverified (Task 3b review I1); asym-dh-1024#0's safe-prime search took 0.4 s to 13.4 s there.

- An implementation can be marked slow with its reason (engine::slow; adapter spec `slow`, generated as
  slow(<shape>, "<reason>"); shown as "slow" by GET /algorithms/{id}). Its run, verify and self-test calls get the
  server's slow call deadline (SLOW_CALL_TIMEOUT_MS, default 60000) instead of CALL_TIMEOUT_MS (20000), which every
  other call keeps. The HTTP layer only knows a call class: a Bounded route may carry a slow predicate, and the
  self-test passes the entry's class to each bounded call.
- Marked slow: every pqc-xmss implementation and every SLH-DSA "s"-set implementation except OBJ_nid2sn.
- SELFTEST_BUDGET_MS defaults to 300000 (still bounded, still one self-test at a time).
- Less work: a key an SLH-DSA "s"-set call generates is checked by OpenSSL's pairwise check, not by signing (the fixed
  key's deterministic signature stays the known answer); Botan's self-generated keys are made once per process.
- asym-dh-1024#0 makes its safe-prime search in the call itself: scan-only, with its reason. The catalogue test now
  forbids any runnable search of 1024 bits or more (it failed on the old catalogue).

Measured on the image's server (wall time of POST verify, Docker --cpus):
- 0.25 CPU: pqc-xmss 25.1 s (42% of 60 s); SLH-DSA "s" sets 2.5 s to 9.1 s; nothing on the standard deadline above
  6.7 s (asym-dsa, 33% of 20 s).
- 0.15 CPU: pqc-xmss 31.6 s (53%); SLH-DSA "s" sets 4.1 s to 15.2 s.
- GET /selftest: RESULT: OK at 0.25 CPU in 92.2 s, 94.9 s and 96.0 s (3 runs), and at 0.15 CPU in 154.3 s.

Tests, each failing on the old code: http_integration (a route's slow call completes a 2.5 s call that the 1.5 s
standard deadline stops); routes_integration (an implementation marked slow passes run, verify and the self-test on a
1 s standard deadline, while its unmarked twin is 504 and FAIL); engine_test (slow flags and describe);
gen-families.test (the slow wrapper).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Fix round 1 made the call's process non-dumpable before it opened /proc/self/oom_score_adj. A non-dumpable process's
/proc/self files belong to root, so a non-root server's child (the image runs as uid 10001) failed the open with
EACCES and silently kept oom_score_adj 0 instead of 1000 (Task 3b re-review). The child now writes 1000 first, then
sets PR_SET_DUMPABLE 0; RLIMIT_CORE 0 still comes first. A failed write is reported on stderr instead of being
skipped. isolated_call_test checks that the call child reads back 1000, as a non-root user (a root test process drops
to uid 65534 in a helper, which also restores the dumpable flag the uid change cleared, as exec would for a server
started as that user). The test fails on the old order, as root under ctest and as uid 10001. The core-dump test
stays.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
53 construct files (src/constructs/, 9 more project headers), each with `// triton-expect:` headers. They are compiled
and run by a new ctest (test/constructs/constructs_test.cpp: one CONSTRUCT check per file, a known-answer prefix, a key
size or a round trip), never served (no catalogue entry, no family registration).

Review Focus 1 decoys (each beside the include that would otherwise classify it, with a positive control proving the
text would): a project class SHA256, a non-registry sha256_init, comments/strings/#error/static_assert, rand()/srand(),
a #define redirecting a registry name, a same-file definition shadowing one, the family only under #if 0 or absent.
Focus 5: the family through a project header's include closure, a precompiled header (pch.h: seen by every file of
its own directory, also unwritten), an include cycle (transitive). Focus 7: HMAC<Weak::MD5>, RSAES<OAEP<SHA1>> (`>>`),
ECDSA<ECP,SHA1>, CBC_Mode<AES> with a separate SHA256, an unresolved template's argument alone. Preprocessor and
strings: one- and two-level #define aliases, typedef/using chains, a #define body, ## pasting (gap), #if/#elif/#else/
#ifndef with their condition evidence, #if 0, a wrapper macro, plain/raw/concatenated/u8 literals to factories,
same-file constants, a run-time name (gap); function-pointer tables, extern "C", namespace aliases and using. Split
calls: the positive and the negatives (helper, other function, refiner before base, shadowed handle, lambda). Focus 4,
one idiom per file (the scanner reports a key once per file): the plain RSA/DSA/DH default and every no-default idiom
(explicit size, ctrl_str, ctrl, set_params, fromdata, helper, returned, stored, refiner under another #if, in a
runtime if, reassignment, set_dh_nid, set_dh_rfc5114); Botan create_private_key absent/""/explicit; libsodium,
Crypto++, Mbed TLS and tiny-AES-c defaults, version-independent ones derived in place.

scripts/check-constructs.mjs (make check-constructs, in make check): the header grammar, each header line against the
registry (a dump, not a scan), and the real scanner by three routes: the whole tree in one scan, each file alone with
the include closure computed here, and the version-dependent ones relocated into their pinned project (where the
Focus 4 defaults derive); plus 10 decoy controls. 62 files, 90 scans, 0 problems against a clean 6c3801d3 export.
check-constructs.test.mjs: grammar, closure, comparison, registry and control failures each named (fake scanner), the
committed fixtures and two real mutations (real scanner). check-families scans the constructs with the tree and leaves
their findings to check-constructs.

Recorded scanner deviations from Review Focus 1 (false-positive headers): a stringified macro argument (#x), a
decltype operand and a sizeof operand are classified.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- decoy_project_sha256: the project class moves to project_sha256.h (a header
  declaration does not shadow), so the decoy is silent only for want of
  Crypto++ (no include; an unqualified SHA256 also needs the namespace). Its
  control (include + block-scope using-declaration) compiles and classifies.
- split/shadowed: the outer RSA handle is refined to 4096 after an inner block
  that declares its own ctx; the scanner ignores block scope and reports a
  bare RSA, recorded as gap rsa-size-shadowed-scope.
- The eight fixtures that generate RSA-1024 but are reported as a bare RSA
  (generic ctrl, ctrl_str, set_params, helper, returned, stored, lambda,
  other function) carry gap lines. Every gap id has one GAP_CONTROLS entry
  whose edit removes the reason and must bring the hidden finding out; a
  removed or duplicated gap line fails the grammar half.
- check-families and check-constructs share the scanner's own suffix list
  (.c++, .inl, .ipp, .tpp, .h.in, .hpp.in, any case) and skip only what the
  scanner skips below the top, checked against cpp_ast.go; a finding in a
  construct file the checker did not load fails.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
windows/ (CNG identifiers as constants and L"..." strings, the chaining-mode
split call, a refiner-before-base negative, ML-KEM/ML-DSA/SHA3 keys the
registry verified against the SDK header text only, CAPI CALG_* and the
omitted PROV_*/AT_* keys) and apple/ (CommonCrypto digests, HMAC, PBKDF2,
CCCrypt with the derived CBC default and with ECB, CCCryptorCreateWithMode,
one Objective-C++ decoy), each with // triton-expect: headers.

scripts/check-platform-fixtures.mjs walks both directories with
check-families' shared lists (walkTree, isScanned), checks the header
grammar and gap ledger, the header-text marks, omitted keys and mingw shim
against the registry snapshot, the image exclusion (.containerignore and a
new .dockerignore, since Docker ignores .containerignore; COPY lines), and
with Go the real cpp_ast scanner over the whole cpp/ tree plus each file
alone and the decoy, gap and .mm controls. make typecheck-windows (pinned
mingw-w64 image, optional Windows SDK text check of the shim) and make
typecheck-apple (xcrun clang) are optional, outside make check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
C1: the catalogue's 481 Windows/Apple implementations (windows-cng 296, windows-capi 38,
commoncrypto 147; 476 registry, 5 gap) now have their 23 sourceFiles. gen-families'
generatePlatform writes them (no adapter): the GENERATED and PLATFORM marks, cstddef, the
platform's crypto-free prerequisite (windows.h), the catalogue's includes and preludes, and per
implementation its marker, `void platform_<n>(<params>) {`, the call verbatim, `(void)<name>;`
after a declaration (so -Werror holds), `}`. The catalogue probe scans each in exactly that
shape. check-generated families and removeStale cover windows/ and apple/ beside the
hand-written fixtures.

check-platform-fixtures tells the two kinds apart by the catalogue's sourceFiles plus the marks:
a generated file must equal the generator's output and report exactly the catalogue's findings
in ONE scan of the whole tree (check-families expectedFor + the extracted compareExpected); a
hand-written file keeps its header checks and fails if it carries the marks. make check (no Go
needed) requires every catalogue platform sourceFiles path to exist and accounts for every file
under windows/ and apple/. Platform findings: 517 = 480 generated + 37 fixture headers.

The mingw shim grows to 135 SDK 10.0.28000 identifiers (56 wide strings, 9 NCRYPT aliases, 70
CNG pseudo-handles); make check verifies names and wide values against the snapshot, and the
WINDOWS_SDK_NUPKG check reads bcrypt.h and ncrypt.h and reports unparsable lines.
typecheck-windows 31/31 and typecheck-apple 15/15, all -Werror.

I1: the Containerfile is parsed as Docker reads it (continuations joined, the escape directive,
comments inside a continuation, non-instructions fail closed); negation lines in the ignore
files fail; RUN --mount bind sources must be allowed; compose contexts must be `.` and name no
platform directory. Each review evasion and the combined attack failed-first as tests.

Minor: headers and windows .c files are typechecked (M3); the cng-mode-cast-string control
compiles via windows/cng_wide_property.h and every control is typechecked as edited (M6); an
installed but broken container engine fails typecheck-windows instead of skipping (M8); the
shim rule enforces what its comment says (M2); the pinned nupkg URL is recorded (M1).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
cpp/projects/: 42 small projects (5 catalogue projects whose family files are
now generated from the catalogue, 37 hand-written) with `// triton-expect:`
headers stating each finding's Package and evidence: exact pins (conan.lock,
vcpkg overrides, FetchContent tag, Meson wrap, bazel_dep, vendored version
files) against ranges, version>=, find_package, commit SHAs, branches,
master, a wrapper repository and .gitmodules; derived defaults in range,
below, above, pre-release, dev snapshot and without a version; the
own-project rule with its global fallback and a tie; nested projects and
Makefiles, app code in external/ and third_party/, vendored libsodium, Mbed
TLS, OpenSSL (full, trimmed, dev) and tiny-AES-c through aes.hpp, build
directories, include closure, pch, test-dir includer, cycles, cross-project
includes, a .h.in template, pure C and a macro-heavy header.

scripts/check-projects.mjs (make check-projects, part of make check): the
index, every file accounted for, pin-file syntax and claims, the control
ledger and image exclusion without a scanner; Package/derived claims against
the registry snapshot; with Go one real scan of the whole cpp/ tree (and one
without projects/: nothing else changes), each project alone and 39 controls.
The image-exclusion guard now covers projects/ and the server's CMake files.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- projects/vendored-tiny-aes-hpp: two roots for the scanner's remaining
  tiny-AES-c withholding place, a #define before aes.hpp in the translation
  unit (AES256) and in a project header it includes (AES192), each silent
  with a control that comments the define out and brings back the derived
  AES-128 default.
- catalogue: every Botan::create_private_key implementation also includes
  <botan/pk_keys.h> (the complete Private_Key its unique_ptr needs), so the
  generated derived-botan project files compile; scan unchanged.
- checkExclusion: reads every CMake file of cpp/, matches an excluded
  directory without a trailing slash, and reads compose's short build form.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The triton CLI never descends into a directory whose path contains one of
its built-in default exclude substrings (internal/scannerconfig
defaultExcludePatterns: "vendor", "/sys", "/dev", ...). A real scan of cpp/
therefore lost src/vendor-libs/ (the fingerprinted single-file libraries, so
every tiny-AES-c, micro-ecc and PicoSHA2 finding of the app files), the six
projects/vendored-* trees and projects/system-find-package: 4210 findings
instead of the 4248 the module itself reports (the checkers call
CppASTModule.Scan with no excludes, so they never saw it).

Renamed: src/vendor-libs -> src/bundled-libs, projects/vendored-* ->
projects/in-tree-*, projects/system-find-package -> find-package-system.
After the rename a real CLI scan (standard and comprehensive) equals the
module scan field for field (path, algorithm, status, library,
reachability, Package, evidence): 4248 = 4248. make check green against
the clean export; the image builds (the build stage runs its own ctest; make test under the compose hardening was still red at this commit and is fixed later).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
expected-findings.json is what a real triton CLI scan of the whole cpp/
tree must report (4248 findings in 199 files), derived from the same
sources the checkers use: the catalogue (check-families' expectedFor
over every generated family file, the support files), the
triton-expect headers of the constructs, platform fixtures and projects
(tree and unprefixed lines), the root claims (scripts/lib/attribution.mjs:
the cpp/ root, CLAIMS, the stated tree fallback), the sample's own
include-graph rule (scripts/lib/graph.mjs) and the registry snapshot
through a JS port of ResolveCppCrypto / CppDerivedFor. Every header and
catalogue entry must agree with the derivation or generation fails by
name. The union equals one real whole-tree scan field for field.

data/ holds the registry snapshot (dumped by the scanner's own code via
scripts/go-parity, with its unexported lookup tables, sized rules,
Libraries and the CLI profiles' default excludes and depths), the
classifier and the Go-parity golden file (29,844 keys, 25,273
CppDerivedFor cases; JS == Go). Freshness compares the sha256 of every
cpp_ast scanner file and every table, and the recorded commit
(commit-sensitive as in dart's check-fresh; a git archive export is
proven blob by blob against TRITON_COMMIT in TRITON_GIT).

compare-scan runs the real CLI (--modules cpp_ast, --profile standard or
comprehensive) and fails on missing, extra, decoy, status, attribution,
derived-flag, derived-token, evidence, reachability, knownNoise-gone and
SKIPPED findings: 0 problems on both profiles (4248 = 4248). check-pins
reads every exact version back from its pin file and backs every
Package. make check gains check-expected and check-pins; data/, scripts/
and expected-findings.json are excluded from the image context and
guarded by checkExclusion.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- make test was red under both engines since the not-root isolated-call
  test (compose's test service runs the build stage as root with
  cap_drop ALL, and the test needs setuid/setgid(65534)). The test
  service now adds exactly SETUID and SETGID (the runtime service is
  unchanged: cap_drop ALL, no-new-privileges, read_only, non-root
  final stage), and the test FAILS by name instead of exiting 3 when it
  runs as root without them. scripts/check-compose.mjs (make check)
  guards both services. make test: rc 0 under docker and podman.
- Default checkout discovery prefers a candidate whose scanner files
  hash as the committed snapshot; a non-ancestor commit with identical
  content is accepted with a NOTICE; differing content never is.
- check-expected / check-fresh say "by content, commit NOT proven" when
  the commit was not proven.
- The golden file must cover every probe key and probe case (checked
  without Go); its parity test uses the snapshot's own limits.
- compare-scan compares keySize and the dependency path (expected from
  the include-graph rule's BFS chain); new KEY-SIZE and DEPENDENCY-PATH
  classes. Real scans: 4248 = 4248 on both profiles.
- checkExclusion's negation message names the directory it re-includes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- cpp/README.md: running, testing (SETUID/SETGID on the test service only), organisation, the self-test (generated), runnable /
  not-runnable / scan-only / platform, functional-only checks, constructs, Windows/Apple fixtures and the header-text verified
  keys, projects (declared-pins table generated from the claims, typecheck table), vendored trees and build-dir markers,
  derived findings and version rules, statuses (registry ratings, pre-standard PQC), snapshots and freshness, compare-scan and
  the clone-location rule (Triton #1355), make targets, adding an algorithm.
- cpp/UNCOVERED.md: one row per gap unit (catalogue gap implementations, fixture gap ids, known-noise false positives, the
  scanner's unverified/omitted keys, topics) and the header-text verified list.
- scripts/check-uncovered.mjs and scripts/check-docs.mjs (+ tests, in make check): every unit in exactly one row, no stale or
  repeated row, the header-text list equals --header-text-keys; every tagged figure and generated block equals its sources, no
  commit id, renamed directory names only where the rename is explained.
- docs/superpowers: copies of the C/C++ scanner design, library survey and scanner plan; the sample plan notes the Task 6
  renames. Root README: cpp/ is a sample.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Namespace closure measured with the real module and exercised: src/constructs/namespace_header_using.cpp (a header's
  using-directive opens Crypto++ for its includers) and namespace_block_gap.cpp (gap namespace-block-closure: an enclosing
  `namespace CryptoPP {` block does not open a family reached through a header), with a gap control; new UNCOVERED topic.
- README blocks generated and checked: the implementation partition (classes add up to the catalogue total), the pre-standard
  PQC rated like FIPS (every SAFE non-FIPS PQC scheme with finding counts and the borderline cases), the CLI's default exclude
  patterns and the compile flags.
- check-docs: a committed manifest of required figures (scripts/doc-manifest.mjs), untagged counts fail (allowlist with reasons,
  measured spans), commit ids of 7-40 hex characters in either case over the docs and the docs/superpowers copies, relative
  links and anchors, projects/README.md checked; figures for the server constants, the TLS level-0 records, the functional-only
  Botan schemes, the scanner caps and more; upper-case figure names are compared (they were not).
- check-uncovered: the plan's minimum row list is parsed and mapped to units (PLAN_ROWS); checkExclusion requires *.md in both
  ignore files; gen-expected.test counts the catalogue instead of a hand-typed total.
- Review fixes: where to clone, tiny-AES-c licence, Go/Node/vectors requirements, slow implementations, three UNCOVERED rows,
  "Adding an algorithm" (context.mjs/apiNames, append at the end, --write).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The guard read only the Containerfile. A compose `dockerfile: Containerfile.evil`
plus an empty Containerfile.evil.dockerignore (Docker reads <Dockerfile>.dockerignore
before .dockerignore) shipped windows/, projects/, data/ and the rest into a real
docker image while the guard passed (re-measured: docker compose build admitted 577
files; podman 5.7 honours no per-Dockerfile ignore file and admitted only the nested
src/bundled-libs/VENDORED.md).

scripts/lib/image-guard.mjs: every Dockerfile/Containerfile at any depth must be a
known build file; every other ignore file must equal .containerignore; compose.yaml
is the only compose file, builds only Containerfile from `.` (no dockerfile_inline,
additional_contexts, include:, extends:) and bind-mounts no host path; Makefile and
script engine builds must be known builds (no --ignorefile, --build-context); each
build's context is simulated per engine with moby pattern semantics and must admit
no excluded path. scripts/lib/cmake-paths.mjs resolves every CMake path argument
(set/list/foreach/function arguments evaluated) and fails closed on anything it
cannot follow. Both ignore files add **/*.md (nested docs).

Tests red first (7 failing on the previous checker); the evaded state now fails
with 9 problems, the committed tree with none.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- projects/include-closure/src/stdafx/: a precompiled header named stdafx.h, seen by
  forced.cpp without an include (real scanner: openssl.SHA512 SAFE direct); control:
  stdafx.h removed silences it. The construct pch comment no longer claims stdafx.h
  is exercised there.
- projects/include-suffix-tiers/: quoted includes resolved by path suffix, own project
  first (app/main.cpp -> lib/crypto/hashes.h: EVP_sha256), then the enclosing project
  (nested inner/ -> shared/common/digest.h: EVP_sha384); the own tier wins
  (inner/src/order.cpp stays silent). Controls: each rename that breaks a resolution
  loses the family; renaming inner's own conf/ brings EVP_sha512 out.
- the tests-dir control renames tests/ to harness/ (direct -> transitive, measured)
  instead of adding an includer.
- checkClaimsCoverage: every project directory holding a build file is a CLAIMS root
  (or NOT_ROOTS with its reason) and every CLAIMS root holds one; fails without Go
  (test red first: the review's liboqs project, a removed entry, a stale entry).
- expected findings 4249 -> 4252 in 203 files; projects 43, 45 controls, 98 project
  findings; the 4 new translation units typechecked in the build stage (3 compile
  only with their own include directories).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- POST /run: the README states the real contract (as the Dart sample: OK whenever
  the call returned, also for a wrong result with "matches": false; FAIL only for
  an exception); /verify and /selftest judge, with each status and HTTP code listed.
- the post-quantum ratings are a generated sentence (801 PQC-named findings: 741 SAFE,
  60 TRANSITIONAL HashSLH-DSA variants capped by their pre-hash); generation fails when
  a pre-standard scheme is not SAFE.
- vectors: gen-vectors.py no longer claims full independence; README renders each
  record's provenance from vectors.json (scripts/lib/vector-provenance.mjs: OpenSSL-backed
  5, Botan's own keys 12, two-party exchanges 2, ...), vectors.test.mjs checks them by name.
- "What verified means": functional checks pin no parameter (measured: 600 of the 2870
  passing implementations are functional, by family).
- the self-test summary no longer says every algorithm was verified (engine.cpp and its
  test, red first); its default budget is 600 s, stated as budgetMs in the JSON result
  (routes_integration test red first); README: at least 0.25 of an idle CPU, 0.5 recommended.
- drift guard: the toolchain table is generated from the Containerfile pins (checked
  against the catalogue's IMAGE), the vendored pins and the SDK pin; the image's library
  versions in the prose are tagged figures; projects/README.md versions must be in the
  project's files or a registry range; UNCOVERED.md's backticked paths must exist and its
  keys be known. Mutation proofs for each.
- no review-process references, the long-lines sentence states the true rule, the call
  child's missing limits are documented (no CPU/AS/NPROC rlimit, shared network namespace,
  only the child pid killed), the runtime image size and the nuget 500 are measured facts,
  the relative --path . under /tmp claim re-measured (4252 of 4252).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Containerfile: the package lists come from one dated snapshot.debian.org snapshot
  (20261022T000000Z, main archive and trixie-security; the archive keyring still verifies
  every package), so libssl-dev, libbotan-3-dev and liblzma-dev (trixie-security only) and
  every point-release pin stay installable. Cold builds measured green under docker
  (3:14, 102 MB from the snapshot, ctest 6/6 in the build) and podman (2:12, ctest 6/6).
  README: how to bump, the failure mode (snapshot.debian.org unreachable) and its remedy.
- scripts/vectors/requirements.txt: the vector packages and their dependencies with the
  sha256 of every file PyPI publishes; a fresh venv installs them with --require-hashes and
  make vectors rewrites src/vectors/vectors.json byte for byte.
- .gitleaks.toml (repository root) and scripts/vectors/secret-scan-allow.txt (TruffleHog
  --exclude-paths) allowlist the published test-only keys and the generated files with
  key-named identifiers by exact path; measured with gitleaks v8.21.2: 1580 findings in
  cpp/ without it, 0 with it. TEST-KEYS-ONLY.txt says why the PEM files carry no comment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/triton-samples!1
No description provided.