Repository navigation
Add GitHub account binding and a personal Sealos preview - #108
Draft
PeterGuy326 wants to merge 2 commits into
Draft
PeterGuy326 wants to merge 2 commits into
PeterGuy326 wants to merge 2 commits into
Conversation
sun-970
reviewed
Oct 9, 2026
sun-970
left a comment
Contributor
There was a problem hiding this comment.
Reviewed from outside — no write access on this repository, so this is a comment, not an approval. The account-linking design is sound.
What I verified:
- PKCE + state checks are enabled on the GitHub provider, and
signInfails closed: an explicit but empty/malformedAUTH_GITHUB_ALLOWED_IDSreturnsfalserather than silently opening the instance, and an unset allowlist only permits sign-in outsideDOC_PERSONAL_PREVIEW. fetchVerifiedGitHubProfileuses GitHub's verified primary email, never the unverified public profile field, and validatesidas a positive safe integer withredirect: 'error'and a timeout.- The link intent is HMAC-signed with
AUTH_SECRETand bindsuserId+ a digest of the actual session cookie set; it is consumed one-time through a conditionaldeleteMany(expires > now()), compared withtimingSafeEqualafter a length check, and the cookie is deleted insignIneven on failure — so no replay. authSessionDigestcorrectly handles chunkedauthjs.session-tokencookies and rejects malformed chunk sets instead of hashing a partial set.- Changing
jwtfromtrigger === 'signIn'toif (user?.id)and falling back totoken.subinsessionmakessession.user.idreliable — a real fix, not just a rename.
Questions / nits:
- In
signIn, every non-GitHub provider (email/resend) returnsprocess.env.DOC_PERSONAL_PREVIEW !== '1'— i.e. those providers are blocked when the personal preview flag is on. If that is intended, a one-line comment would stop it reading like an oversight. issueGitHubLinkIntentinserts averificationTokenrow per attempt and nothing sweeps expired ones; with repeated attempts they accumulate. The conditional consume keeps it correct, this is housekeeping only.consumeGitHubLinkIntentrelies on the DB clock forexpires; fine, but worth stating in the PR body so a clock-skewed deploy is not mistaken for a signature bug.
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.
Adds explicit GitHub connection status in profile settings and binds account linking to the user and browser session that started it. GitHub sign-in requires a verified primary email and uses state/PKCE; personal previews can restrict access by stable GitHub user ID. OAuth tokens are not retained.
Adds staged Sealos preview templates: initialize a fresh database, wait for completion, then start web and collaboration. Managed PostgreSQL includes monitoring views in an otherwise empty database. The opt-in guard accepts only eight confirmed views with exact extension membership and canonical definition/owner/dependency fingerprints matching the same server's template1; other relations and protected maintenance/template databases prevent initialization. Credentials stay in runtime Secrets. The preview supports text documents; uploads require separate OSS configuration.
Validation: the initial change passed 423 Vitest tests, 59 Linux CLI tests, production build, formatting/lint, collaboration checks, and three amd64 image builds. The current guard fix passed 23 focused tests, formatting, ESLint, syntax and diff checks. All current GitHub checks and three final image jobs passed for
f7677ce8a1c53dd7b12d6a3474e0567654b8df55.Live Sealos evidence: PostgreSQL 14.16 is Running/Ready. Fresh schema initialization completed with 13 business tables and all eight managed monitoring views preserved. Web and collaboration are Running/Ready with zero restarts, using immutable images copied byte-for-byte into a private regional registry. Public database health, sign-in SSR, GitHub-only provider, anonymous account/link denial, TLS WebSocket upgrade, and the exact GitHub callback with state/PKCE all passed.
Preview: doc. The region's actual domain is sealoshzh.site; GitHub homepage/callback and build-time browser URLs match it. Runtime and pull credentials were configured without printing values. Real GitHub authorization, authenticated document persistence and authenticated collaboration remain unverified; this PR remains a draft pending live acceptance.