Repository navigation
feat(account): claim links expire after 30 days and accounts get claimed in the browser, so refresh the stored link and stop offering it once claimed - #65
Merged
Conversation
…ex, so attribute Codex only from its own CODEX_* variables
…med in the browser, so refresh the stored link and stop offering it once claimed `zenrows account claim` asks for a fresh link when the stored one is missing or 25+ days old, and reports an already-claimed account. Quota errors check claim status at most every 6 hours, keep a stored link only while it is under 30 days old, point to `zenrows account claim` otherwise, and accept only https zenrows.com claim URLs.
…ent is installed, so attribute Claude Code and Codex from the variables they set when running a command
…and an untrusted discovery document could redirect the API key Only one process refreshes the claim link at a time (an exclusive lock file next to account.json), the 6-hour slot is taken before any network call, and account.json is re-read before minting so a link another process just stored is reused. A discovered signup endpoint is used only when it is https on zenrows.com, and the account/claim URLs fall back to the built-in endpoint when the signup URL does not end in /signup. A 409 not_agent_account is final like already_claimed, a non-JSON 200 is reported as such, claim URLs with userinfo are rejected, and secrets.json/account.json are written 0600 from creation (temp file + rename) in a 0700 directory.
… config could receive the API key on the claim and status checks The account and claim endpoints are derived from the signup URL only when it is https on zenrows.com or http(s) on loopback, with no userinfo; anything else uses the built-in endpoint. Both requests now resolve against the caller's project and run URL discovery through the same 5-second fetch. The claim lock holds a random token: release deletes it only while the token is still ours, and a stale lock is renamed aside before takeover and put back if it turns out to be live. saveApiKey no longer chmods a file that is already written 0600.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Claim links expire 30 days after they are issued, and the account is now claimed in the browser by proving an email (Google, GitHub or a 6-digit code). The CLI kept showing the link stored at signup, so after 30 days
zenrows account claimand the quota-error hint pointed at a dead page, and both kept offering the link after the account was claimed.Client attribution was also too broad: any exported
OPENAI_API_KEYlabelled the shell as Codex, and anyCLAUDE_*variable as Claude Code.What
zenrows account claim. Asks the account endpoint whether the account is already claimed, and says so if it is. Otherwise it requests a fresh link (POST /api/agent/claim) when the stored one is missing, untrusted or 25+ days old, and saves it with its issue time.zenrows account claim.zenrows fetchprocesses hitting a 402 made exactly one claim request.secrets.jsonandaccount.jsonare created 0600 from the start (temp file plus rename), in a 0700 directory.already_claimedornot_agent_account) is treated as final. A non-JSON 200 gets an accurate error. Claim links with userinfo are rejected.openai-codexonly forCODEX_SANDBOX,CODEX_SANDBOX_NETWORK_DISABLEDorCODEX_THREAD_ID.claude-codeonly forCLAUDECODE,CLAUDE_CODE_ENTRYPOINTorCLAUDE_CODE_CHILD_SESSION. Anything else isunknown.Verification
npm run typecheckclean.npm test: 409 pass, 0 fail.