Skip to content

fix(cli): keep VOID_TOKEN on the platform that issued it in void auth - #609

Merged
Brooooooklyn merged 1 commit into
fix/node-target-set-cookiefrom
fix/auth-token-picked-platform
Oct 27, 2026
Merged

Brooooooklyn merged 1 commit into
fix/node-target-set-cookiefrom
fix/auth-token-picked-platform

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Problem

When a project has no saved destination, void auth status / void auth login asks which platform to use, then sets VOID_API_URL to the answer for that run. The token lookup only checks VOID_TOKEN against VOID_API_URL, so after the switch it believed the token belonged to the platform picked in the prompt. A token from platform A was sent to platform B.

before  VOID_TOKEN=tokA  VOID_API_URL=A  prompt -> B
        VOID_API_URL := B -> check "tokA is for B?" -> yes -> Bearer tokA sent to B

after   picked B != A -> hide VOID_TOKEN for this run -> B's saved login
        picked A == A -> keep VOID_TOKEN (same as before)

What changed

  • packages/void/src/cli/auth-router.ts: save VOID_API_URL and VOID_TOKEN before the switch. Keep VOID_TOKEN only when the user's own VOID_API_URL matches the picked platform. Restore both afterwards. This is the same rule void connect already uses.

Tests

  • auth-router.test.ts: three cases call the real getToken, the lookup that builds the Authorization header, inside the routed command:
    • token for A, B picked: B's saved login is used, not the token
    • token for A, A picked (with a trailing slash in the URL): the token is used
    • token without VOID_API_URL: not used
    • every case: both variables are restored afterwards
  • Each guarded line was reverted on purpose, and each revert made a test fail.

Choices to check

  • If the picked platform does not match, the token is hidden and the saved login is used. The command does not fail. The docs already say to unset VOID_TOKEN to use a saved login.
  • A VOID_TOKEN with no VOID_API_URL is no longer sent to the platform picked in the prompt.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-10-27T07:55:26.670504Z 9922c64 New commits
ℹ️ 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.

@Brooooooklyn

Copy link
Copy Markdown
Member Author

@codex review

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-auth-token-picked-platform-void-cloud.voidzero-docs.workers.dev (commit 9922c64)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://5403b344-void-cloud.voidzero-docs.workers.dev 9922c64 2026-10-27T07:55:10.653Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://eecbaf4a-void-cloud.voidzero-docs.workers.dev a993518 2026-10-27T07:20:33.195Z Visit the dashboard ↗

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: a993518afc

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

When a project had no saved destination, `void auth status` and
`void auth login` asked which platform to use and pointed VOID_API_URL at
the answer for that run. The token lookup only checks VOID_TOKEN against
VOID_API_URL, so after the switch it treated the token as belonging to the
platform picked in the prompt. A token issued by platform A was sent to
platform B, and a VOID_TOKEN with no VOID_API_URL was sent too.

Now the router only keeps VOID_TOKEN when the picked platform matches the
VOID_API_URL the user set. Otherwise it hides VOID_TOKEN for that run, so
the command uses the saved login for the picked platform, the same rule
`void connect` follows. Both variables are restored afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Brooooooklyn
Brooooooklyn force-pushed the fix/auth-token-picked-platform branch from a993518 to 9922c64 Compare October 27, 2026 07:54
@Brooooooklyn
Brooooooklyn changed the base branch from main to fix/node-target-set-cookie October 27, 2026 07:55
@Brooooooklyn
Brooooooklyn added this pull request to stack #618 October 27, 2026 07:56
@Brooooooklyn
Brooooooklyn enabled stacked auto-merge (squash) October 27, 2026 08:34
stacked auto-merge was automatically disabled October 27, 2026 08:34

Auto-merge was disabled for another pull request in the stack

@Brooooooklyn
Brooooooklyn merged commit 7b616fd into main Oct 27, 2026
27 of 29 checks passed
@Brooooooklyn
Brooooooklyn deleted the fix/auth-token-picked-platform branch October 27, 2026 08:51
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.

2 participants