Repository navigation
fix: refuse the example secrets everywhere and correct the README claims - #176
Merged
Merged
Conversation
…lte session Every Seamless adapter refuses the .env.example COOKIE_SIGNING_KEY and SEAMLESS_SERVICE_TOKEN as published placeholders unless it runs in insecure local mode, which no starter enables. The READMEs and .env.example comments now say to replace both before the first start. The SvelteKit README explains that its module-level session is safe only with ssr = false.
The starters' startup checks logged that the .env.example secrets were fine for local development, and the adapter then refused them. They now report both placeholders as problems in every environment, with the fix.
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.
Closes #161
Example secrets
The
.env.examplevalues (dev-only-cookie-signing-key-replace-me, 38 characters, andGRAB_FROM_SEAMLESS_AUTH_PORTAL_DEV, 34 characters) pass the 32 character minimum, but every Seamless adapter refuses them as published placeholders unless it runs in insecure local mode (cookieSecure: false,InsecureCookies,insecure_cookies). No starter enables that mode, so a hand-copied.env.examplenever boots. Sources:KNOWN_PLACEHOLDER_SECRETSandassertSecretStrengthinseamless-auth-server/packages/core/src/validateSecrets.ts(in every pinned adapter version: express 0.25, fastify 0.16, nextjs 0.11), and the equivalent lists in seamless-auth-go 0.6, seamless-auth-rust 0.6 and seamless-auth-python 0.6.cp .env.example .env, a note that both secrets are placeholders the adapter refuses, withopenssl rand -base64 48forCOOKIE_SIGNING_KEYand the rule forSEAMLESS_SERVICE_TOKEN(portal value, or the local auth server'sAPI_SERVICE_TOKEN). Each latercp .env.example .envblock carries a comment pointing at it.cp .env.example .envis enough./authrequests rather than at boot, since its configuration is read per request, and the note says that..env.examplefiles: the comments no longer say the cookie key is accepted in development or that the service token "only gets the API to boot". The values are unchanged, because the adapters and each template's own boot check recognise exactly these strings and name the fix.Svelte session
This repo's SvelteKit README never prescribed a singleton; the module-level example the issue describes is the
@seamless-auth/sveltepackage README in seamless-auth-js, which already pairs it withssr = falseand a "Server rendering" section. The template README now has a "Where the session lives" section: the module-level session insrc/lib/auth.tsis safe only becausesrc/routes/+layout.tssetsssr = false, and under server rendering the session must be created per request withinitialSessionfrom the adapter, linking the package README's section.Startup checks
The template startup checks (
src/lib/env.tsin Express and Fastify,src/lib/config.tsin Next.js,config.go,config.rs,config.py) let a placeholder through outside production (the API starters logged "That is fine for local development"; Next.js skipped the check), and the adapter then refused it. They now report both placeholders as problems in every environment, next to any other problem, with theopenssl rand -base64 48fix. The tests that asserted the development allowance now assert the refusal.Checks
Each starter's full gate passes:
npm run checkin Express, Fastify and Next.js;gofmt,go vetandgo testin Gin;cargo fmt --check,clippy -D warningsandcargo testin Axum;ruff,mypyandpytestin FastAPI.npm run validateandnpm run format:checkat the root (pre-commit hook), Svelteformat:check, the Express and Fastifyenv.test.ts, the Next.jsconfig.test.tsand the Axumconfigtests, which read.env.example: all pass. Patch changeset included, since these files ship in scaffolded projects.