Repository navigation
fix: web-response audit on HTTP/1, MariaDB executable comments, and three console/CLI fixes - #339
Merged
Merged
Conversation
jfcmartins
marked this pull request as ready for review
November 16, 2026 10:09
… frame hyper's HTTP/1 server drops a body with a known length as soon as it is written in full, without polling for its end. The outcome audit only started on Ready(None), so on HTTP/1 every Content-Length response was audited from Drop as "client_disconnected", in a detached task whose failure could not close the connection (ADR-0022: audit fails closed). Hold back the upstream's last frame until the "complete" event is written; an empty body, which may never be polled at all, is audited before the head goes out and answered 503 if that fails. The tests serve a real HTTP/1 upstream and fail without the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYYXVETRewQNUQF7xTn
MariaDB runs the content of /*M! ... */ (and /*M!100100 ... */), but sqlparser expands only /*! ... */, so a statement inside one was classified as "empty". USE and KILL inside it got past the one-database and KILL-ownership guards, and normalize_literals audited it as /* ? */. Tokenize the content as code for MySQL targets, in both split and normalize. On MySQL proper it is a comment, so the stricter reading only refuses more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYYXVETRewQNUQF7xTn
An upper bound that is a bare date adds one day, which is out of range for the last representable date and panicked the handler (GET /console/sessions?to=9999-12-31, open to any signed-in user). Use checked_add; the value is then reported as ignored like any other bad date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYYXVETRewQNUQF7xTn
Anything other than "approve" was read as a deny, and anything other than "certify" as a flag, which withholds the role and ends the subject's sessions. Both are irreversible. Accept only the two values each form sends and refuse the rest, as the policy-change handler already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYYXVETRewQNUQF7xTn
It was the one profile file written with std::fs::write: an interrupted write left a truncated host-CA trust file, and its mode followed the umask. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEiXYYXVETRewQNUQF7xTn
jfcmartins
force-pushed
the
claude/focused-thompson-6j6ly0
branch
from
November 16, 2026 16:33
98d41bf to
e10fd6a
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.
What and why
Five independent fixes from a scheduled repository review, one commit each. None overlaps the open PRs (#300 OIDC groups claim, #276 release).
crates/limen-proxy/src/web.rs,AuditResponseBody).Content-Lengthbody, it drops the body without polling forReady(None)(hyper 1.12proto/h1/dispatch.rs: oncecan_write_body()is false it setsclear_bodyand drops it). The"complete"audit only started onReady(None).Dropasclient_disconnected, in a detached task. A failed emit there could not close the connection, which breaks ADR-0022 and the rule that audit fails closed.Content-Length: 0) may never be polled at all, so they are audited before the head goes out and answered 503audit is unavailableif that fails./*M! … */executable comments are now read as SQL (crates/limen-worker/src/db/sqltext.rs)./*! … */, so/*M!USE other*/and/*M!KILL 42*/were classified asempty.USEguard and the KILL-ownership guard inmysql.rs. Withnormalize_literalson, the audit showed them as/* ? */.splitandnormalize./*M!999999\- enable the sandbox mode */classifies asotherand is still forwarded (checked locally).9999-12-31no longer panics (console/query.rs,parse_when).+, which panics past the last representable date.GET /console/sessions?to=9999-12-31, open to any signed-in user.checked_add, so the value is reported as ignored like any other bad date.console/workflows.rs).approvewas read as a deny, and anything other thancertifyas a flag. A flag withholds the role and ends the subject's sessions, and neither a deny nor a flag can be undone.change_decidealready does.known_hostsis now written atomically (commands/ssh.rs).std::fs::write.profile::write_file.Related: ADR-0022 (web-app audit), ADR-0033 §5 (statement text), design §13 phases 6, 12 and 13. No new behavior beyond these fixes.
How it was verified
cargo fmt --allandcargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo test --libonlimen-worker(367),limen-proxy(51) andlimen-control-plane(208), pluscargo test -p limen-cli --bins(126): all pass.web::tests::response_audit: serves a real hyper HTTP/1 upstream withContent-Lengthback out through hyper's HTTP/1 server. It asserts that the reason iscompleteand that a failing sink withholds the end of the response. With the hold-back logic disabled, both tests fail, so they reproduce the bug.sqltext::tests::mariadb_executable_comments_are_classified_as_code, plus cases added to the comment-normalization test.query::tests::the_last_representable_day_does_not_panic.workflows::tests::only_the_two_known_decisions_are_read.protobuf-compiler(3.21), not the 36.2 pinned inmise.toml, because mise isn't available in this environment. The build succeeded with it.Not verified
demos/demo-phase12.sh,demos/demo-phase6.sh, thelimen-e2esuites and the DB-backed control-plane tests were not run. CI covers them once the PR is marked ready.unverified). It rests on MariaDB's documented/*M!syntax.gitleaksisn't installed here; I grepped the diff by hand.cargo denyandcargo auditwere not run; no dependencies changed.Review guide
Look hardest at the
AuditResponseBodychange: the held frame, the empty-body path inhandle, and its effect on HTTP/2. An empty response now waits for one audit write before its head is sent. HTTP/2 already waited for that write before ending the stream.Remaining concerns (found, deliberately not fixed)
SET SESSION sql_mode='NO_BACKSLASH_ESCAPES', the server runsSELECT 'a\'; KILL 99; -- 'as two statements, while sqlparser sees oneselect. That bypasses the KILL and USE guards, and the normalized audit hides the second statement.SET standard_conforming_strings = offhas the same effect on the audit only.ANONYMOUS_API_MAX_AGE(120 s,limen-proxy/src/lib.rs) runs out. Web-app downloads and streams in flight would be cut off.web.rslogin_redirect). A polling app can then overwrite the nonce of a sign-in already in progress.scim.rsenforceandidp_check::end_logins_ofuseunwrap_or_default()).reviews::active_deniesdrops rows that fail to decode, which fails open.access::expirecan write the same audit events twice when a later item fails.deploy/kubernetes/limen/{proxy,worker}.yamllack the podsecurityContext(non-root,fsGroup, seccomp) that the control plane and the Helm chart set.scripts/policy-pr-comment.shmatches the marker comment of any author.scripts/ci-db-targets.shuses a fixed temp path whenRUNNER_TEMPis unset.docs/design.md§11 still callsmodules/ecs,modules/ec2andexamples/complete"not yet in the repo".limen-audit'sJsonlFileSinkis used only in tests, and the crate doc around it is stale.Checklist
cargo fmtandcargo clippy ... -D warningscleanCompatibility and rollback
/*M! USE … */or/*M! KILL … */are now refused, as the unwrapped forms already were.Generated by Claude Code