Skip to content

fix(worker): hide internal session control failures - #121

Merged
vincentkoc merged 1 commit into
mainfrom
security/codeql-session-control-errors-20260829
Aug 29, 2026
Merged

fix(worker): hide internal session control failures#121
vincentkoc merged 1 commit into
mainfrom
security/codeql-session-control-errors-20260829

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 29, 2026

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where internal Session Control failures could return parser or exception details in an HTTP 500 response.

Related: https://github.com/openclaw/crabfleet/security/code-scanning/4

Why This Change Was Made

The Session Control Durable Object now owns one fixed internal-error response for unexpected failures. Caught values are no longer serialized across the response boundary.

User Impact

Unexpected Session Control failures remain visible as HTTP 500 responses without exposing internal error details.

Evidence

  • Real Wrangler/Miniflare Durable Object route, before: malformed JSON returned HTTP 500 containing a distinctive synthetic parser detail.
  • Same route, after: returned exactly {"error":"internal error"} with no synthetic or parser detail.
  • pnpm check
  • pnpm test (1,003 passed)
  • pnpm build
  • pnpm exec wrangler deploy --dry-run --containers-rollout=none
  • DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer pnpm macos:test
  • Fresh no-hydration AWS Crabbox Worker proof: https://crabbox.openclaw.ai/portal/runs/run_3172bd3b2476
  • Independent Codex gpt-5.6-sol high review: no findings.

Production LOC: +2/-5 (net -3). Tests: +0/-0.

@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 29, 2026
@clawsweeper

clawsweeper Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 2:31 AM ET / 06:31 UTC.

ClawSweeper review

What this changes

The PR replaces exception text in Session Control HTTP 500 responses with a fixed internal error message.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

The PR is still necessary: current main returns caught exception text from this Durable Object, while this branch consistently returns a generic 500 response. The introduced change is correct and narrow; as a MEMBER-authored PR it should receive normal maintainer approval after required checks complete.

Priority: P2
Reviewed head: 034b44f5e97438a0af26c4976d91e5c321ae1711
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct Worker hardening patch with reported production-path validation and no actionable review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a real Wrangler/Miniflare malformed-JSON route changing from parser detail to the exact generic 500 body.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a real Wrangler/Miniflare malformed-JSON route changing from parser detail to the exact generic 500 body.
Evidence reviewed 5 items Introduced error-boundary correction: The verified introduced hunk replaces serialization of the caught value with a fixed JSON 500 response, so parser and storage exception text cannot cross this response boundary.
Current-main behavior remains unfixed: The pinned main parent still returns error.message or a stringified caught value at the same catch boundary; therefore the branch is not redundant.
Internal call boundary: The Worker declares Session Control as a Durable Object binding, and checkpoint callers use the binding stub rather than a public route; callers handle failure through status rather than depending on detailed error bodies.
Findings None None.
Security None None.

How this fits together

Session Control is a Worker Durable Object that receives internal binding requests for sandbox policies, checkpoints, and GitHub Actions relay state. It converts those operations into JSON HTTP responses consumed by Worker services.

flowchart LR
  A[Worker service] --> B[Session Control binding]
  B --> C[Session Control Durable Object]
  C --> D[Policy, checkpoint, or relay operation]
  D --> E{Operation outcome}
  E -->|success| F[JSON response]
  E -->|unexpected failure| G[Generic 500 response]
  F --> H[Worker caller]
  G --> H
Loading

Decision needed

Question Recommendation
Should this MEMBER-authored Worker security correction be approved and merged once the remaining required checks complete? Approve after required checks: Merge the one-file generic-error correction once required validation is complete.

Why: Repository policy keeps MEMBER-authored items out of automatic closure, so merge authority must make the final landing decision despite the narrow correct patch.

Before merge

  • Complete next step (P2) - No repair-lane work is needed; normal maintainer approval and completion of required validation are the remaining steps for this MEMBER-authored PR.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch size 1 file; production +2, -5; tests +0, -0 The narrowly scoped response-boundary change avoids unrelated behavior or dependency changes.

Technical review

Best possible solution:

Keep the fixed generic 500 response at the Session Control boundary so unexpected internal failures retain their status without disclosing exception details.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: malformed JSON or another thrown operation reaches this fetch catch boundary, and pinned main serializes the caught value while the branch returns a fixed response. The PR body also records a Wrangler/Miniflare before-and-after route result.

Is this the best way to solve the issue?

Yes. Replacing the catch response at the sole Durable Object boundary is the narrowest maintainable way to preserve HTTP 500 semantics while preventing exception-detail disclosure.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4e10690d2cf8.

Labels

Label justifications:

  • P2: This is a bounded security-hardening correction for error-detail exposure in one internal Worker boundary.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its body nevertheless records a real Wrangler/Miniflare malformed-JSON route changing from parser detail to the exact generic 500 body.

Evidence

What I checked:

  • Introduced error-boundary correction: The verified introduced hunk replaces serialization of the caught value with a fixed JSON 500 response, so parser and storage exception text cannot cross this response boundary. (src/worker/session-control-do.ts:216, 034b44f5e974)
  • Current-main behavior remains unfixed: The pinned main parent still returns error.message or a stringified caught value at the same catch boundary; therefore the branch is not redundant. (src/worker/session-control-do.ts:216, 4e10690d2cf8)
  • Internal call boundary: The Worker declares Session Control as a Durable Object binding, and checkpoint callers use the binding stub rather than a public route; callers handle failure through status rather than depending on detailed error bodies. (wrangler.jsonc:70, 034b44f5e974)
  • Feature-history provenance: Vincent Koc authored the current correction and the preceding Session Control relay series; the source-path history shows eleven Vincent Koc commits and the earlier coordinator refactor by Peter Steinberger. (src/worker/session-control-do.ts:61, a89ba66f88ad)
  • Reported production-path proof: The PR body records a real Wrangler/Miniflare malformed-JSON route before/after result and links an AWS Crabbox Worker run; the MEMBER-authored PR is exempt from the external-contributor proof gate. (034b44f5e974)

Likely related people:

  • vincentkoc: Authored the proposed correction and the substantial recent relay protocol history in the same Durable Object. (role: recent Session Control contributor; confidence: high; commits: 034b44f5e974, a89ba66f88ad, 816dc731c81d; files: src/worker/session-control-do.ts)
  • Peter Steinberger: The source-path history traces back to the coordinator architecture refactor that established this area. (role: earlier architecture contributor; confidence: medium; commits: df9bdc9952d4; files: src/worker/session-control-do.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-29T06:25:30.634Z sha 034b44f :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc marked this pull request as ready for review August 29, 2026 06:43
@vincentkoc
vincentkoc merged commit 830832d into main Aug 29, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant