GitHub Get synrag

Internal security review — synrag 1.9

Status: internal review by the development team, not an independent audit. It finds and fixes defects; it does not replace a third-party penetration test or cryptographic audit, which large customers will ask for.

Date: 25 November 2026. Scope: src/crypto, src/acl.rs, src/server (HTTP, auth, audit, cluster), src/wal.rs, index persistence, document parsers, CLI flag handling, Docker / Helm, Python connectors.

Method

  1. Cryptographic test vectors. Besides the RFC / NIST vectors in the unit tests, every primitive is run against Google / C2SP Wycheproof (tests/wycheproof.rs, vectors in tests/wycheproof/): 325 ChaCha20-Poly1305 cases, ~500 RSA PKCS#1 v1.5 SHA-256 signature cases (2048 and 3072 bit: malformed padding, wrong DigestInfo, signature ≥ modulus, truncated / prefixed signatures), 174 HMAC-SHA-256 cases. All pass.
  2. Code reading of every place untrusted input enters: HTTP parsing, credentials, JWT claims, ACLs, file uploads, journal and snapshot loading, cluster forwarding, logs.
  3. Fuzzing of the document parsers (examples/fuzz.rs, 88 M inputs; see the report, section 8d).

Findings and fixes

#FindingImpactFix
1SSO tokens were accepted without an audience check when --jwt-audience was not givena token the company IdP issued for any other application would open synrag--jwt-audience is required with --jwks / HS256; --jwt-any-audience waives it explicitly
2Conflicting duplicate Content-Length headers were not rejected (first one used); +4 style values acceptedrequest smuggling behind a proxy that reads the other headerconflicting or non-digit lengths → 400
3No deadline on reading a started requestslow-header / slow-body (slowloris) clients hold workersheaders within 10 s; body at ≥ 64 KB/s after a 10 s grace → 408
4termstats (cluster phase one) returned document frequencies over all documents to any readera restricted user could test whether a word occurs in documents they may not seeonly callers with read-all get it; for others the coordinator falls back to shard-local idf
5Index snapshots, journals and audit logs were created with the default mode (usually 0644)other accounts on the host could read document text and audit recordscreated 0600; warning if the encryption key file is readable by others
6Encrypted journal records were authenticated individually onlywith write access to the disk (no key), records could be reordered, deleted from the middle, or an older journal restored next to a newer snapshot (resurrecting deleted documents)each record's associated data = journal magic + snapshot generation + record position; snapshots store the current and previous generation. Reordering, deletion in the middle and foreign journals fail authentication; records of the previous generation (crash between snapshot and journal reset) are dropped, not replayed
7Text-format request logs printed URL-decoded paths raw%0A in a path forges log linescontrol characters replaced in text logs (JSON logs were already escaped)
8Index decoding sized buffers from counts in the filea corrupted snapshot could request a huge allocation and abortcapacities bounded by the file size
9CLI switches --trust-proxy, --metrics-public, --insecure-no-auth were parsed as options taking a valuethe next option was swallowed: in the Helm chart --trust-proxy --acl-default deny silently dropped denyswitches declared; any option followed by another option is treated as a switch
10(from fuzzing) release builds used panic = "abort"; PDF parser out-of-range panic; no total decompression budget or nesting limit for archivesone malformed upload could stop the server; zip bombspanic = "unwind" + isolation of parser and request panics; PDF fix; 1 GB budget per document, nesting depth 4

Regression tests for each: tests/wycheproof.rs, tests/encryption.rs (journal binding), src/server/http.rs (lengths), tests/server.rs (termstats, auth, roles), tests/ingest_limits.rs.

Second round (after the external review of 1.10)

#ItemResult
11HTTP framing beyond Content-Length (RFC 9112): space before the colon, obsolete line folding, bare CR, non-token header names, control characters, missing / duplicate Host, request-target formsall refused with 400 (absolute-form is accepted as RFC 9112 requires: the path is used). Probes through nginx 1.27 with keep-alive to the backend (CL.TE, TE.CL, CL.CL, space-colon, obs-fold TE, xchunked, TE with tab, bare CR, duplicate Host): no request was smuggled to synrag
12Writes partially applied (one replica yes, one no) and concurrent writers in different orderper-source write versions, last writer wins on every replica, tombstones for deletes; write_ack all / available; stale replicas excluded from reads and repaired automatically; replica import holds writes across fetch and swap
13Rollback of a whole data volume (consistent older snapshot + journal)state anchor outside the data volume (HMAC) refuses older data at start (with encryption at rest)
14Audit log rewritten as a whole with a recomputed chainHMAC checkpoints to an external sink; audit-verify --anchors
15Key rotationsynrag rekey
16Unprotected node-to-node trafficcluster refuses remote replicas without a declared transport; Helm: Istio STRICT mTLS / Linkerd, NetworkPolicy; tested with ghostunnel mutual TLS across two machines

Third round (after the review of 1.11)

#ItemResult
17Equal versions from two coordinators could be applied in different ordersversions carry a 12-bit node id: never equal across coordinators; strictly increasing per coordinator (unit test: 10 000 versions, no collision)
18Last-writer-wins is not strict consistencycompare-and-set if_version on add / delete (all-or-nothing, 409 with the current version)
19Replica repair by snapshot copy loses writes accepted on the other side of a partitionrepair merges in both directions by version (documents with ACLs, tombstones); test: two replicas with diverging writes, a newer delete and a version conflict converge to the same state
20Anchor not synced on every writesynced by default; --state-anchor-sync off documented as an explicit trade-off
21Durability of acknowledged writes unspecifiedcontract per write_ack mode and failure in ENTERPRISE.md
22Interrupted key rotationrekey is atomic per file and idempotent
23Timing side channelsdudect-style Welch t-test (examples/ct_timing.rs): with a leaky early-exit compare as positive control (t8 000–13 000), ct_eq, the AEAD tag check (bad tag at byte 0 vs 15), API-key verification (stored hash differing at the first vs the last byte), HMAC and ChaCha20-Poly1305 with key A vs key B: maxtbelow 4.5 (1 M measurements per test; HMAC A-vs-B 1.2–4.4 on a noisy laptop, not growing with the sample size). A fixed-vs-random-key comparison shows a signal that changes between machines (ChaCha20 0.4 on the server, 13–15 on the laptop) while key A vs key B stays clean — an effect of the CPU repeating identical inputs, not of the key value; it is reported, not used for the verdict. This is a statistical test, not a proof

Fourth round (after the review of 1.13)

#ItemResult
24Defect found from the reviewer's scenario. With write_ack: available, a write could be acknowledged by a replica other than the primary (primary cut off). After the primary came back — before repair — a conditional write expecting the pre-partition version was decided on the primary's stale copy: 200, and its decided version then overwrote the acknowledged write on the other replicareproduced by a test (failed: 200 instead of 409). Fix: in available mode the coordinator collects the document's version from every other replica first; the primary checks the precondition against the newest copy (409 with that version; primary marked stale and merged); a replica that does not answer → 503. New route versions requires role write (versions reveal whether a document exists). With all the primary holds every acknowledged write and decides alone (no extra round trip)
25Node ids could be left to chance (random 12-bit id when node_id was missing)node_id required (number, or "ordinal" from the host name; Helm: coordinator StatefulSet); with a service key each coordinator leases its id on every shard replica (30 s, renewed every 3 s): a second coordinator with the same id does not start, a coordinator that lost its lease refuses writes; /node-claim requires role admin (tested)
26The guide said a partition merge loses no accepted writecorrected: replicas converge to the newest version of every document; for a document changed on both sides only the later change survives (LWW); conditional writes cannot succeed on both sides
27Concurrency test size (20 rounds)400 rounds (200 with write_ack: all, 200 with available), two coordinators, repeated 5 times: always exactly one 200 and one 409, replicas identical

Checked, no change needed

Residual risks (not fixed here)