Repository navigation
Conversation
Eight defects found reviewing every file in crates/ against CLAUDE.md, tools/verify.sh, and a rule pack run over the whole tree. Encryption is reported from the handshake rather than the configured sslmode, so a pooled connection that fell back to plaintext and a Unix socket no longer report as encrypted. Audit recovery hashes the whole last line instead of the final 64 KiB of it, which used to link a restarted chain to the wrong digest once a line exceeded the recovery window. The open path also narrows an existing audit file to 0600; the mode was applied on creation and rotation only, so a file left by an earlier umask kept its broader bits while receiving statement class, relations, and principal. A JSON Web Key Set drops an RSA key whose modulus or exponent is outside the sizes the verifier accepts, where the EC and Ed25519 branches already checked. A refused libpq credential keyword no longer echoes its value through ConfigInvalid, which printed sslpassword, oauth_client_secret, or scram_client_key to the terminal and to any log that captured the error. An OAuth token whose claims carry none of this server's scopes is refused instead of being treated as read-only: an empty scope list failed every tools/call while resources and prompts succeeded. A repeated savepoint name is recorded once, so a handle's savepoint list stops growing while it stays open. A dump whose output file cannot be checksummed warns instead of reporting success with the digest missing. Two production sites indexed or sliced, which clippy denies outside test code: the trailing audit byte now reads through first(), and splitting a type element at its WITH clause goes through get(), so a match that lands inside a multibyte character is skipped rather than panicking. Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
SHSharkar
force-pushed
the
arena/b9456349-ownpg
branch
from
December 2, 2026 21:02
cb45f0d to
0e22ba9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A whole-repository review of the dataflow lifecycle across
crates/, in two passes. Eight defects are fixed, each with a regression test or an existing test extended. The final section records what was verified clean and what could not be run.Changes
Encryption is reported from the handshake, not from
sslmode(connect/,tools/health.rs,doctor.rs)pg_healthandpg_doctorinferred encryption from the configured mode, so a pooled connection that fell back to plaintext reported as encrypted, and a Unix socket reported as encrypted too. ATlsUseflag set by the connector's connect future now records what the handshake produced. This is reliable becauseconnect_rawawaitsconnect_tlsand then startup and authentication before it returns.Audit recovery hashes the whole last line (
audit.rs)Restarting recovered only the final 64 KiB of the last line and hashed that suffix. A line longer than the window produced a chain start linked to the wrong digest, and
ownpg audit verifythen rejected a file it had written itself. Recovery now hashes the complete last line, with the bounded read kept as the fallback for a line that will not fit in memory.The audit log narrows an inherited file mode (
audit.rs)mode(0o600)applies only on creation. Anaudit.jsonlleft by an earlier umask was opened and appended to with its broader bits intact, while the lines added to it carry statement class, relations, principal, and a short statement. The open path now applies0600to the descriptor before taking the lock, which also lets a single-user audit file recover without a manualchmod.An RSA key component is bounded before caching (
server/http/jwks.rs)The EC and Ed25519 branches validated component widths; the RSA branch took any modulus and exponent. The key set is cached for the life of the process and refreshed from the configured key endpoint, so an oversized component stayed resident inside the 1 MiB body cap. The bounds match the ranges
ringverifies, so no currently-working key is excluded.Questions closed rather than changed
older_client_sessions. rmcp 3.4.1 documents thatlegacy_session_modeapplies only to legacy protocol versions and that requests negotiating2026-07-28are always served statelessly. The server advertises exactly2025-11-25and2026-07-28, so the gated branch is the only one that can mint a session id.refuse-writesis not bypassable through a read-only tool.audit_admitsreceivesroute.spec.read_only, and the four host tools marked read-only still have real side effects. Under the reading that the policy tests whether this call's own line could be written, the behaviour is consistent, so it was left alone.Verification
No Rust toolchain exists in this environment, so
rustfmt,cargo build,cargo test, Clippy, and rustdoc have not run against these changes, andtools/verify.shcould not run either. The following did run:git diff --check: cleanToolSpecconstants against 50 registered routes, both difference sets emptypub struct *Settingsfield and every low-frequencypubfield: every one resolves to a consumerunwraporexpectin production source outside testspg_restore -nis exactmemcmpmembership in PostgreSQL 18 and 19 sources, confirming the schema pinning needs no quotingAppended to the body: a second review pass.
Second pass: exhaustive sweep over every file
The first pass mixed targeted greps with reading. This pass ran mechanical rules over all 79 files under
crates/and read the files that pass had not opened at all (cli.rs,config_cmd.rs,man.rs,logging.rs,context.rs,libpq.rs,presets.rs,programs.rs,describe.rs,profile.rs,transaction.rs,objects.rs,catalog.rs,pooler.rs,residency,metrics.rs,limit.rs,jwks.rs,resources.rs,prompts.rs,stdio.rs).Tooling:
ast-greprule pack (panic sites, unsafe, lossy casts, discarded results, lock acquisitions, fallible-defaulted values, secret exposure, error interpolation) plus tree-sitter parsing, run over the whole tree and filtered to production code by cutting each file at its#[cfg(test)]module.Defects found and fixed in this pass
Error::ConfigInvalidrenders as`{value}` is not a usable {setting}, andcannot_honorpassed the value through.sslpassword,oauth_client_secret, andscram_client_keyare refused keywords, soownpg --dsn "host=db sslpassword=hunter2"printed the secret to stderr and into any log that captured the error. Those keywords now render asset.Principal::allowstreatsNoneas unrestricted andSome(vec![])as holding nothing, so a JWT that authenticated but carried noownpg:*scope failed everytools/callwith 403 while reading resources and prompts succeeded, becauseprincipals.rsdoes not check scope. Claims are now filtered to known scopes, and a token left with none is refused at authentication.spawn_blockingfor the digest failed, the join error and the read error were both discarded and the tool reported success withoutput_sha256absent. Both paths now log a warning.Verified clean across the whole tree
ToolSpecconstants against 50 registered routes, both difference sets empty.pub struct *Settingsfield and every field appearing at most twice resolves to a consumer.pubitem in production code is referenced beyond its definition: zero unreachable items.id()arm and aremedy()arm, no catch-all, no unusedErrorId.unwrap,expect,panic!,todo!, orunimplemented!in production source; the threeunreachable!calls are the documented signal-handler branches.unsafeblock anywhere.deny.tomlagainstCargo.lock:lazy_staticandanyhoware banned but present only under their allow-listed wrappers; no skip entry is stale; every allow-build-script crate is in the lock.deny.tomllicence list,about.tomlaccepted list, and theDockerfilethird-party notice agree.server.json, andmcpb/manifest.jsonall carry 0.1.2.git diff --check: clean.tools/check-suppressions.pypasses.Skill availability
No skill toolkit is installed in this environment and the repository has none. The Rust, data-flow, dead-end, and audit dimensions were run as the rule pack above plus direct reading; nothing was skipped for lack of a packaged skill.
Limitation, unchanged
There is still no Rust toolchain (
static.rust-lang.orgis unreachable from this sandbox and norustcexists), socargo,rustfmt,clippy, andtools/verify.shdid not run. Every claim above is static analysis or reading, not compiler output.