@raybase/create 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/raybase-astro-emdash/SKILL.md +2 -2
- package/skills/raybase-astro-emdash-security-review/SKILL.md +2 -2
- package/skills/raybase-auth/SKILL.md +49 -0
- package/skills/raybase-deploy/SKILL.md +3 -1
- package/templates/astro-emdash/dev/CODEBASE-MAP.md +1 -1
- package/templates/astro-emdash/dev/SPEC.md +2 -2
package/package.json
CHANGED
|
@@ -49,8 +49,8 @@ spine mints; the site verifies offline and sets its own cookie.
|
|
|
49
49
|
- The JWKS endpoint is `/.well-known/jwks.json`; it must expose only the public key.
|
|
50
50
|
- `GET /api/handoff/authorize` is the front door a stranger is bounced to; `POST /api/handoff/token` mints for server-side callers. Both require a signed-in Raybase session and must never log or audit raw tokens.
|
|
51
51
|
- `site/src/middleware.ts` mounts `requireHandoff` on `/_emdash/admin*` and nothing else; public pages stay public.
|
|
52
|
-
- The site consumes tokens at `site/src/pages/_raybase/handoff/consume.ts` with `consumeHandoff` from `@raybase/core/handoff-consumer`, which writes the `raybase_handoff` HttpOnly cookie.
|
|
53
|
-
- The bounce carries a `state` nonce matched against the `raybase_handoff_state` cookie the gate set, so a consume URL only works in the browser that started it, and the spine issuer is pinned to `kinds: ["sso"]`.
|
|
52
|
+
- The site consumes tokens at `site/src/pages/_raybase/handoff/consume.ts` with `consumeHandoff` from `@raybase/core/handoff-consumer`, which writes the `__Host-raybase_handoff` HttpOnly cookie (`raybase_handoff` under `astro dev` on local http, where a browser refuses `__Host-`).
|
|
53
|
+
- The bounce carries a `state` nonce matched against the `__Host-raybase_handoff_state` cookie the gate set, so a consume URL only works in the browser that started it, and the spine issuer is pinned to `kinds: ["sso"]`.
|
|
54
54
|
- A handoff session expires rather than being revoked: the cookie lives as long as the token (five minutes by default, fifteen at most), so removing an editor closes the CMS to them within one token life.
|
|
55
55
|
- Raybase roles map to EmDash content roles in `raybaseAuth()` in `site/astro.config.mjs` as:
|
|
56
56
|
- owner/admin → EmDash admin (50)
|
|
@@ -21,9 +21,9 @@ Run this before handoff or deploy review for an `astro-emdash` app.
|
|
|
21
21
|
|
|
22
22
|
- `site/src/pages/_raybase/handoff/consume.ts` mounts `consumeHandoff`, which verifies the signature, issuer, audience, and resource.
|
|
23
23
|
- The return URL accepts only safe relative paths.
|
|
24
|
-
- The handoff cookie is HttpOnly, SameSite=Lax, Secure,
|
|
24
|
+
- The handoff cookie is `__Host-raybase_handoff`: HttpOnly, SameSite=Lax, Secure, `Path=/`, no `Domain`, and expires with the token. The `__Host-` prefix is what stops a sibling host under the same registrable domain from setting or replacing it; only local http (`astro dev`) uses the plain name. Report code that reads or sets the handoff cookies under any other name.
|
|
25
25
|
- `site/src/middleware.ts` mounts `requireHandoff` on `/_emdash/admin*`; a CMS reachable without it is the finding.
|
|
26
|
-
- The bounce is state-bound: the gate sets a `raybase_handoff_state` nonce cookie, consume requires it to match the `state` in the URL and clears it, so a consume URL is useless in another browser.
|
|
26
|
+
- The bounce is state-bound: the gate sets a `__Host-raybase_handoff_state` nonce cookie, consume requires it to match the `state` in the URL and clears it, so a consume URL is useless in another browser.
|
|
27
27
|
- The issuer list pins `kinds: ["sso"]` for the spine, in `site/astro.config.mjs` and in the content door's consumer config; a CMS that accepts pass kinds is the finding.
|
|
28
28
|
- Return paths go through the shared sanitiser: control characters are refused, not just CR/LF, because the URL parser strips TAB/CR/LF and turns them into an open redirect.
|
|
29
29
|
- Error responses use `cache-control: no-store` and do not leak token contents.
|
|
@@ -24,6 +24,13 @@ in app roles and policies; keep identity creation in Raybase-owned routes.
|
|
|
24
24
|
- Sign-in supports passkeys and password fallback for invited users.
|
|
25
25
|
- User, session, account, verification, invite, token, and audit tables are
|
|
26
26
|
Raybase runtime tables. Do not declare them in the app schema.
|
|
27
|
+
- Sign-in cookies are HttpOnly and named by how the app is served: deployed or
|
|
28
|
+
on an `https` auth URL they are `__Host-better-auth.session_token` (and
|
|
29
|
+
`__Host-` for every other sign-in cookie: Secure, `Path=/`, no `Domain`, so
|
|
30
|
+
no sibling host can set or replace them); under `raybase dev` on local http
|
|
31
|
+
they are the plain `better-auth.session_token`. Raybase reads only the name
|
|
32
|
+
it sets. App code never reads or names them; a server-to-server caller
|
|
33
|
+
forwards the browser's whole `Cookie` header.
|
|
27
34
|
- Free-compatible generated specs should say `Auth email features: none`,
|
|
28
35
|
`Invite delivery: admin-shared links`, and `Password recovery:
|
|
29
36
|
admin-assisted`.
|
|
@@ -254,6 +261,48 @@ Two client paths, both Core-owned:
|
|
|
254
261
|
Auth refuses before Core's hook is reached. The flag only asks — a public
|
|
255
262
|
signup mode is still what decides.
|
|
256
263
|
|
|
264
|
+
## Sign-Up Allowlist
|
|
265
|
+
|
|
266
|
+
Where sign-up is open (`auth.signupMode` `"public"` or `"provider-only"`), a
|
|
267
|
+
deploy limits it to named people with `RAYBASE_SIGNUP_ALLOWLIST`: exact
|
|
268
|
+
addresses and `@domain` entries, comma-separated, compared ignoring case
|
|
269
|
+
(`toby@example.com, @example.org`). Set it on the Worker, as a secret when the
|
|
270
|
+
addresses are private; no code change. The app may give a default in
|
|
271
|
+
`appConfig.auth.signupAllowlist: ["@example.com"]`, which the variable replaces
|
|
272
|
+
whenever it holds an entry. An entry that is neither an address nor `@domain`
|
|
273
|
+
matches nothing (doctor reports it); `@example.org` does not match subdomains,
|
|
274
|
+
and `toby+x@example.com` is not `toby@example.com`.
|
|
275
|
+
|
|
276
|
+
With a list set, password sign-up and an outside provider's new account are
|
|
277
|
+
refused for an unlisted address. The refusal never says who is listed: with
|
|
278
|
+
email verification on, an unlisted password sign-up gets the "check your email"
|
|
279
|
+
answer a new address gets, and no mail; without it, the answer an address with
|
|
280
|
+
an account gets. Existing accounts sign in as before, and invites (and owner
|
|
281
|
+
setup) still admit whoever they name: an operator's invite is an admission of
|
|
282
|
+
its own. Do not build an app-side sign-up gate instead; this is the gate.
|
|
283
|
+
|
|
284
|
+
## Sign-In Rate Limits
|
|
285
|
+
|
|
286
|
+
Raybase limits, per address and per client (`cf-connecting-ip`), asking for
|
|
287
|
+
sign-in email (codes, magic links, password-reset links, verification links)
|
|
288
|
+
and wrong sign-in codes. The counters are rows in the app's Durable Object
|
|
289
|
+
(`_auth_rate_limits`, keys HMAC'd under the auth secret), so every isolate
|
|
290
|
+
shares them; Better Auth's own in-memory limiter stands aside on those paths.
|
|
291
|
+
|
|
292
|
+
| Limit | Per address | Per client |
|
|
293
|
+
|---|---|---|
|
|
294
|
+
| `emails` | 3 per 10 minutes | 20 per hour |
|
|
295
|
+
| `wrongCodes` | 10 per hour | 20 per hour |
|
|
296
|
+
|
|
297
|
+
A limited request gets `429`, `Retry-After`, and
|
|
298
|
+
`{ error, message, code: "rate_limited", retryAfter }`, the same for every
|
|
299
|
+
address whether or not it has an account or is listed. A code that signs in is
|
|
300
|
+
not counted. Better Auth's `allowedAttempts` (three tries per code) still ends
|
|
301
|
+
each code. Change numbers with `appConfig.auth.rateLimits` (for example
|
|
302
|
+
`{ emails: { perClient: { max: 50, windowSeconds: 3600 } } }`); every limit
|
|
303
|
+
stays on. Locally the limits hold too: `GET /api/auth/raybase/sign-in-limits`
|
|
304
|
+
shows the counters and `DELETE` clears them (local only).
|
|
305
|
+
|
|
257
306
|
## Runtime Sign-In Links
|
|
258
307
|
|
|
259
308
|
Runtime sign-in links are a separate, email-free capability for moving the
|
|
@@ -143,7 +143,9 @@ triggers, vars and secrets. It needs none of those secrets on the machine: a
|
|
|
143
143
|
fresh clone with no `.raybase/` or `.dev.vars` builds, since the host
|
|
144
144
|
supplies them at upload; `raybase deploy` still needs them locally. Each
|
|
145
145
|
secret in the list has a `kind` (`random-32`, `ec-p256-jwk`,
|
|
146
|
-
`retained-keys`, `provider-api-key
|
|
146
|
+
`retained-keys`, `provider-api-key`, `app-defined` or `address-list`; the last
|
|
147
|
+
is the optional `RAYBASE_SIGNUP_ALLOWLIST` of an app anyone may sign up to,
|
|
148
|
+
which limits sign-up to the people it names). `raybase secrets
|
|
147
149
|
list` explains each secret and `raybase secrets new` prints fresh values, by
|
|
148
150
|
kind, as JSON for `wrangler deploy --secrets-file`. `wrangler deploy` of the
|
|
149
151
|
build then works on any account.
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
- `site/src/components/RaybaseSignedInMenu.astro` - server-rendered floating menu for signed-in CMS/Profile/Admin/Sign out navigation.
|
|
30
30
|
- `site/src/components/blocks/RaybaseActionIsland.astro` - Raybase action island exception for allow-listed Server Island calls.
|
|
31
31
|
- `site/src/middleware.ts` - dispatches the Raybase handoff routes, then gates `/_emdash/admin*`, before the public catch-all renderer.
|
|
32
|
-
- `site/src/pages/_raybase/handoff/consume.ts` - token verification and HttpOnly cookie handoff; it also requires the `raybase_handoff_state` nonce cookie the gate set, so a consume URL only works in the browser that started the bounce.
|
|
32
|
+
- `site/src/pages/_raybase/handoff/consume.ts` - token verification and HttpOnly cookie handoff; it also requires the `__Host-raybase_handoff_state` nonce cookie the gate set (plain names on local http), so a consume URL only works in the browser that started the bounce.
|
|
33
33
|
- `site/src/content-door/raybase-routes.ts handoffConfig()` - the consumer config: the spine is the hub and the only issuer, pinned to `kinds: ["sso"]` because the CMS admits editors and never pass holders.
|
|
34
34
|
- `site/src/pages/_raybase/sign-out/index.ts` - POST route endpoint shim that clears the handoff cookie and uses Raybase logout when spine session cookies are available to the site Worker.
|
|
35
35
|
- `site/src/pages/_raybase/islands/action.ts` - allow-listed Server Island proxy into Raybase actions.
|
|
@@ -7,7 +7,7 @@ This scaffold is a greenfield Raybase Core app with two Workers:
|
|
|
7
7
|
|
|
8
8
|
## Product Boundary
|
|
9
9
|
|
|
10
|
-
The generated product is a public content site with a private editorial door. Operators and content editors sign in to Raybase first. An unsigned-in navigation to `/_emdash/admin` is bounced to the spine's `/api/handoff/authorize`, which mints a short-lived ES256 handoff token for the configured resource; the site consumes it at `/_raybase/handoff/consume`, sets its own `raybase_handoff` cookie, and lands the editor in EmDash admin. Public pages never bounce. The bounce is bound to the browser that started it: the gate sets a `raybase_handoff_state` nonce cookie and puts the same value in the authorize URL, the consume route requires the two to match and clears the cookie, so a consume URL copied into another browser is refused. The site accepts only `kind: "sso"` handoffs from the spine (`kinds: ["sso"]` on the issuer in `site/astro.config.mjs` and the content door), so no pass minted for another resource can be replayed at the CMS.
|
|
10
|
+
The generated product is a public content site with a private editorial door. Operators and content editors sign in to Raybase first. An unsigned-in navigation to `/_emdash/admin` is bounced to the spine's `/api/handoff/authorize`, which mints a short-lived ES256 handoff token for the configured resource; the site consumes it at `/_raybase/handoff/consume`, sets its own `__Host-raybase_handoff` cookie, and lands the editor in EmDash admin. Public pages never bounce. The bounce is bound to the browser that started it: the gate sets a `__Host-raybase_handoff_state` nonce cookie and puts the same value in the authorize URL, the consume route requires the two to match and clears the cookie, so a consume URL copied into another browser is refused. The site accepts only `kind: "sso"` handoffs from the spine (`kinds: ["sso"]` on the issuer in `site/astro.config.mjs` and the content door), so no pass minted for another resource can be replayed at the CMS. Both cookies are `__Host-` (Secure, `Path=/`, no `Domain`), so no sibling host under the same registrable domain can set or replace them; under `astro dev` on local http they are `raybase_handoff` and `raybase_handoff_state`, since a browser refuses `__Host-` there.
|
|
11
11
|
|
|
12
12
|
## Access
|
|
13
13
|
|
|
@@ -39,7 +39,7 @@ public docs on the public site` they move to the public Astro site.
|
|
|
39
39
|
here only together with the sign-in check the raybase-astro-emdash skill
|
|
40
40
|
describes.
|
|
41
41
|
|
|
42
|
-
The public Astro site renders no Raybase private navigation for anonymous visitors. When `site/src/content-door/raybase-routes.ts` can verify a Raybase session through the spine's `/api/account/me`, or can locally verify the short-lived `raybase_handoff` cookie set by the consume route, `site/src/components/RaybaseSignedInMenu.astro` renders a compact floating menu. Non-operator CMS users see CMS, Profile, and Sign out. Operators also see Admin. Profile and Sign out remain Raybase identity surfaces; Admin remains operator-only and direct `/admin` access is still enforced by the Raybase spine.
|
|
42
|
+
The public Astro site renders no Raybase private navigation for anonymous visitors. When `site/src/content-door/raybase-routes.ts` can verify a Raybase session through the spine's `/api/account/me`, or can locally verify the short-lived `__Host-raybase_handoff` cookie set by the consume route, `site/src/components/RaybaseSignedInMenu.astro` renders a compact floating menu. Non-operator CMS users see CMS, Profile, and Sign out. Operators also see Admin. Profile and Sign out remain Raybase identity surfaces; Admin remains operator-only and direct `/admin` access is still enforced by the Raybase spine.
|
|
43
43
|
|
|
44
44
|
The CMS destination path defaults to `/_emdash/admin`. Raybase Admin reads `appConfig.handoff.resources[].returnTo`; the independently deployed content site reads `RAYBASE_CMS_PATH`. Keep them aligned when changing the EmDash route. The public menu position defaults to bottom-right and can be overridden with `RAYBASE_SITE_MENU_POSITION`.
|
|
45
45
|
|