Skip to content

fix(security): stop exposing Worker rejection internals - #1217

Merged
vincentkoc merged 1 commit into
mainfrom
fix/codeql-public-error-boundary
Aug 21, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/codeql-public-error-boundary

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where authenticated Worker clients could receive exception-derived rejection text from direct-publication and GitHub read-model endpoints. That text could include stack-derived or request-specific internal details and triggered CodeQL alert 76.

Why This Change Was Made

Read-model endpoints now return fixed endpoint-owned error codes. Direct publication preserves useful operational fingerprints through an explicit bounded category allowlist, with a generic fallback for unexpected failures. This removes exception text from public responses without collapsing known rejection causes into one opaque error.

User Impact

Operators keep distinct, stable direct-publication failure fingerprints for supported validation failures. Public Worker responses no longer echo paths, submitted values, stack-derived text, or unexpected exception messages.

OpenClaw Bay Impact

OpenClaw Bay is unaffected. The change is limited to exact-review queue rejection responses and their internal publication client; it does not alter Bay data, controls, lifecycle projection, status telemetry, deployment, or rollback behavior.

Documentation Impact

The active direct-publication rejection proof and mixed-case publication proof now assert bounded categories instead of path-specific error text. CHANGELOG.md records the security hardening. No public API documentation changes are required because these authenticated internal endpoints are not a public compatibility surface.

Real Behavior Proof

Claim: the real Worker/queue runtime returns distinct bounded direct-publication categories without exposing submitted paths, while valid mixed-case canonical publication behavior remains unchanged.

  • Surface: signed direct-publication Worker route, exact-review queue validation, canonical record storage, and response projection.
  • Fixture/scenarios: invalid revision, out-of-tuple path, dual-primary tuple, valid uppercase repository path, invalid different-repository path, lowercase publication, and canonical export namespace counts.
  • Command/environment: AWS Crabbox Linux run at exact rebased head 3a9cce5146cd2e7e05014e61e96d4e7ca01769da, executing the direct-publication rejection and mixed-case publication proof scripts against the real Worker/Durable Object runtime.
  • Observed result: invalid revision returned HTTP 400 with invalid direct publication revision; the submitted outside path returned HTTP 400 with direct publication path is outside its target tuple; the categories were distinct and contained no submitted path. Uppercase and lowercase valid publications returned HTTP 202, the different-repository request returned the bounded tuple category, exports selected the correct canonical casing, and SQLite namespace counts matched.
  • Artifact/trace: AWS Crabbox run run_6c65cc68e9bd, lease cbx_f4579c811b63 (silver-lobster-4865), c7a.8xlarge, exit 0, lease stopped.
  • Limits: controlled signed requests against the real Worker/queue runtime with ephemeral storage; no production Worker deployment or GitHub mutation.

Evidence

  • 33 focused Worker/read-model tests passed.
  • AWS Crabbox direct-publication and mixed-case runtime proofs passed, exit 0.
  • Dashboard and repair TypeScript compilation passed.
  • Changed-file lint, formatting, and git diff --check passed.
  • Codex dirty-patch review: clean after preserving distinct failure fingerprints and updating proof contracts.
  • Codex committed-range review against origin/main: clean.
  • Prior exact-head ClawSweeper review's changelog-removal finding was not applied: its cited release-owned rule explicitly covers openclaw/openclaw target PRs, while this is an openclaw/clawsweeper security change and the repository's own CHANGELOG.md tracks notable fixes.
  • Signed commit: 3a9cce5146cd2e7e05014e61e96d4e7ca01769da.

Risk and Rollout

Production TypeScript delta is +90/-15; the positive delta is the explicit security allowlist required to preserve established failure fingerprints without exposing exception text. Tests are +55/-5; documentation/proof contracts are +11/-12. Merge is gated on exact-head ClawSweeper review, hosted CI, and CodeQL closure for alert 76.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. 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 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

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

ClawSweeper review

What this changes

The PR replaces exception-derived Worker rejection text with endpoint-owned codes and bounded direct-publication categories, with regression coverage and updated runtime-proof contracts.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for maintainer review: this member-authored draft has no actionable correctness finding, and its previous changelog finding does not apply to this repository.

Priority: P1
Reviewed head: 3a9cce5146cd2e7e05014e61e96d4e7ca01769da
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused security patch with strong runtime proof and no actionable defect found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head Crabbox evidence from real signed Worker and Durable Object requests, including observed bounded responses and unchanged valid publication behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head Crabbox evidence from real signed Worker and Durable Object requests, including observed bounded responses and unchanged valid publication behavior.
Evidence reviewed 6 items Bounded direct-publication failures: The new mapper returns fixed categories for known validation failures and a generic fallback, rather than returning exception text.
Read-model response boundary: Each changed read-model catch path now emits a fixed endpoint-owned error code instead of serializing the caught exception.
Regression coverage: The patch verifies a credential-bearing invalid path becomes a fixed category, preserves a distinct tuple category, and checks all seven affected read-model endpoints.
Findings None None.
Security None None.

Live Verification

Command: DIRECT_PUBLICATION_REJECT_DETAIL_PROOF_OUTPUT=/tmp/clawsweeper-pr1217-proof bash docs/proof/direct-publication-reject-detail/run-proof.sh

Result: PASS (completed)

DIRECT_PUBLICATION_REJECT_DETAIL_PROOF_OUTPUT=/tmp/clawsweeper-pr1217-proof bash docs/proof/direct-publication-reject-detail/run-proof.sh
runner@runnervm76f27:/tmp/clawsweeper-live-proof-1217-Brm2sE/target$ DIRECT_PUBLICATION_REJECT_DETAIL_PROOF_OUTPUT=/tmp/clawsweeper-pr1217-proof bash docs/proof
/direct-publication-reject-detail/run-proof.sh
DIRECT_PUBLICATION_REJECT_DETAIL_PROOF_OUTPUT=/tmp/clawsweeper-pr1217-proof bash docs/proof/direct-publication-reject-detail/run-proof.sh
Durable Object initialized: exact_review_direct_publication_plans table present
invalid revision: HTTP 400; error=invalid_direct_publication_plan; fallback_required=true; detail=invalid direct publication revision
outside path: HTTP 400; error=invalid_direct_publication_plan; fallback_required=true; detail=direct publication path is outside its target tuple
distinct bounded validation details: true
runner@runnervm76f27:/tmp/clawsweeper-live-proof-1217-Brm2sE/target$ DIRECT_PUBLICATION_REJECT_DETAIL_PROOF_OUTPUT=/tmp/clawsweeper-pr1217-proof bash docs/proof
/direct-publication-reject-detail/run-proof.sh









































Assertions:

  • PASS expect_output: distinct bounded validation details: true

How this fits together

The dashboard Worker routes signed exact-review publication and GitHub webhook read-model requests into a Durable Object queue. Validation failures return to internal callers or trigger fallback handling, while successful publication persists canonical review records.

flowchart LR
A[Signed publication request] --> B[Worker authentication]
B --> C[Publication validation]
C --> D[Bounded rejection detail]
C --> E[Canonical record storage]
F[GitHub webhook delivery] --> G[Read-model validation]
G --> H[Endpoint error code]
Loading

Decision needed

Question Recommendation
Should this member-authored security hardening leave draft status and be accepted after the exact head’s hosted checks and CodeQL analysis complete? Accept after checks: Approve the bounded-response design when the current head’s required hosted checks and CodeQL analysis are green.

Why: The patch is technically sound, but member-authored drafts require explicit maintainer judgment rather than automated closure or routing.

Before merge

  • Complete next step (P2) - No mechanical repair is indicated; explicit maintainer acceptance is required for this member-authored draft after the current hosted checks finish.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test delta production +90/-15; tests +55/-5; docs/proof +11/-12 The explicit error-category mapping is accompanied by focused coverage for both publication and read-model response paths.

Technical review

Best possible solution:

Retain endpoint-owned failure codes and bounded operational categories, then land after maintainer acceptance and the current hosted security checks complete.

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

Yes. The checked-in proof scripts and focused tests exercise signed invalid publication requests and malformed read-model requests; the PR body also records an exact-head Worker/Durable Object run.

Is this the best way to solve the issue?

Yes. Replacing public exception text at the response boundary with fixed endpoint codes and an explicit bounded allowlist preserves useful diagnostics without exposing request-derived values.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head Crabbox evidence from real signed Worker and Durable Object requests, including observed bounded responses and unchanged valid publication behavior.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: The PR addresses public exposure of exception-derived Worker rejection details on an authenticated operational path.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head Crabbox evidence from real signed Worker and Durable Object requests, including observed bounded responses and unchanged valid publication behavior.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head Crabbox evidence from real signed Worker and Durable Object requests, including observed bounded responses and unchanged valid publication behavior.

Evidence

What I checked:

  • Bounded direct-publication failures: The new mapper returns fixed categories for known validation failures and a generic fallback, rather than returning exception text. (dashboard/exact-review-direct-publication.ts:1699, 3a9cce5146cd)
  • Read-model response boundary: Each changed read-model catch path now emits a fixed endpoint-owned error code instead of serializing the caught exception. (dashboard/exact-review-queue.ts:3183, 3a9cce5146cd)
  • Regression coverage: The patch verifies a credential-bearing invalid path becomes a fixed category, preserves a distinct tuple category, and checks all seven affected read-model endpoints. (test/github-webhook-read-model.test.ts:317, 3a9cce5146cd)
  • Repository changelog policy: The repository contribution policy reserves the release-owned changelog rule for openclaw/openclaw target PRs and directs ClawSweeper changes to their own release-note policy, so the prior changelog-removal finding is not applicable. (CONTRIBUTING.md:16, 3a9cce5146cd)
  • Feature history: Current-main history identifies Martin Cleary as a recent queue maintainer, Peter Steinberger as the webhook read-model introducer, and Jesse Merhi as the direct-publication validation introducer. (dashboard/exact-review-queue.ts:3047, 68a6dfcfc556)
  • Real runtime proof: The PR body records an exact-head Crabbox Worker/Durable Object run covering invalid revision, untrusted path, mixed-case publication, canonical export, and SQLite namespace checks with exit 0. (3a9cce5146cd)

Likely related people:

  • Martin Cleary: Recent current-main commits maintain the exact-review queue and its public Worker metadata boundary. (role: recent queue contributor; confidence: high; commits: 68a6dfcfc556, 43799a11fc26; files: dashboard/exact-review-queue.ts)
  • Peter Steinberger: Current-main history attributes the webhook-materialized read-model feature to this commit. (role: webhook read-model introducer; confidence: high; commits: bf762f3f6f9e; files: dashboard/exact-review-queue.ts, dashboard/worker.ts)
  • Jesse Merhi: Feature-history search identifies the commit that introduced direct-publication validation. (role: direct-publication validation introducer; confidence: high; commits: 746cb858bf00; files: dashboard/exact-review-direct-publication.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 (2 earlier review cycles)
  • reviewed 2026-08-21T06:20:12.282Z sha 16758f9 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-21T06:36:33.993Z sha 16df77c :: needs changes before merge. :: [P2] Remove the release-owned changelog entry

@vincentkoc
vincentkoc force-pushed the fix/codeql-public-error-boundary branch from 16758f9 to 16df77c Compare August 21, 2026 06:33
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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 21, 2026
@vincentkoc
vincentkoc force-pushed the fix/codeql-public-error-boundary branch from 16df77c to 3a9cce5 Compare August 21, 2026 06:51
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added 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. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 21, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 21, 2026 06:59
@vincentkoc
vincentkoc merged commit b853345 into main Aug 21, 2026
19 of 20 checks passed
@vincentkoc
vincentkoc deleted the fix/codeql-public-error-boundary branch August 21, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. 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