Skip to content

fix(server): reject malformed message cursors - #48037

Open
IbrahimKhan12 wants to merge 1 commit into
anomalyco:devfrom
IbrahimKhan12:strict-message-cursor
Open

fix(server): reject malformed message cursors#48037
IbrahimKhan12 wants to merge 1 commit into
anomalyco:devfrom
IbrahimKhan12:strict-message-cursor

Conversation

@IbrahimKhan12

Copy link
Copy Markdown

Issue for this PR

Closes #48034

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Message pagination used Node's permissive Base64URL decoder, which ignored invalid characters. This uses Effect's strict decoder before the existing cursor schema validation, matching session pagination. Malformed cursors now reach the existing InvalidCursorError response path.

How did you verify your code works?

  • bun test test/server/httpapi-session.test.ts -t "returns v2 public request errors for cursor and workspace query failures"
  • bun test --timeout 10000 test/server/httpapi-session.test.ts
  • bun typecheck
  • bunx prettier --check packages/server/src/handlers/message.ts packages/opencode/test/server/httpapi-session.test.ts

Screenshots / recordings

Not applicable.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

- Decode message cursors with strict Base64URL validation.
- Cover invalid cursor characters in the session API test.
@IbrahimKhan12
IbrahimKhan12 marked this pull request as ready for review September 8, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Message pagination accepts malformed cursor characters

1 participant