Repository navigation
fix(gateway): block unauthorized session lifecycle sources - #125889
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 18, 2026 16:12
Contributor
Author
|
Land-ready evidence for head
The remaining mandatory gate is approval from a non-author security/session owner. Review is requested from |
Contributor
Author
|
Merged via squash.
|
This was referenced Aug 18, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 20, 2026
…125889) * fix(gateway): enforce session participation at lifecycle commits * refactor(gateway): simplify session target extraction
a-yeyang
pushed a commit
to a-yeyang/openclaw
that referenced
this pull request
Aug 23, 2026
…ript-event file Rebasing onto origin/main (which landed PR openclaw#125889's session-lifecycle authority check) conflicted with this branch's prior commit that split appendTranscriptEvent/appendTranscriptEventSyncCore out of session-accessor.sqlite-transcript-write.ts into a new file. Resolving that conflict by accepting the split-commit's deletion silently dropped the options.beforeCommitInTransaction?.() invocation the upstream change added inside the write-transaction callback, so the caller-supplied authority/participation check (session-accessor.entry-mutation.ts's commitGuard) would have silently no-op'd for every raw (non-message) transcript event append. Restore the call at the top of both transaction callbacks, matching upstream's placement, so the check still runs synchronously inside the transaction before the append proceeds.
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 Problem This Solves
Fixes an issue where multi-profile operators with write scope could apply session lifecycle operations to source sessions they were not permitted to participate in. Legitimate message-cut fork operations could also be rejected because their protocol target was read from the wrong field.
Why This Change Was Made
Session lifecycle authorization now uses method-specific protocol target extraction, includes recovery, and revalidates participation inside the exact SQLite create, fork, and recovery commit transactions after asynchronous work. Operator scopes, protocol shapes, storage schema, and compatibility behavior are unchanged.
This is AI-assisted work reviewed and understood by the author.
User Impact
Multi-profile operators can expect session create, fork, rewind, branch-switch, and recovery flows to honor the source session's participation boundary consistently. Authorized message-cut forks continue to work, while lifecycle writes stop if participation changes before commit.
Evidence
Real-behavior proof: an isolated dev Gateway accepted two distinct trusted-proxy profiles over real WebSockets with no production credentials. After the owner changed the source session to read-only, the outsider was denied for
sessions.create,sessions.fork, andsessions.recover, while the owner reached each handler. One temporary proof test passed on Blacksmith Testboxtbx_01m0asx8fgmxt9t31cnwpqcd6c: https://github.com/openclaw/openclaw/actions/runs/32158334652. The temporary test was removed before publication.Fresh focused Testbox proof passed 14 tests total (four changed-behavior cases plus all ten parent-fork storage tests) on
tbx_01m0at51bg4gmw2za55mqwcrk8: https://github.com/openclaw/openclaw/actions/runs/32158747022.After CI exposed two branch lint defects, Testbox
tbx_01m0atjf37yhsjpb8d8639rk5rpassed formatting, the exactcheck-lint-core-2command, the same four focused behavior cases, and all ten parent-fork tests: https://github.com/openclaw/openclaw/actions/runs/32159438407.Earlier local focused proof passed 73 router/lifecycle tests and all 10 parent-fork storage tests.
git diff --checkpassed..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-outputcompleted clean with no accepted/actionable findings on final head6652b6e1881bb75dc5ec4d1ecd100d2ac320f7e0.A broader earlier run of
node scripts/run-vitest.mjs src/gateway/server.sessions.create.test.tshad one unrelated worktree fixture failure because that fixture's temporary workspace was not a Git checkout. The new create race test passes independently, as shown above.Production LOC:
+92/-51(net+41). Tests:+406/-0. The production growth carries participation revalidation through distinct create, same-database fork, cross-database fork, transcript append, and recovery writer commit boundaries; collapsing those boundaries would weaken the transaction-local authority check.Security-owner review is required before merge and will be requested from
@openclaw/openclaw-secopsfor this authorization boundary.No changelog edit: normal PR release-note context is captured here.