Skip to content

feat: start GitHub sign-in from ViteHub's sign-in route - #234

Open
onmax wants to merge 1 commit into
mainfrom
feat/vitehub-sign-in-route
Open

onmax wants to merge 1 commit into
mainfrom
feat/vitehub-sign-in-route

Conversation

@onmax

@onmax onmax commented Nov 18, 2026

Copy link
Copy Markdown
Member

The "Sign in with GitHub" buttons on the landing page and in the site header called signIn.social() in the browser, so they did nothing until the page hydrated, and a failure only showed a toast.

They now link to /api/auth/sign-in?redirect=<next>, which ViteHub Auth serves from access.signIn (vite-hub/vitehub#4909). The server starts the GitHub sign-in and comes back to the page the auth guard sent the visitor from, with its own same-origin check on redirect. signin.vue keeps its client call, since it needs prompt: select_account to switch accounts.

Depends on vite-hub/vitehub#4909. Every @vite-hub/* package moves to that PR's pkg.pr.new build (a00c398, main plus the route). The @vite-hub/comments patch for vite-hub/vitehub#4762 goes, since #4762 is on main now.

Verified

  • pnpm typecheck, vp lint and pnpm fmt --check on the changed files pass.
  • nuxt dev on this branch, signed up with email and password:
    • GET /api/auth/sign-in?redirect=/drops/abc signed in: 302 to /drops/abc. Signed out: 302 to github.com/login/oauth/authorize.
    • GET /api/auth/sign-in?redirect=//evil.example: 400.
    • GET /api/auth/sign-out with Sec-Fetch-Site: cross-site: 403, session kept. With same-origin: 303 to /home, session cookies cleared, get-session answers null.
    • The landing page server-renders href="/api/auth/sign-in?redirect=%2Fdrops%2Fabc" for /?redirect=/drops/abc, and redirect=%2Fdrops for ?redirect=//evil.example.

Not verified: the GitHub round trip with a real OAuth App, and the full pnpm test suite.

Prepared with Claude Opus 5.5 in T3 Code.

The landing and header buttons link to /api/auth/sign-in?redirect=, which
ViteHub Auth serves from access.signIn, in place of a client signIn.social()
call. The link works before hydration. ViteHub moves to the vite-hub/vitehub#4909
build; the comments patch for #4762 goes, since #4762 is in it.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

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

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T11:24:17.481457Z
We couldn’t complete this review. Comment @codex review to try again.
df4d0d0 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The pinned Auth build puts signed-out visitors in one shared GitHub sign-in rate-limit bucket, and the UI bump changes saved comment markers and breaks a browser test. Address both before merging.

Approach: Server-rendered links are the right way to make sign-in work before hydration, but Drop should adopt a build that preserves per-client limits and keeps unrelated viewer behavior unchanged.

Reviewed changes

  • Public sign-in: Traced the header and both landing links, the return path from the auth guard, and the unchanged /signin account-switch flow.
  • ViteHub dependencies: Checked the pinned Auth route and the replacement of the local Comments patch with upstream behavior.
  • Validation: Focused auth tests passed (60 passed, 2 skipped). The full suite matched PR CI: 818 passed, 3 skipped, 2 failed. The saved-area failure reproduced in isolation; the composer test passed with a longer timeout. No live GitHub OAuth round trip was run.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.2-sol(high) | 𝕏

Comment thread package.json
"@vite-hub/realtime": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/realtime@fb731b2f91a8c608f349adf478c3e419459264b7",
"@vite-hub/schedule": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/schedule@fb731b2f91a8c608f349adf478c3e419459264b7",
"@vite-hub/ui": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/ui@fb731b2f91a8c608f349adf478c3e419459264b7",
"@vite-hub/auth": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/auth@a00c3983f0edf939dac9dc8c910e5545cd038392",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 · Class: server-started OAuth loses the trusted client address. On a production Drop, a signed-out visitor can receive 429 on their first click because three other visitors in the previous ten seconds used up the same bucket. The pinned GET handler drops the client address before handing the sign-in to Better Auth, so the previous per-client limit no longer applies to the public links.

Technical details
# Preserve per-client sign-in limits

## Affected sites
- `package.json:57` and `pnpm-workspace.yaml:9` pin the affected build.
- `server/auth.ts:103–112` enables database-backed limits outside dev and configures trusted ingress headers where applicable. Cloudflare and Deno use the address reported by the runtime instead (`shared/client-ip.ts:1–8`).
- The pinned `createSignInResponse()` constructs a new request without either source of client identity. See the [upstream finding](https://github.com/vite-hub/vitehub/pull/4909#discussion_r4612945753) and [Drop's existing ingress-address tests](https://github.com/vite-hub/drop/blob/df4d0d02e0bec3acf1daf2d297ee36a422eb3203/test/auth/client-ip.test.mjs#L53-L87).

## Required outcome
- Pin a build containing the upstream fix before switching the public links. Verify the GET route with production-style limiting: the same client hits its limit, but a different trusted client can still start sign-in.

Comment thread package.json
"@vite-hub/rate-limit": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/rate-limit@a00c3983f0edf939dac9dc8c910e5545cd038392",
"@vite-hub/realtime": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/realtime@a00c3983f0edf939dac9dc8c910e5545cd038392",
"@vite-hub/schedule": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/schedule@a00c3983f0edf939dac9dc8c910e5545cd038392",
"@vite-hub/ui": "https://pkg.pr.new/vite-hub/vitehub/@vite-hub/ui@a00c3983f0edf939dac9dc8c910e5545cd038392",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 · Class: dependency upgrade changes saved-area markers. On a Markdown drop with a saved area comment, the new stylesheet draws a faint neutral border instead of the blue outline and no longer fills the area when its thread is opened. The existing browser test fails in CI and reproduces in isolation on this branch.

Technical details
# Preserve the viewer's saved-area treatment

## Affected sites
- `package.json:67` and `pnpm-workspace.yaml:42` select the new `@vite-hub/ui` stylesheet.
- [`shared/plan-runtime.ts:383–389`](https://github.com/vite-hub/drop/blob/df4d0d02e0bec3acf1daf2d297ee36a422eb3203/shared/plan-runtime.ts#L383-L389) embeds `comment-marks.css` in the frame. The new package mixes `--vh-comment-ink` at 22% for a saved area and 45% for an active area; the old rules used half-strength blue when idle and full blue with a tinted fill when active.
- [`test/viewer/margin-comments-browser.test.mjs:418–474`](https://github.com/vite-hub/drop/blob/df4d0d02e0bec3acf1daf2d297ee36a422eb3203/test/viewer/margin-comments-browser.test.mjs#L418-L474) checks both states.

## Required outcome
- Keep the existing marker behavior in this sign-in PR, either by avoiding the unrelated stylesheet bump or preserving the area styles in Drop's frame. If the marker change is intentional, review it separately rather than changing the assertion just to make this PR pass.

This branch has not been deployed

No deployments
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