Skip to content

fix(auth): admit a SETUP token equal to the jwt query - #4359

Merged
kixelated merged 1 commit into
mainfrom
fix/auth-same-token-twice
Sep 28, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/auth-same-token-twice

Conversation

@kixelated

Copy link
Copy Markdown
Collaborator

Follow-up to #4278. moq auth serve refused every session presenting both a SETUP AUTHORIZATION TOKEN and a ?jwt= query. A client offering a version without in-band auth copies its SETUP token into the URL too, so the same JWT arrives twice and was refused.

Maintainer decision: admit identical values, refuse different ones.

  • A type-0 SETUP token byte-equal to the jwt query is one credential, verified once.
  • Different values, or a SETUP token of another type (e.g. CAT) beside a jwt, are still refused with Refusal::TwoTokens.
  • The relay has no two-token logic of its own: with --auth-public it refuses any token, and with --auth-url it forwards the request to moq auth serve. So both paths agree through this one change.

Tests: the same-value test now expects admission (fails without the fix), and a new test pins that different values and a non-JWT type are refused. Docs: doc/bin/relay/auth.md, and the quest/m1/auth/token-in-band.md note saying #4278 shipped refusing both.

Public API: none. Refusal::TwoTokens keeps its name; only its message (the 403 body) changes to "a SETUP token and a different jwt query were presented; present one".
Wire: none.

(Written by Opus 5.5)

🤖 Generated with Claude Code

moq auth serve refused any session presenting both a SETUP token and a
jwt query. A client offering a version without in-band auth copies its
SETUP token into the URL too, so the same JWT arrives twice. Identical
type-0 values are now verified once; different values, or a SETUP token
of another type beside a jwt, are still refused with TwoTokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T13:48:16.666843Z 4933d32 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 35 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 49b1adee-5f67-4078-b005-4a8f3241c4f1

📥 Commits

Reviewing files that changed from the base of the PR and between ca47661 and 4933d32.

📒 Files selected for processing (3)
  • doc/bin/relay/auth.md
  • quest/m1/auth/token-in-band.md
  • rs/moq-auth/src/serve.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kixelated

Copy link
Copy Markdown
Collaborator Author

MERGE

Positive improvement. Follow-up to #4278 that fixes a real interoperability footgun: a client offering a version without in-band auth copies its SETUP token into ?jwt=, so the same JWT arrives twice and was refused. Admitting byte-equal type-0 SETUP + query as one credential matches the maintainer decision already noted on the quest, and keeps the refuse-different / refuse-non-JWT-type behavior.

Worth the complexity. The change is one new match arm in jwt(), a clearer Refusal::TwoTokens message, and tests that pin both the admit-same and refuse-different/other-type cases. Docs and the quest note are updated to match. No public API or wire change.

Different approach? Preferring one source (SETUP over query, or the reverse) would also work, but equality-as-one-credential is the least surprising rule for the duplicate-send case and avoids inventing a precedence clients must learn. No reason to reconsider.

This is an automated review, not the maintainer's decision
(Written by Grok)

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary:

  • No changes pushed. Head 4933d32 is green (Check, Test) and Codex reviewed it with a thumbs up; no inline findings from any reviewer. CodeRabbit was rate-limited.
  • Decision (maintainer, on quest: SETUP AUTHORIZATION TOKEN becomes a standalone m1 quest #4211): a type-0 SETUP token byte-equal to the jwt query is one credential, verified once; different values or a non-JWT SETUP token type beside a jwt stay refused with Refusal::TwoTokens.
  • Checked origin/main for other two-token logic: none besides moq-auth serve (the JS test of that name covers duplicate SETUP parameters, unrelated).
  • Public API: none. Wire: none. Only the TwoTokens 403 message changes.

Enabling auto-merge pinned to the head SHA.

(Written by Opus 5.5)

@kixelated
kixelated merged commit fa3aff6 into main Sep 28, 2026
3 checks passed
@kixelated
kixelated deleted the fix/auth-same-token-twice branch September 28, 2026 18:28
@moq-bot moq-bot Bot mentioned this pull request Sep 28, 2026
@moq-bot moq-bot Bot mentioned this pull request Sep 30, 2026
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.

1 participant