From 07ebde627725a5c6ad581d977a322b861ab5cad1 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Sun, 15 Nov 2026 07:06:12 +0000 Subject: [PATCH] =?UTF-8?q?Security=20Review=20=E2=80=94=202026-11-15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Quick-profile diff-driven review of the 96 commits since the 2026-11-14 report. Two CRITICAL findings confirmed (an EXPLAIN-wrapped-DML privilege bypass in the Rust PG server that upgrades to an unauthorized write under EXPLAIN ANALYZE, and an uncapped cartesian-product DoS in dbCheck's new extraIndexKeysCheck on the Rust MongoDB server); one prior CRITICAL re-confirmed unchanged. No fixes applied in this run. Co-Authored-By: Claude Sonnet 5 --- docs/security-reports/2026-11-15.md | 491 ++++++++++++++++++++++++++++ 1 file changed, 491 insertions(+) create mode 100644 docs/security-reports/2026-11-15.md diff --git a/docs/security-reports/2026-11-15.md b/docs/security-reports/2026-11-15.md new file mode 100644 index 000000000..8f3e0af69 --- /dev/null +++ b/docs/security-reports/2026-11-15.md @@ -0,0 +1,491 @@ +# Security Review — 2026-11-15 + +Diff-driven review against the 96 commits that landed since the 2026-11-14 +report's reviewed HEAD (`aeadf8a9`) -> today's HEAD (`5a91e04b`), run with the +vendored `security-audit` skill (`.claude/skills/security-audit/`) in **quick +profile**, plus this prompt's dependency/CI/release checklist (sections 3-5). +88 in-scope files changed (+10912/-1490, entirely within `crates/**`; no +`.github/`, `cmake/`, or `.gitmodules` change). Another unusually large +window, dominated by two independent feature clusters: a MongoDB-server batch +covering a large `explain`/classic-plan-cache/SBE fidelity rework (dozens of +RM items across `explain/**`, `explain/sbe/**`, a new mongod-compatible +KeyString codec, and a new FTDC diagnostic-archive writer/reader plus +`getCmdLineOpts` support, RM-417/425 among them); and a PostgreSQL-server +batch covering a cursor/portal laziness rework (deferred `DECLARE`/`OPEN`, +`UNION ALL` leaf-splitting, RETURNING-row cursors, per-fetched-row function +calls) and a large `secantus-pgplan` type/expression/collation fidelity pass +(a new `nodeToString`-style deparser, function-signature resolution, and +error-position work). + +**No target execution in this run** (this runner provides no OS-enforced +sandbox; `cargo` is present but `cargo audit` is not installed) — every +check below is `method: "source"`, backed in section 1 by live, read-only +`WebSearch`/`WebFetch` lookups against crates.io and public advisory +sources. + +**Reconnaissance, architecture synthesis, the coverage ledger, the +dependency/CI/release sections, and the duplicate-issue search were done +directly by the parent** (`git`/`gh`/`Bash`/`WebSearch`/`WebFetch`), not +delegated, and are not counted against the 15-agent budget — consistent +with every report in this series. + +**Hunting wave (quick profile, one wave): six hunters**, split by subsystem +given the window's two independent feature clusters — (1) the MongoDB +`explain`/SBE rework plus the new KeyString codec, (2) the MongoDB +diagnostics/FTDC/`getCmdLineOpts`/dbCheck batch, (3) the MongoDB misc +command-surface changes (`near`/`params`/`querySettings`/`distinct`/`find`/ +`crud`/aggregation), (4) the PostgreSQL cursor/portal laziness rework, (5) the +PostgreSQL `lib.rs` privilege/catalog surface (re-checking the 2026-11-14 +table/index ownership CRITICAL), (6) the PostgreSQL `secantus-pgplan` type/ +expression rework. Four of the six units reported `covered`; two reported +`candidate`. + +**One delegated post-wave coverage critic** (the quick profile's single +mandatory critic pass) found one genuine coverage gap the six hunters' +assigned starting paths missed entirely: `crates/secantus-storage/src/lib.rs` +(+108 lines, new `replayed_retry_pre_image`/`replayed_target`/ +`replay_session_state` retryable-write crash-recovery replay logic) was never +assigned to any hunter. Per the quick profile's rule (exactly one hunter +wave, no second wave this cycle), it is recorded `deferred` with reason +`quick_profile_final_critic` — see NEEDS VALIDATION / Summary below. The +critic also flagged three already-covered files (`secantus-pgplan/src/lib.rs`, +`secantus-commands/src/key_string.rs`, `secantus-commands/src/ftdc_file.rs`) +as "diluted" by being bundled into large batches rather than hunted alone; +each was in fact read and is recorded `covered`, with a note below for next +cycle's prioritisation. The critic confirmed zero `unsafe`/FFI changes +anywhere in this window's diff. + +**Both candidates went to independent verification** (the quick profile's +merged Phase 3/Phase 5 pass, one fresh verifier per candidate). **Both were +confirmed**, one with material upgrade: the EXPLAIN-privilege candidate's +verifier discovered that the gap is not limited to plan-metadata disclosure +as the hunter first framed it — `EXPLAIN ANALYZE` of `INSERT`/`UPDATE`/ +`DELETE` actually executes the statement on this server (matching real +PostgreSQL's own `ANALYZE` semantics), so the same unchecked gap lets an +authenticated, zero-privilege role perform a real unauthorized write, not +just see a plan. The dbCheck candidate's verifier confirmed the storage layer +deliberately does not enforce mongod's "cannot index parallel arrays" +restriction, which is what makes the uncapped multi-field blowup reachable +rather than reduced to a single-field case. Both verifiers independently +searched for a duplicate open issue or backlog item and found none for +either. + +Both validators (`validate-findings.cjs`, `validate-coverage-ledger.cjs`) +pass on this run's `findings.json` (2 records, both confirmed) and +`coverage-ledger.json` (7 units: 4 `covered`, 2 resolved `candidate`, 1 +`deferred`) under `.security-audit/run-1/` (git-ignored, not copied into +this report). + +## 1. Section 3 — Dependency advisories + +Four `Cargo.lock` files changed this window, each by exactly one line: a new +`flate2 = "1"` production dependency added to `crates/secantus-commands` +(for the new FTDC archive's zlib-compressed metric chunks, as mongod writes +them) plus a `tempfile = "3"` dev-dependency (test-only, used inside +`#[cfg(test)]` in the new `ftdc_file.rs`). `cargo audit` is not installed on +this runner, consistent with every prior report; CI runs it via +`.github/workflows/cargo-audit.yml`, not re-executed here. `WebSearch` found +no RUSTSEC advisory for `flate2` itself. `tempfile 3.27.0` pulls `rustix +1.1.4`, which carries **RUSTSEC-2026-0486** (unsound `xattr` functions +marking unwritten bytes initialized with a zero-length buffer; fixed at +`rustix >= 1.1.6`) — confirmed this exact `rustix 1.1.4` was already present +in `crates/Cargo.lock` before this window (via a pre-existing dependency path +unrelated to `tempfile`), and confirmed `tempfile` is the *only* dependent on +that specific `rustix 1.1.4` resolution and is itself dev-only, used only in +test code — **not reachable from production**, so not elevated to a finding, +per this prompt's "reachable code path" rule. + +Re-checked the standing tracked set: `tokio` remains pinned at `1.53.1` +(confirmed in `crates/Cargo.lock`, `crates/secantus-pg/Cargo.lock`, and +`crates/secantusdb/Cargo.lock`) on **RUSTSEC-2026-0386** (the `AsyncFd` +I/O-safety advisory; fixed only at `>=1.51.6,<1.52.0`, `>=1.53.3`, or +`>=1.54.0`) — unchanged for another consecutive review cycle (the 2026-11-14 +report counted thirteen; this makes **fourteen**). `rustls` (`0.23.46`), +`rustls-webpki` (`0.103.16`, at the version that fixes RUSTSEC-2026-0382), +and `ring` (`0.17.14`) remain at or above the versions that fix every +rustls/ring advisory found this cycle — no action needed; this project does +not depend on `aws-lc-rs`. No advisory was found this cycle for `bson`, +`pg_query` (`6.2.0`), `x509-parser` (`0.16.0`), `fancy-regex` (`0.14.0`), +`flate2`/`zstd`/`snap`, `hmac`/`sha2`/`pbkdf2`, `serde_json`, or `mimalloc` +(not actually a dependency of either shipped crate — confirmed absent from +every `Cargo.lock`). The vendored WiredTiger submodule pin is unchanged +(`eaa187c86147b561c940e9b0e5e628f5e86d075d`, `mongodb-7.0.33`, confirmed via +`git ls-tree HEAD vendor/wiredtiger`); `.gitmodules` did not change this +window. + +## 2. Section 4 — CI workflows + +14 workflow files exist under `.github/workflows/`; **none changed this +window** (confirmed via `git diff --stat aeadf8a9..HEAD -- .github/` +returning empty). No `pull_request_target` exists anywhere in the +repository (unchanged). No `runs-on: self-hosted` anywhere (unchanged). +`security-review.yml` itself (held to the same standard as every workflow, +per this section's instructions) is unchanged this window: least-privilege +`permissions:` (`contents: write`, `pull-requests: write`, `issues: write`, +`actions: read`, explicitly no `id-token: write`); its `secrets.*` +references are all passed as action inputs, never echoed into a log or +interpolated into a `run:` block; a repo-wide grep for `secrets\..*!= ''` +(the existence-leak pattern) returns zero matches. All `uses:` lines across +every workflow remain pinned to a full commit SHA or a local action path. + +## 3. Section 5 — Release artifacts + +No release/publish workflow changed this window (confirmed: `git diff +--stat` against `release-binaries.yml`, `release-pg-binaries.yml`, +`publish-crates.yml`, `crates-package.yml` is empty). No version bump in any +crate's `Cargo.toml` (confirmed: a repo-wide diff for `version =` lines under +any `Cargo.toml` returns nothing), consistent with CLAUDE.md's "no version +bumps in feature PRs" policy. `crates/secantusdb/Cargo.toml` +(`0.5.3-beta.196`) and `crates/secantus-pg/Cargo.toml` (`0.1.0-beta.17`) both +match the newest tags (`secantusdb-v0.5.3-beta.196`, +`secantusd-pg-v0.1.0-beta.17`) and crates.io's published versions exactly +(checked live via `WebFetch`; zero yanked versions on either crate) — no +out-of-band publish. + +**Secrets scan:** `git ls-files | grep -iE '\.env|\.key$|\.pem$|\.p12$|\.pfx$|secret|credential'` +and the equivalent `git log --diff-filter=A` history scan both return zero +matches (unchanged from every prior cycle). + +**Crate contents:** not independently re-checked this cycle (`cargo package +--list` requires a toolchain build this runner did not perform); no change +to any crate's `include`/`exclude` manifest fields this window. + +**Carried-forward issues:** **169** security-labelled issues were open +before this cycle's new filing (`gh issue list --label security --state +open`). A duplicate search against each of this cycle's two confirmed +findings' key terms (`gh issue list --search ...` on "dbCheck", "doc_keys", +"extraIndexKeysCheck", "MAX_COMPOUND_KEYS", "EXPLAIN", "privilege", +"sql_relations") found **no existing duplicate for either** — both filed as +new issues. Total known-open `security`-labelled issues after this cycle: +**171**. + +One re-confirmation, not a new finding: this cycle's PostgreSQL-privileges +hunter byte-for-byte diffed `check_sql_privileges_inner`, +`check_alter_action`, `create_index`, and the CLUSTER lock/key/table-rewrite +path against the 2026-11-14 baseline and confirmed the table/index +no-ownership-check gap that report filed as a new CRITICAL issue is +**unchanged this window** — neither fixed nor worsened. + +--- + +## 🔴 CRITICAL (Immediate action required) + +### New this cycle + +- **`EXPLAIN` (and `EXPLAIN ANALYZE`) of `INSERT`/`UPDATE`/`DELETE`/`COPY + FROM` bypasses the target table's privilege check entirely — `EXPLAIN + ANALYZE` lets a zero-privilege role actually write to a table it holds no + grant on** (high/high, overall high). + `secantus_pgplan::privileges::sql_relations_uncached` + (`crates/secantus-pgplan/src/privileges.rs:254`) derives the + `(relation, privilege)` worklist `PgHandler::check_sql_privileges_inner` + (`crates/secantus-pg/src/lib.rs:17042`) enforces, mirroring PostgreSQL's + `ExecCheckRTPerms`. Its top-level match has explicit arms for + `InsertStmt`/`UpdateStmt`/`DeleteStmt`/`TruncateStmt`/`CopyStmt`, and a + special unwrap for `DeclareCursorStmt` into its inner query + (lines 321-326) — but **no arm or unwrap for `ExplainStmt`**, falling + through the trailing `_ => {}` at line 311. For `EXPLAIN INSERT INTO t + ...` / `EXPLAIN UPDATE t ...` / `EXPLAIN DELETE FROM t ...` / `EXPLAIN + COPY t FROM ...`, the top-level parsed node is `ExplainStmt` wrapping the + real DML statement in its `.query` field, so none of the explicit arms + fire; the fallback generic-node walk only pushes a `SELECT` requirement + for nodes tagged `Context::Select`, which a DML target is not (confirmed + by the fact that an ordinary top-level `INSERT` does not spuriously also + require `SELECT` on its own target). Net effect: the target table of an + `EXPLAIN`-wrapped `INSERT`/`UPDATE`/`DELETE`/`COPY FROM` requires **zero + privilege**, when real PostgreSQL's `ExecutorStart` -> `InitPlan` -> + `ExecCheckRTPerms` runs the normal permission check unconditionally, even + under `EXEC_FLAG_EXPLAIN_ONLY` (that flag only skips actual row + modification, never the permission check). For `EXPLAIN` without + `ANALYZE` this is plan-metadata disclosure (table existence, cost + estimate, column names) to a role with no grant on the table. For + `EXPLAIN ANALYZE`, this server deliberately executes the wrapped + statement (`crates/secantus-pg/src/lib.rs:45933`, matching real + PostgreSQL's own `ANALYZE` semantics) via the same `execute_statement` + path — so the same zero-privilege gap lets an authenticated low-privilege + role **actually `INSERT`/`UPDATE`/`DELETE` rows** in a table it holds no + grant on and does not own. A sibling function in the same crate + (`crates/secantus-pgplan/src/schema_refs.rs:115`) already special-cases + `ExplainStmt` for an unrelated purpose, confirming the unwrap pattern is + known in this codebase and was simply never applied to `privileges.rs`. + An independent verifier, briefed to try to refute this from scratch, + confirmed every step of the trace from the wire-protocol entrypoint + through to the `EXPLAIN ANALYZE` execution call site and found no + secondary gate anywhere in the `plan_explain` path + (`crates/secantus-pgplan/src/lib.rs:11944-12038`, which performs only + analysis-refusal-ordering checks). + **Fix:** unwrap `ExplainStmt` to its inner statement node before both the + top-level match (`privileges.rs:265`) and the inner-node walk + (`privileges.rs:316`), exactly mirroring the existing `DeclareCursorStmt` + unwrap, so the wrapped DML's target gets the same explicit privilege push + its unwrapped form would get. + **Filed as a new issue** (no duplicate found; the closest relative, open + issue **#1678**, is the same bug-class — an unhandled top-level match arm + — for `MergeStmt`, not `ExplainStmt`). + +- **dbCheck's `extraIndexKeysCheck` computes an uncapped cartesian product + of multikey field values — unlike its own storage-layer sibling — letting + a planted document OOM/hang the whole shared server when an administrator + later runs dbCheck** (medium/high, overall high). + `doc_keys()` in `crates/secantus-commands/src/db_check.rs:597` (added this + window for dbCheck's `extraIndexKeysCheck` validate mode) computes the + cartesian product of every indexed field's candidate key values with + **no size bound** (the loop at lines 637-648). The identical computation + exists twice already in the storage layer — + `crates/secantus-storage/src/lib.rs`'s `reference_keys()` (line 17844, + cap enforced at line 17875) and the insert-time `index_key_variants()` + (lines 4523-4545) — both capped at `MAX_COMPOUND_KEYS = 10_000` (defined + at line 1602), with the storage layer's own comment stating the cap + exists "to avoid exponential blowup when multiple fields are + array-valued" and explicitly noting this codebase deliberately does + **not** enforce mongod's "cannot index parallel arrays" restriction — it + accepts documents where more than one compound-index field is + simultaneously a multi-element array, relying entirely on the cap to + bound the resulting blowup. `doc_keys()` reuses that same unrestricted + precondition but omits the cap. `doc_keys()` runs once per document for + every row of the collection (`db_check.rs:442-452`) before any + batching/throttling parameter (`maxDocsPerBatch`, `maxCount`) is applied + — those only throttle how the already-computed key list is chunked + afterward, not this initial per-document computation. A document of a + few hundred KB to a few MB, with two or three fields each holding tens of + thousands of small array elements, produces on the order of 10^9-10^10 + combinations, each involving an allocation, a KeyString encode, and an + O(n) linear `seen`-containment scan — enough to exhaust memory or run + unbounded. dbCheck requires the cluster-level `dbCheck` privilege (an + administrator-grade role: `clusterManager`/`clusterAdmin`/`root`); planting + the triggering document requires only ordinary collection write access — + so a low-privileged writer can cause a crash/hang of the single shared + `secantusd-rs` process the next time a higher-privileged administrator + (or an automated periodic job — dbCheck's documented normal usage) runs + dbCheck on that namespace. An independent verifier, briefed to try to + refute this, confirmed the parallel-array precondition is genuinely + unrestricted and that no other bound in `db_check.rs` rescues this + specific allocation. + **Fix:** reuse the existing `MAX_COMPOUND_KEYS` constant in `doc_keys()`'s + `combos` loop, breaking out of both loops once the bound is reached, + mirroring `reference_keys()`'s pattern exactly; surface a dbCheck + health-log warning when a document's key set was truncated, rather than + silently dropping the remaining combinations. + **Filed as a new issue** (no duplicate found; the related but distinct + open issue **RM-688** in `tasks/backlog-rust-mongodb.md` only covers + Decimal128/geo/wildcard-index refusals and missing batch-size throttling + of the already-computed key list — not this uncapped precomputation). + +### Carried forward, re-confirmed unchanged + +- **No ownership check on `ALTER TABLE`/`DROP TABLE`/`CREATE INDEX`/`DROP + INDEX`/`CLUSTER`** (high/critical, overall critical). Originally reported + 2026-11-14 and filed as a new issue that cycle. Re-verified this cycle: + this window's PostgreSQL-privileges hunter byte-for-byte diffed + `check_sql_privileges_inner`, `check_alter_action` (including its + `OwnerTo` arm), `create_index`, and the full CLUSTER lock/key/table-rewrite + code path against the 2026-11-14 baseline and found every one of them + identical — this window neither fixes nor worsens the gap. + **No new issue filed** — unchanged from the existing filing. + +--- + +## 🟠 WARNING (Address within 1 week) + +None this cycle — both of this cycle's confirmed candidates reached overall +`high` severity (see CRITICAL above; this report's heading mapping places +confirmed `critical` or `high` records under CRITICAL, confirmed `medium` +under WARNING). + +--- + +## 🟡 INFO (Best-practice recommendations) + +- **The `tokio` `RUSTSEC-2026-0386` `AsyncFd`-unsound pin is unchanged** — + fixed only at `>=1.51.6,<1.52.0`, `>=1.53.3`, or `>=1.54.0`; unfixed + across at least **fourteen** consecutive review cycles now. +- **`rustix 1.1.4` (`RUSTSEC-2026-0486`, unsound zero-length-buffer `xattr` + handling) is present via the new `tempfile` dev-dependency, but is + dev-only and test-only** — not reachable from production, so not elevated + to a finding this cycle; worth a routine `rustix` bump to `>=1.1.6` next + time any `Cargo.lock` in this tree is touched, to stop a future + production dependency from inheriting the same resolution silently. +- **One coverage gap was deferred rather than hunted this cycle**, per the + quick profile's one-wave rule (see Summary): `crates/secantus-storage/src/lib.rs`'s + new +108-line retryable-write crash-recovery replay logic + (`replayed_retry_pre_image`, `replayed_target`, `replay_session_state`) — + never assigned to any hunter, found only by the post-wave critic. Worth + priority next cycle given its idempotency/duplicate-apply stakes. +- **Three large files this cycle's critic flagged as "diluted" by being + bundled into oversized hunter batches** were in fact read and are + recorded `covered` with no finding, but deserve a dedicated pass next + cycle rather than being re-confirmed only as part of a larger batch: + `crates/secantus-pgplan/src/lib.rs` (+/-2412 lines, the single largest + file-diff in this window, containing new privilege-error-classification + logic worth a focused look given this cycle's two privilege-boundary + findings), `crates/secantus-commands/src/key_string.rs` (new, 405-line + binary codec), and `crates/secantus-commands/src/ftdc_file.rs` (new, + 546-line binary archive parser/writer). + +--- + +## 🔍 NEEDS VALIDATION + +None this cycle — both candidates reached an independently verified +`confirmed` disposition within the quick-profile verification budget. (The +critic's one coverage gap is recorded as `deferred` in the ledger, not +`needs_validation`, per the quick profile's own rule: it is unexamined +surface, not a blocked source-grounded hypothesis.) + +--- + +## 🟢 CLEAN (Passed review) + +- **The MongoDB `explain`/classic-plan-cache/SBE rework and the new + KeyString codec**: the new `key_string.rs` encoder reuses pre-existing + bounded structures with no new recursion or slice-indexing risk; the new + SBE execution/plan-building code (`sbe/find.rs`, `filter.rs`, `expr.rs`, + `group.rs`, `stage.rs`) introduces no attacker-triggerable panic or + out-of-bounds access beyond pre-existing patterns; `union.rs`/ + `sub_stages.rs`'s `$unionWith`/`$lookup`/`$facet` explain output is + privilege-walked (`authz_pipeline.rs::walk`) before any handler runs, so + no cross-collection information disclosure; no new unbounded complexity + class introduced. +- **The MongoDB diagnostics/FTDC/`getCmdLineOpts` batch** (beyond the + CRITICAL dbCheck finding above): `getCmdLineOpts`'s exposure of the raw + process argv was traced end-to-end through `authz::check()`'s + `c.cluster("getCmdLineOpts")` gate — unchanged this window and gated + identically to mongod; `ftdc_file.rs`'s zlib/gzip decompression code runs + only in `#[cfg(test)]`, with no production read-back path, so no + zip-bomb-style exposure currently exists; `args.rs`'s new `set_option`/ + `sort_options` helpers' `expect()` calls are only ever reached with + hardcoded literal paths, never attacker-influenced ones. +- **The MongoDB misc command-surface changes** (`near`/`params`/ + `querySettings`/`serverinfo`/`stats_admin`/`distinct`/`find`/`crud`/ + aggregation): the `$near` detection rewrite narrows its recursion surface + rather than widening it; `crud.rs`'s field allow-list change is strictly + more restrictive than before; `stats_admin.rs`'s parse-before-locks split + (RM-185) reduces a lock-based DoS angle rather than increasing one; + `sorter.rs`'s new `$meta` sort-key insertion index is proven in-bounds by + construction; the new memory-accounting subtraction in + `secantus-core/aggregate.rs`/`docstore.rs` is proven non-underflowing + across adversarial document shapes. +- **The PostgreSQL cursor/portal laziness rework** (beyond the CRITICAL + `EXPLAIN` finding above, which is in a different file): every new entry + point (deferred `DECLARE`/`OPEN`, `EXECUTE ... USING` binding, RETURNING-row + cursors, `UNION ALL` leaf-splitting, per-fetched-row function calls) was + traced to confirm it runs strictly downstream of the existing text-based + `check_sql_privileges` call on the statement's full original text, so none + of this window's laziness changes introduce a new instance of this + codebase's recurring missing-ownership-check pattern; the new + `sql_fn_validator.rs` helper is privilege-neutral type inference, matching + real PostgreSQL's own `fmgr_sql_validator` (which likewise performs no + privilege check). Two same-session, non-privilege-crossing observations + (a name- vs. identity-based cursor state race; an unguarded-recursion + `UNION ALL` branch count matching a pre-existing, unchanged sibling + weakness) were surfaced but do not meet this report's cross-boundary bar. +- **The PostgreSQL `secantus-pgplan` type/expression/collation rework** + (`ruleutils.rs`'s new deparser, `funcsig.rs`'s signature resolution, + `errpos.rs`, `domain_scope.rs`, `enum_order.rs`, `expr_typmod.rs`, + `correlated.rs`, `sort_input.rs`, `vectors.rs`, `optype.rs`, + `collation.rs`, `regobj.rs`, `schemas.rs`): every new recursive helper + over a client-supplied AST stays within the pre-existing, unmodified + `MAX_EXPR_DEPTH` (2500-level) guard in `lib.rs`'s `parse_guarded`, which + is sized to cover work strictly heavier than any of this window's + additions; every new `expect()`/indexing operation audited is preceded + by a match/if establishing its exact precondition; no privilege/ + visibility check was weakened; `unread_ctes.rs`'s "removed" function was + confirmed moved verbatim into `lib.rs`, not dropped. +- **CI workflows**: 14 workflow files exist; none changed this window. +- **Release artifacts**: no release/publish workflow changed; no version + bump; tags match both `Cargo.toml` and crates.io's published versions + exactly for both shipped crates; no out-of-band publish, no yanked + version. +- **Full-window secrets scan**: clean. + +--- + +## 📊 Summary + +- **Date of review:** 2026-11-15. +- **Commit reviewed:** `5a91e04b87a239376b77444a4f78cb1f145dcde9` (confirmed + matching `git rev-parse HEAD`). Diff base: `aeadf8a90b9b04357b8d04eeb58c0cb73910a8a2` + (2026-11-14 report's reviewed HEAD). +- **SecantusDB version reviewed:** Rust MongoDB-server crates + `0.5.3-beta.196` (unchanged); Rust PostgreSQL-server crates + `0.1.0-beta.17` (unchanged) — this window's headline changes all landed + via `changelog.d/` fragments, no version bump, per CLAUDE.md policy. +- **Profile / budget:** `quick`, as this prompt specifies, budget 15 agent + invocations. Spent: **6 hunters + 1 post-wave critic + 2 independent + verifiers = 9 of 15.** Reconnaissance, the coverage ledger, the + dependency/CI/release sections, and the duplicate-issue search were done + directly by the parent via `git`/`gh`/`Bash`/`WebSearch`/`WebFetch`, not + delegated, and are not counted against the 15-agent budget. Both + validators (`validate-findings.cjs`, `validate-coverage-ledger.cjs`) pass + on this run's `findings.json` (2 records, both confirmed) and + `coverage-ledger.json` (7 units: 4 `covered`, 2 resolved `candidate`, 1 + `deferred`) under `.security-audit/run-1/` (git-ignored, not copied into + this report). **Coverage is partial by design** (quick profile, + diff-driven scope, exactly one hunter wave): the critic's one accepted + gap (`secantus-storage/src/lib.rs`'s new retryable-write replay logic) is + recorded `deferred` with reason `quick_profile_final_critic` rather than + silently absorbed; this cycle did not re-walk the authentication surface + (SCRAM/X509/`pg_hba.conf`, unchanged this window), the WiredTiger + FFI/`unsafe` boundary (confirmed zero `unsafe` changes in this window's + diff, but the boundary outside this window's diff was not re-walked), or + individually re-verify every one of the 169 previously-open security + issues against this window's diff file-by-file (only a targeted duplicate + search against this cycle's two findings' key terms, which found no + match). +- **This cycle's new findings: 2 CRITICAL confirmed `high` severity newly + introduced or newly discovered this window** (the `EXPLAIN`-wrapped-DML + privilege bypass; the dbCheck uncapped-cartesian-product DoS), **1 + CRITICAL confirmed re-confirmed still open and unchanged from 2026-11-14** + (the table/index DDL ownership gap), 0 WARNING, 3 INFO (the carried + `tokio` advisory; the non-reachable `rustix` advisory via `tempfile`; the + deferred coverage gap and the three "diluted" files), 0 NEEDS VALIDATION, + 0 rejected. +- **Comparison with previous report (2026-11-14):** that cycle found three + brand-new CRITICAL-tier findings, the first in this report series to land + in the PostgreSQL server's core DDL authorization path. This cycle finds + **two more** brand-new CRITICAL-tier findings, both continuing that same + shape but in new corners: a second kind of PostgreSQL privilege-check gap + (an unhandled top-level statement-node match arm — this time `ExplainStmt` + rather than a DDL statement kind, and newly discovered to extend from + metadata disclosure into an actual unauthorized write via `EXPLAIN + ANALYZE`), and — for the first time in this series — a MongoDB-side + finding that is a missing *resource bound* rather than a missing + recursion-depth guard: dbCheck's new `extraIndexKeysCheck` dropped a cap + its own storage-layer sibling already carries for the identical + computation. The recurring pattern that has dominated most cycles since + 2026-11-02 — **brand-new or newly-wired code shipping without a + protection a sibling code path in the same codebase already implements** + — continues unbroken for a third consecutive cycle, and this cycle shows + it is not confined to one failure mode (ownership checks, recursion + guards, or resource caps): it is the same authorship gap recurring across + all three. Total known-open `security`-labelled issues: **169** before + this cycle's new filings (**171** after: two new issues). +- **Top 3 priorities for the team:** + 1. **Fix the `ExplainStmt` privilege-check gap first — it is the only + finding in this report series so far where the gap upgrades from + disclosure to an actual unauthorized write.** `EXPLAIN ANALYZE` of a + DML statement against a table the caller has zero privilege on and + does not own currently succeeds and performs the write. The fix (one + unwrap, mirroring the existing `DeclareCursorStmt` pattern) is small; + the blast radius before it lands is not. + 2. **Audit every other top-level `match stmt.node` in `secantus-pgplan` + for the same missing-wrapper-statement shape.** Three instances of + this exact bug class are now known across two review cycles: `MergeStmt` + (#1678), the DDL statement kinds (2026-11-14's CRITICAL), and now + `ExplainStmt`. A single audit of every function in `privileges.rs` + (and any sibling with the same match-and-fallback shape) against the + full list of `pg_query` statement-wrapper node kinds would likely find + the next one before a review cycle does. + 3. **Give dbCheck's new validate-mode code the same resource-bound review + its storage-layer counterparts already passed.** `doc_keys()` is new + code modeled closely on `reference_keys()`/`index_key_variants()` but + silently dropped the one bound that makes the shared computation safe. + Any future dbCheck validate-mode addition that recomputes index keys + from document content should explicitly cite `MAX_COMPOUND_KEYS` (or + its own bound) in review, not rely on the reviewer noticing the + omission. + +If any of the above is superseded by a fix landed after this report was +written, the next review cycle is expected to catch it via re-execution +against the oracle and the current code — not by re-reading this +document's claims.