Repository navigation
sminos: bound a raised request's input so one frame can't close the session lane (#149) - #424
Merged
Merged
Conversation
… carriers
A pending request's tool input went up whole in DX4's `raised` and in the
complete `pending` set. The session lane ends when more than 16 MiB is
queued unsent, on DX2's uplink and on RL10's socket alike, so one Write
of a huge file awaiting approval took the machine's whole session lane
down, and the complete set sent at the next connect took it down again.
The daemon now bounds the input where it builds the frame
(`requests.shown_input`, used by `raised_draft` for both carriers): a
permission's input past RAISED_INPUT_MAX (256 KiB of UTF-8 JSON) is cut
by the mod's resync rule, each string held to RESYNC_INPUT_CAP (1,024
UTF-16 units, never splitting a pair), and marked `truncated`. If it is
still past the bound (many short strings), it goes as {}. A question's
input stays whole, as the resync keeps it, because its answers are
matched against its questions.
The decision's digest is drawn by the card from the input it was shown,
so `check_digest` now accepts the SHA-256 of that shown input,
recomputed from the request the bridge holds by the same deterministic
rule, or of the whole input. Session, request and tool must still match,
a permission's decision carries no updatedInput, and the bridge decides
by request id. So a viewer shown a cut input can approve only that
pending call, whose shown form is what it saw.
Tests: test_policy_requests (the frame, the set, sealed and as a draft,
the digests); test_rpcs Uplink (DX2 through the hub stand-in, decided
remotely and by `sminos decide`, no reconnect); test_rl10 Raised (RL10
through the endpoint stand-in, the same). Both end-to-end tests fail on
the unfixed daemon: the raise never arrives.
sminos 1.27.1.
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Review: the bound holds one raise; a project's complete pending set carries every request pending in it, so it can still pass a lane's 16 MiB with some sixty requests at the bound at once. The comment no longer claims otherwise. Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
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
A pending request's tool input went up whole, in DX4's
raisedand in the completepending {project, raised}set. The session lane closes once more than 16 MiB is queued unsent (SEND_QUEUE_MAX), on DX2's uplink and on RL10's socket alike. So one Write or Edit of a huge file awaiting approval took the machine's whole session lane down, and the complete set sent at the next connect took it down again.The daemon now bounds the input where it builds the frame.
requests.shown_inputis called byraised_draft, which both carriers use (sealed on DX2, a draft on RL10). It reuses the mod's resync rule and marker:RAISED_INPUT_MAX(256 KiB of UTF-8 JSON) has each string held toRESYNC_INPUT_CAP(1,024 UTF-16 units, never splitting a surrogate pair), and the request is markedtruncated: true.{}, marked.TEXT_CAP(65,536 UTF-16 units, at most 192 KiB) whole. 64 such raises in one complete set still fit a lane.The digest: what it covers, and why that's safe
The card draws a decision's digest
{session, request, tool, input_sha256}from the input it was shown:inputSha256(raised.input)in desk-web, with "the input shown was capped" fortruncated. The endpoint passes it through unchanged on lane A (link.tschecks only thatrequestDigestequalsargs.digest). The one place it is checked is sminos'scheck_digest, on both carriers, against the request the bridge child holds (GET /requests/<id>, the input its raise carried).So the digest covers what the viewer was shown, and this keeps that.
check_digestnow acceptsinput_sha256when it is the SHA-256 of the canonical form of either of these:shown_input(held): the cut form, recomputed from the held request by the same deterministic rule. That is byte for byte what the frame carried, so a legitimate remote answer drawn from a cut input still works.Session, request and tool must still match. Why a viewer shown a cut input can approve only the call the bridge will run:
updatedInput(_check_decisionrefuses it), so a viewer can never substitute an input.TEXT_CAPcap today.Tests
test_policy_requestsRequests:check_digesttakes the shown form's digest and the whole input's, and refuses another.{}.test_rpcsUplink (DX2 end to end, hub stand-in): two 17 MiB Writes reach the hub cut on the stream they were raised on. One is decided by a remotedecidewhose digest is drawn from what the hub got, the other by a localsminos decide. The stream never drops.test_rl10Raised (RL10 end to end, endpoint stand-in): the same over the socket, the remote decide fenced to the bridge's launch.run-sminos-tests.shlocally: 2568 assertions passed.Review
One round of doperpowers:reviewer-high, on 218579d..c7d6f5d, reported two findings:
tool_use_id, or the mod's mintedrequest-<ts>-<n>), whose input the engine fixes. The decision applies to that call, never to the held copy. The{}fallback aliases only within that one call. The ticket names "covers what the viewer was shown" as the rule to keep, and that is the rule the decision path already used: the held copy was capped at the mod'sTEXT_CAPbefore this change too. A commitment to the whole input alongside the preview would need araisedfield the card hashes, a protocol change on MAWS's side (desk-web, the endpoint's lane A). It is proposed as a follow-up below.Residue (not fixed)
pendingset is bounded only by its count of pending requests × 256 KiB (P2 above).raised, and have the card's digest name it, so that a held input changing under one request id is caught even past the cut (P1 above). This is MAWS's side and a protocol change.sminos 1.27.2 (after #152's 1.27.1).
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)