Say a wrong claim link finds no sandbox, and load the claim page again when Back restores it#2192

merged1
main
agent-sandbox/fu2-claim-page-states
opened26d agobyNNick
View on GitHubGitHub import enabledPR last imported 21d ago

Two claim page states told a person the wrong thing.

  • A wrong or tampered link said "This sandbox expired". The read server function returned expired for an unknown secret. It now returns not_found, and the page shows a not-found state that names no Organization. A real secret that has lapsed or been retired still reads expired.
  • Back after Keep spun forever. The back-forward cache restored the page with Keep disabled and spinning. A useRestored hook now reloads the page on a pageshow with persisted. The reload finds the claim kept and opens the Organization.

Bets

None. This fixes copy and state on the claim page and moves no bet.

Tests

  • claim.server.postgres.test.ts: an unknown secret reads not_found, and an expired one reads expired.
  • use-restored.test.tsx: a persisted pageshow reloads the page, and a fresh load does not.

Both fail on main and pass here. On the real page, run with verify-dashboard: Keep, then Back, waits 15 seconds and lands in the Organization. A one-character change to the secret and a tampered secret both show the not-found state.

Checks

11 successful ยท 6 skipped
All checks passed
07d2cab
Synced from GitHub

Codex Review Summary

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

ReviewStatusCommitReview trigger
๐Ÿ“ Code Reviewโš ๏ธ Failed 2026-10-17T13:52:15.157877Zdd65cd5PR 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.

Synced from GitHub

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Synced from GitHub

Review in Change Stack โ†’

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

โš™๏ธ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: cbecda2a-749e-40fe-9b00-c8851cae681a
๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 23213d0807a34c4f55d8d06c723e86b7db4424f5 and 07d2cab3c0eb85102694e63be8c3588b4f6b73f7.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ๐Ÿ” Trigger review

No actionable comments were generated in the recent review. ๐ŸŽ‰

โ„น๏ธ Recent review info
โš™๏ธ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: da0566bc-74ba-49ab-be45-ec6c738dc9c2
๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 03c670edd484d8f946fb7fe8e1e0ab2772bda059 and dd65cd5b1eb3e6081bea9a572bcb31759052c22b.

๐Ÿ“’ Files selected for processing: 5
  • dashboard/src/modules/identity/claim.server.postgres.test.ts
  • dashboard/src/modules/identity/claim.server.ts
  • dashboard/src/routes/claim/$secret.tsx
  • dashboard/src/routes/claim/-components/use-restored.test.tsx
  • dashboard/src/routes/claim/-components/use-restored.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

๐Ÿ“ Summary

Summary by CodeRabbit

  • Bug Fixes
    • Invalid or altered claim links now show a not-found message instead of an expired-link message.
    • Claim pages now refresh when restored from browser history, helping ensure the displayed claim status is current.
    • Not-found guidance directs signed-in visitors to Cloud and other visitors to sign in.

The claim flow now distinguishes unknown secrets from retired secrets. The claim page renders a not-found view for unknown secrets and reloads when the browser restores a persisted page.

Changes: Claim flow

Layer / File(s)Summary
Classify claim secrets
dashboard/src/modules/identity/claim.server.ts, dashboard/src/modules/identity/claim.server.postgres.test.ts
Secret lookup distinguishes unknown secrets from retired secrets. readClaim maps these results to not_found and expired, and claim tests cover invalid and tampered secrets.
Handle not-found claims and restored pages
dashboard/src/routes/claim/$secret.tsx, dashboard/src/routes/claim/-components/use-restored.ts, dashboard/src/routes/claim/-components/use-restored.test.tsx
The claim page renders a not-found view with links based on sign-in status. The useRestored hook reloads on persisted pageshow events and removes its listener during cleanup. Its test checks persisted and non-persisted events and unmount behavior.

Priority: โž– Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: โšช Minimal ยท up to dd65c

The claim-page changes appear mergeable after normal checks; no concrete outstanding issue is identified.

Security architecture risk: ๐Ÿ”ต Low ยท up to dd65c

The changes are narrowly scoped. Unknown links reveal no organization details, retired links remain unable to claim a sandbox, and ownership-transfer protections remain in place. Browser restoration repeats an existing session-checked flow rather than granting new authority.

Retained concerns No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred โ€” The changed public response exposes a lifecycle distinction for a supplied candidate capability, not an organization identifier or cross-organization listing. A retired matching capability receives expired; an unmatched capability receives not_found. Neither response includes organization details or authorizes transfer.

Trust Boundaries and Controls

  • observed โ€” The read path obtains identity from the current server session. Automatic sign-in completion requires a non-anonymous session and a recent cookie matching the presented secret's hash; the handler deletes that cookie when consumed. Explicit Keep retains actor middleware. Restoration adds no alternative identity source or admission rule.

Resilience and Maintainability Implications

  • observed โ€” The existing transfer locks the organization and member rows, revalidates admission, and performs ownership, credential, anonymous-user, session, and sign-in cleanup within one database transaction. An already-claimed member returns without repeating transfer writes; another actor is refused. Inspected tests assert repetition stability, concurrent-claim serialization, expiry refusal, and rotation rejection. Rollback remains delegated to the unchanged transaction implementation rather than demonstrated by per-write failure injection.
Pre-merge checks: Passed 4 ยท Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Docstring CoverageWarningDocstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check nameStatusExplanation
Title checkPassedThe title clearly summarizes both main changes: invalid claim links show no sandbox, and the claim page reloads after back-forward cache restoration.
Description checkPassedThe description directly explains the claim-state correction, the useRestored behavior, the tests, and the reported verification steps.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
โœจ Finishing Touches: ๐Ÿ’ก 1
๐Ÿ“ Generate docstrings: ๐Ÿ’ก
  • Commit to this branch
  • Create a new PR
๐Ÿงช Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix ยท Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Added 1 commit

  • Say a wrong claim link finds no sandbox, and load the claim page again when Back restores it07d2cab