@raybase/create 0.3.10 → 0.3.12
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
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`.
|
|
@@ -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
|
|