Oficina ID: straight in on the web, and every id.* page in the door's card
Paul's ruling, 2026-11-20. Someone already signed in to id.oficina.works who taps "Continue with Oficina ID" in an app goes straight into the app: GET /authorize/resume mints and renders the form-POST delivery itself (auto-submit, Continue for scripts off). The "Continue to the app" page (id_continue.html) is gone. max_age=300 (linking, every step-up) still sends a standing session to the door for a new gesture first; no session still lands on the door. The POST stays, for a Continue page open in a tab. Slice 1 spec (Assertion and browser exchange, step 2) and the smart-door spec amended in this commit, dated and attributed, with the safety argument from Fable's 2026-11-20 review of connect. The native spec does not reference the web page and is unchanged. Every id.* page now sits in estilo's door card, branded Oficina ID as the sign-in door is: id_replace, id_replaced, id_signed_out and id_signout_all join doorPages; the error page on id.* is id_error.html (estilo-error's words in the card); the hops (assertion, sign-out-all, resolve) use estilo-door-open with the brand at the card's head and keep the sky's placeholder only. The directory's door pages keep "Oficina". No new strings; no script added. Tests: TestIDStraightIn (GET mints, delivery shape, headers, no assertion in URL, cookie or log, finishes), ...WithoutSessionIsTheDoor, ...NeverSkipsForcedAuthentication; error and hop markup tests updated; the scriptless cross-site browser test no longer presses Continue.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 files changed,
+196
−59
AGENTS.md+4 −1docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md+4 −2docs/superpowers/specs/2026-11-19-smart-door.md+3 −3implementation/oficina-id-slice1-copy.md+2 −2internal/home/calma.go+33 −8internal/home/chrome.go+14 −1internal/home/exchange.go+12 −8internal/home/handoff_reveal_test.go+10 −4internal/home/id_browser_test.go+1 −1internal/home/id_exchange_test.go+82 −10internal/home/render.go+1 −1internal/home/shared_chrome_test.go+8 −2internal/home/static/handoff-noscript.css+1 −1internal/home/static/handoff.css+4 −2internal/home/templates/id_continue.html+0 −7internal/home/templates/id_error.html+14 −0internal/home/templates/layout.html+3 −6
CI passed — run details
CI log
amadan: .amadan/timeout: this job's budget is 20m0s (this runner allows up to 30m0s) === vet === CGO_ENABLED=0 go vet ./... CGO_ENABLED=0 go vet -tags browser ./internal/home/ cd handoff && CGO_ENABLED=0 go vet ./... cd roster && CGO_ENABLED=0 go vet ./... cd dashboard && CGO_ENABLED=0 go vet ./... cd connect && CGO_ENABLED=0 go vet ./... cd teammode && CGO_ENABLED=0 go vet ./... === fmt === === build === CGO_ENABLED=0 go build ./... CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/home ./cmd/oficina ./internal/operatorlaunch cd handoff && CGO_ENABLED=0 go build ./... cd roster && CGO_ENABLED=0 go build ./... cd dashboard && CGO_ENABLED=0 go build ./... cd connect && CGO_ENABLED=0 go build ./... cd teammode && CGO_ENABLED=0 go build ./... === go-test === CGO_ENABLED=0 go test -count=1 ./... ? amadan.net/oficina/home/cmd/home [no test files] ok amadan.net/oficina/home/cmd/home-placeholder 0.950s ? amadan.net/oficina/home/cmd/oficina [no test files] ok amadan.net/oficina/home/internal/guardstest 0.244s ok amadan.net/oficina/home/internal/home 55.824s ok amadan.net/oficina/home/internal/home/directorydata 1.391s ok amadan.net/oficina/home/internal/home/logtest 0.006s ok amadan.net/oficina/home/internal/home/seal 0.006s ok amadan.net/oficina/home/internal/home/sealtest 0.002s ok amadan.net/oficina/home/internal/home/wisp 0.044s ok amadan.net/oficina/home/internal/operator 6.405s ok amadan.net/oficina/home/internal/operatorlaunch 4.111s ok amadan.net/oficina/home/internal/provisioner 48.612s cd handoff && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/handoff 0.659s ok amadan.net/oficina/home/handoff/seal 0.002s cd roster && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/roster 5.116s cd dashboard && CGO_ENABLED=0 go test ./... ok amadan.net/oficina/home/dashboard 0.010s cd connect && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/connect 1.394s ok amadan.net/oficina/home/connect/linkstore 0.491s cd teammode && CGO_ENABLED=0 go test -count=1 ./... ok amadan.net/oficina/home/teammode 0.097s ? amadan.net/oficina/home/teammode/teammodetest [no test files] === race === go test -race -count=1 ./internal/home/ ./internal/operator/ ./internal/operatorlaunch/ ./internal/home/directorydata/ ok amadan.net/oficina/home/internal/home 332.579s ok amadan.net/oficina/home/internal/operator 82.227s ok amadan.net/oficina/home/internal/operatorlaunch 22.383s ok amadan.net/oficina/home/internal/home/directorydata 23.296s ok amadan.net/oficina/home/internal/provisioner 395.831s cd handoff && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/handoff 13.009s ok amadan.net/oficina/home/handoff/seal 1.015s cd roster && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/roster 6.983s cd dashboard && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/dashboard 1.067s cd connect && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/connect 6.479s ok amadan.net/oficina/home/connect/linkstore 6.602s cd teammode && CGO_ENABLED=1 go test -race -count=1 ./... ok amadan.net/oficina/home/teammode 1.985s ? amadan.net/oficina/home/teammode/teammodetest [no test files]
diff --git a/AGENTS.md b/AGENTS.md| index a64eb80..73331fb 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -465,7 +465,10 @@ quietly ignored). |
| which keeps its own design. On the directory a signed-in person has one |
| account menu (Passkeys and Recovery codes on id.*, Appearance, Help → |
| Open source, the one Sign out); id.*'s pages are the door, with a |
| - brand-only bar. Unknown routes get estilo's error page for a browser |
| + brand-only bar: every one sits in the door's card, branded Oficina ID |
| + as its sign-in door is, its error page and hops included (Paul, |
| + 2026-11-20; `doorPages`, `hopPages`, `id_error.html`), Open source's |
| + long list being the one exception. Unknown routes get estilo's error page for a browser |
| (`Accept: text/html`) and plain text otherwise. Calma's sky goes only on |
| the door, the team home's header and the front page's hero. Home does |
| not load estilo's `chrome.js`: its menus work without it, and the |
diff --git a/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md b/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md| index 03d5063..45d59a1 100644 |
| --- a/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md |
| +++ b/docs/superpowers/specs/2026-11-13-oficina-id-slice-1.md |
| @@ -1,6 +1,6 @@ |
| # 🤖 Oficina ID: slice 1 |
| -Status: revised design, 2026-11-13, applying Paul's rulings and Fable's READY AFTER FIXES review as supplied by Paul. Independently reviewed after these fixes by GPT-6 Astra (`gpt-6-astra`): acceptable as a spec, no blocking findings. Author: Codex. No implementation, deployment or merge approval. |
| +Status: revised design, 2026-11-13, applying Paul's rulings and Fable's READY AFTER FIXES review as supplied by Paul. Independently reviewed after these fixes by GPT-6 Astra (`gpt-6-astra`): acceptable as a spec, no blocking findings. Author: Codex. No implementation, deployment or merge approval. Amended 2026-11-20 by Paul's web straight-in ruling (Assertion and browser exchange, step 2), built on Home `feat/web-straight-in`. |
| ## Decision and boundary |
| @@ -55,10 +55,12 @@ Reuse `rastrillo/assertion` v1: P-256, context `rastrillo/assertion/v1`, `base64 |
| No email, role, grants, document list, encryption keys or authentication-strength claim. Existing roster hints remain separately reviewed, invalidation-only exceptions under Home §5.4. |
| 1. The app stores a short-lived transaction with independent browser secret, nonce, purpose and validated local return path/query. Set a `__Host-` pending cookie. Redirect to `/authorize` with exactly one `consumer`, one `nonce`, and optionally one `max_age=300`. No other parameters, duplicates or other `max_age` values; this matches `handleAuthorize`'s closed parser. Linking always includes `max_age=300`. Local accounts, documents and privileges stay app-side. |
| -2. Home validates the consumer and authenticates. For an ordinary existing session, **show a fixed-label Continue page before minting**; do not issue silently. Use operator-controlled service labels, no account-authored text. Linking always requires new authentication, regardless of session age. After Continue/authentication, deliver by form POST with optional static auto-submit and a manual button. Never put assertions in URLs or logs; use `no-store` and `strict-origin-when-cross-origin`, since `no-referrer` can null the POST Origin. |
| +2. Home validates the consumer and authenticates. For an ordinary existing session, **mint straight away, with no Continue page** (amended 2026-11-20 by Paul's straight-in ruling, below; it used to show a fixed-label Continue page before minting). Use operator-controlled service labels, no account-authored text. Linking always requires new authentication, regardless of session age. After authentication, deliver by form POST with optional static auto-submit and a manual button. Never put assertions in URLs or logs; use `no-store` and `strict-origin-when-cross-origin`, since `no-referrer` can null the POST Origin. |
| 3. Accept only a bounded form POST with exact issuer `Origin`. Verify signature, issuer, audience, types and times. Before storing a receipt, require its signed nonce to match a live pending transaction; check and insert atomically. Reserve `(iss,jti)` uniquely so repeated callbacks refuse. Unknown nonces and storage failures store nothing. |
| 4. Store a sealed, expiring inbox receipt, then redirect to `/auth/finish`. Its top-level GET receives the original SameSite=Lax cookie. Recheck the browser secret, nonce, expiry and account binding. Consume the pending/inbox proof, record replay use, resolve the current mapping/admission and mint the session atomically. Preserve the clock watermark and replay retention through expiry plus thirty seconds across restarts. Never mint at the cross-site POST. |
| +**Straight in on the web (Paul's ruling, 2026-11-20).** Someone already signed in to id.* who taps "Continue with Oficina ID" in an app goes straight into the app, as the native apps already do (Paul's 11-19 "one ID = straight in", native spec §9). `GET /authorize/resume` mints and renders the form-POST delivery itself (auto-submit, with the Continue button for scripts off); the "Continue to the app" page is gone. Safety (Fable's review of connect, 2026-11-20): a third-party-triggered GET to the app's `/signin/oficina` or `/auth/start`, or to `/authorize`, binds the exchange to the victim's own pending cookie, the victim's own id.* session and an assertion posted from the victim's own browser, so no attacker identity can be planted; the worst case is signing the victim in to their own account. Unchanged: `max_age=300` (linking, and every step-up) still sends a standing session to the door for a new authentication gesture before anything is minted (Linking and unlinking, below); without an id.* session the request still lands on the sign-in door; the assertion still never appears in a URL or a log. |
| + |
| The final transaction boundary is a required adapter change: today's `handoff.Finish` commits before `Complete`. Do not leave a consumed proof in memory that can mint after unlink/relink. Reject swapped browsers, purposes or accounts; an assertion cannot silently replace another signed-in account. Only the callback bypasses ordinary cross-origin request-forgery checks. Bound pending/inbox rows and prune them; keep local return queries app-side. |
| ## Linking and unlinking |
diff --git a/docs/superpowers/specs/2026-11-19-smart-door.md b/docs/superpowers/specs/2026-11-19-smart-door.md| index 6a97345..585a265 100644 |
| --- a/docs/superpowers/specs/2026-11-19-smart-door.md |
| +++ b/docs/superpowers/specs/2026-11-19-smart-door.md |
| @@ -191,9 +191,9 @@ request can do is forget. |
| **The returning path for an Oficina ID user** on an app: tap Continue with |
| Oficina ID; id.oficina.works opens on Sign in with your passkey; one touch; |
| -back in the app. If an id.* session is still alive, it's the existing |
| -Continue page instead of the passkey. Skipping that Continue stays a separate |
| -question (native spec, question 3). |
| +back in the app. If an id.* session is still alive, there is no door at all: |
| +straight back in the app (Paul's ruling 2026-11-20, which retired the |
| +Continue page; slice 1 spec, Assertion and browser exchange, step 2). |
| ## The cookie |
diff --git a/implementation/oficina-id-slice1-copy.md b/implementation/oficina-id-slice1-copy.md| index b1203b7..9c2f422 100644 |
| --- a/implementation/oficina-id-slice1-copy.md |
| +++ b/implementation/oficina-id-slice1-copy.md |
| @@ -19,8 +19,8 @@ Reviewed by GPT-6 Astra. Fixed labels only; no account-authored text. |
| - A replacement passkey was added to your Oficina account. All previous passkeys were removed, all Oficina ID sessions were signed out, and all recovery codes were invalidated. You may remain signed in to the directory and other apps. Sign in with your new passkey to create new recovery codes. |
| - Your passkeys were replaced, but we could not send the confirmation email. |
| - Send email again |
| -- Continue to the app · Oficina |
| -- Continue to the app |
| +- ~~Continue to the app · Oficina~~ (retired 2026-11-20: straight in, Paul's ruling; the page is gone) |
| +- ~~Continue to the app~~ (retired 2026-11-20, as above) |
| - Continue |
| - Signed out · Oficina |
| - You are signed out |
diff --git a/internal/home/calma.go b/internal/home/calma.go| index 7d77449..1f66a96 100644 |
| --- a/internal/home/calma.go |
| +++ b/internal/home/calma.go |
| @@ -45,24 +45,38 @@ var homeFuncs = map[string]any{ |
| "forgetLabel": func() string { return chrome.English.Forget }, |
| "linkLifetime": func() int { return int(chrome.LinkLifetime.Minutes()) }, |
| // doorView is estilo-door-open's data: the suite's sky behind one |
| - // card, the Oficina mark and name at its head. |
| - "doorView": func() doorView { |
| - return doorView{Sky: sky.For(sky.SuiteSeed), Icon: versioned("/static/brand/icon.svg"), App: suiteName} |
| + // card, the Oficina mark and the page's brand at its head (page.Brand: |
| + // "Oficina ID" on id.*, as on its sign-in door; "Oficina" on the |
| + // directory). |
| + "doorView": func(brand any) doorView { |
| + return doorView{Sky: sky.For(sky.SuiteSeed), Icon: versioned("/static/brand/icon.svg"), App: brandOr(brand)} |
| }, |
| - // hopSky is the sky a hop page keeps: the inline placeholder alone, a |
| - // data: URI, so the moment between two skies is not a blank page and |
| - // still fetches nothing it will not show (r3 C2). |
| - "hopSky": func() sky.View { |
| + // hopDoor is the door a hop page keeps: the same card and brand, on |
| + // the sky's inline placeholder alone, a data: URI, so the moment |
| + // between two skies is not a blank page and still fetches nothing it |
| + // will not show (r3 C2). The card itself stays hidden unless the hop |
| + // stalls (handoff.css). |
| + "hopDoor": func(brand any) doorView { |
| var v sky.View |
| for _, l := range sky.For(sky.SuiteSeed).Layers { |
| if l.Inline != "" { |
| v.Layers = append(v.Layers, l) |
| } |
| } |
| - return v |
| + return doorView{Sky: v, Icon: versioned("/static/brand/icon.svg"), App: brandOr(brand)} |
| }, |
| } |
| +// brandOr is the brand a door card names: the page's, else the suite's. |
| +// It takes any because a page drawn with bare data in a test has no |
| +// Brand at all. |
| +func brandOr(brand any) string { |
| + if s, ok := brand.(string); ok && s != "" { |
| + return s |
| + } |
| + return suiteName |
| +} |
| + |
| // doorView is estilo-door-open's data (chrome/templates/signin.html). |
| type doorView struct { |
| Sky sky.View |
| @@ -81,7 +95,18 @@ const suiteName = "Oficina" |
| // error pages are plain pages under the bar. |
| // Not assertion.html or docs_continue.html: they are hops (hopPages). Not |
| // door.html either: estilo-signin-screen draws the door itself. |
| +// |
| +// Every page id.* draws is the door or a hop (Paul, 2026-11-20: every id.* |
| +// page in the door's card), the error page included: on id.* it is |
| +// id_error.html, the same words in the card (chrome.go, errorPage). The |
| +// one exception is Open source (credits.html), a long list that is the |
| +// same page on both origins. |
| var doorPages = map[string]bool{ |
| + "id_error.html": true, |
| + "id_replace.html": true, |
| + "id_replaced.html": true, |
| + "id_signed_out.html": true, |
| + "id_signout_all.html": true, |
| "id_forget.html": true, |
| "signin_confirm.html": true, |
| "signin_failed.html": true, |
diff --git a/internal/home/chrome.go b/internal/home/chrome.go| index 08de0fa..928e1de 100644 |
| --- a/internal/home/chrome.go |
| +++ b/internal/home/chrome.go |
| @@ -39,6 +39,10 @@ type page struct { |
| // Theme is <html data-theme>: "light", "dark", or empty to follow the |
| // system (the Appearance preference, per host). |
| Theme string |
| + // Brand is the name at the head of a door or hop card: "Oficina ID" |
| + // on id.*, as its sign-in door says (doorName); empty, which draws |
| + // "Oficina", on the directory. |
| + Brand string |
| } |
| // The account menu's and the bar's words. Home speaks English only today; |
| @@ -60,6 +64,9 @@ func (a *App) onCredential(r *http.Request) bool { |
| // text, so the page still holds exactly one link, the way on. |
| func (a *App) pageFor(r *http.Request, status int, data any, door, hop bool) page { |
| p := page{Data: data} |
| + if a.onCredential(r) { |
| + p.Brand = doorName |
| + } |
| brand := chrome.App{Name: suiteName, Slug: "oficina", Home: "/", Icon: versioned("/static/brand/icon.svg")} |
| if hop { |
| brand.Home = "" |
| @@ -205,7 +212,13 @@ func (a *App) errorPage(w http.ResponseWriter, r *http.Request, status int) { |
| data.Back = &chrome.Link{Href: r.URL.RequestURI(), Label: "Try again"} |
| } |
| } |
| - a.renderPage(w, r, status, "error.html", errorView{chrome.Title(c.page, suiteName), data}) |
| + // On id.* the same words sit in the door's card (Paul, 2026-11-20: |
| + // every id.* page in the door's card); elsewhere, estilo's error page. |
| + name := "error.html" |
| + if a.onCredential(r) { |
| + name = "id_error.html" |
| + } |
| + a.renderPage(w, r, status, name, errorView{chrome.Title(c.page, suiteName), data}) |
| } |
| // errorView is error.html's data: the tab title and estilo-error's. |
diff --git a/internal/home/exchange.go b/internal/home/exchange.go| index e9023bd..e867848 100644 |
| --- a/internal/home/exchange.go |
| +++ b/internal/home/exchange.go |
| @@ -121,14 +121,18 @@ func (a *App) handleAssertion(w http.ResponseWriter, r *http.Request) { |
| a.failAssertion(w, r, assertionConsumer) |
| return |
| } |
| - if r.Method == http.MethodGet { |
| - if tx.Commit() != nil { |
| - a.failAssertion(w, r, assertionSession) |
| - return |
| - } |
| - a.render(w, r, http.StatusOK, "id_continue.html", nil) |
| - return |
| - } |
| + // Straight in (Paul, 2026-11-20; slice 1 spec, "Assertion and browser |
| + // exchange" step 2): someone already signed in to id.* goes straight |
| + // to the app. The GET mints, with no "Continue to the app" page. A |
| + // GET anyone can trigger is safe here because everything it binds to |
| + // is the victim's own: the intent cookie this browser was given by |
| + // /authorize, this browser's id.* session, and the delivery, a form |
| + // POST from this browser to the consumer, whose callback matches the |
| + // nonce against that browser's own pending cookie. The worst a |
| + // third-party GET can do is sign the victim in to their own account. |
| + // A step-up or a link (max_age) never reaches here on a standing |
| + // session: the check above sent it to the door for a new gesture. |
| + // The POST is kept for a Continue page still open in a tab. |
| id, err := assertion.RandomID() |
| if err != nil { |
| a.failAssertion(w, r, assertionRandom) |
diff --git a/internal/home/handoff_reveal_test.go b/internal/home/handoff_reveal_test.go| index 8872b52..4840566 100644 |
| --- a/internal/home/handoff_reveal_test.go |
| +++ b/internal/home/handoff_reveal_test.go |
| @@ -44,10 +44,10 @@ func TestHandoffInterstitialStaysHiddenWhileItAutoSubmits(t *testing.T) { |
| } |
| for path, wants := range map[string][]string{ |
| "/static/handoff.css": { |
| - "[estilo-handoff]{animation:estilo-reveal0s1.5sboth;}", |
| + "[estilo-door]>[estilo-signin]{animation:estilo-reveal0s1.5sboth;}", |
| "@keyframesestilo-reveal{from{visibility:hidden}to{visibility:visible}}", |
| }, |
| - "/static/handoff-noscript.css": {"[estilo-handoff]{animation:none;}"}, |
| + "/static/handoff-noscript.css": {"[estilo-door]>[estilo-signin]{animation:none;}"}, |
| } { |
| for _, host := range []string{credentialHost, directoryHost} { |
| req := httptest.NewRequest(http.MethodGet, path, nil) |
| @@ -70,10 +70,16 @@ func TestHandoffInterstitialStaysHiddenWhileItAutoSubmits(t *testing.T) { |
| // bar and the sky's placeholder sit outside it, so the hop is never a |
| // blank page (r3 C2). |
| main := body[strings.Index(body, "<main"):strings.Index(body, "</main>")] |
| - start := strings.Index(main, "<section estilo-signin estilo-handoff>") |
| - if start < 0 || !strings.Contains(main[:start], `estilo-sky-layer="placeholder"`) { |
| + // The card is the door's, with the brand at its head (Paul, |
| + // 2026-11-20: every id.* page in the door's card); handoff.css hides |
| + // it, and only the sky's inline placeholder is behind it. |
| + start := strings.Index(main, "<section estilo-signin>") |
| + if start < 0 || !strings.Contains(main[:start], `<div estilo-door estilo-sky-host>`) || !strings.Contains(main[:start], `estilo-sky-layer="placeholder"`) || strings.Count(main[:start], "estilo-sky-layer=") != strings.Count(main[:start], `estilo-sky-layer="placeholder"`) { |
| t.Fatalf("content not wrapped in the hidden card on the sky:\n%s", main) |
| } |
| + if !strings.Contains(main[start:], `<span>Oficina</span></p>`) || !strings.Contains(main[start:], `<p estilo-brand><img estilo-brand-icon="listing"`) { |
| + t.Fatalf("the hidden card has no brand at its head:\n%s", main) |
| + } |
| inner := main[start:strings.Index(main, "</section>")] |
| if !strings.Contains(inner, `data-assertion-handoff`) || !strings.Contains(inner, `<button type="submit" rst-btn="primary">Continue</button>`) { |
| t.Fatalf("hand-off form changed:\n%s", inner) |
diff --git a/internal/home/id_browser_test.go b/internal/home/id_browser_test.go| index d1692a3..0dd980e 100644 |
| --- a/internal/home/id_browser_test.go |
| +++ b/internal/home/id_browser_test.go |
| @@ -171,7 +171,7 @@ func TestIDBrowserScriptlessCrossSiteReturn(t *testing.T) { |
| p, ctx, _ := idBrowser(t) |
| idBrowserRun(t, ctx, cdpStep(emulation.SetScriptExecutionDisabled, emulation.SetScriptExecutionDisabledParams{Value: true}), chromedp.Navigate(p.directory.origins.Directory+"/auth/start"), chromedp.WaitVisible("#rst-signin-email"), chromedp.SendKeys("#rst-signin-email", sealtest.CanaryAddress), chromedp.Click(`form[action="/signin"] button`), chromedp.WaitVisible(`form[action="/signin/forget"] button`)) |
| token := capturedLink(t, p.credential) |
| - idBrowserRun(t, ctx, chromedp.Navigate(browserIssuer+linkPath+"?token="+url.QueryEscape(token)), chromedp.WaitVisible(`form[action="/signin/verify"] button`), chromedp.Click(`form[action="/signin/verify"] button`), chromedp.WaitVisible(`form[action="/authorize/resume"] button`), chromedp.Click(`form[action="/authorize/resume"] button`), chromedp.WaitVisible(`form[data-assertion-handoff] button`), chromedp.Click(`form[data-assertion-handoff] button`), chromedp.WaitVisible(`[estilo-account]`)) |
| + idBrowserRun(t, ctx, chromedp.Navigate(browserIssuer+linkPath+"?token="+url.QueryEscape(token)), chromedp.WaitVisible(`form[action="/signin/verify"] button`), chromedp.Click(`form[action="/signin/verify"] button`), chromedp.WaitVisible(`form[data-assertion-handoff] button`), chromedp.Click(`form[data-assertion-handoff] button`), chromedp.WaitVisible(`[estilo-account]`)) |
| var location string |
| idBrowserRun(t, ctx, harness.Into(&location, chromedp.Location())) |
| if !strings.HasPrefix(location, p.directory.origins.Directory+"/") { |
diff --git a/internal/home/id_exchange_test.go b/internal/home/id_exchange_test.go| index f201db2..1679e8d 100644 |
| --- a/internal/home/id_exchange_test.go |
| +++ b/internal/home/id_exchange_test.go |
| @@ -1,14 +1,17 @@ |
| package home |
| import ( |
| + "amadan.net/oficina/home/handoff" |
| "amadan.net/rastrillo/rastrillo/assertion" |
| "amadan.net/rastrillo/rastrillo/sessions" |
| "encoding/base64" |
| "encoding/json" |
| "github.com/keymaildev/signin" |
| + "html" |
| "net/http" |
| "net/http/httptest" |
| "net/url" |
| + "regexp" |
| "strings" |
| "testing" |
| "time" |
| @@ -29,21 +32,90 @@ func TestIDLinkAlwaysRequiresNewGesture(t *testing.T) { |
| } |
| } |
| -func TestIDContinueBeforeMinting(t *testing.T) { |
| +// TestIDStraightIn is Paul's straight-in ruling (2026-11-20; slice 1 |
| +// spec, Assertion and browser exchange, step 2): with an id.* session |
| +// and no forced authentication, the GET that lands on /authorize/resume |
| +// mints and renders the form-POST delivery itself, with no Continue page. |
| +// The assertion rides only the form body: never the URL, a redirect or a |
| +// log line. |
| +func TestIDStraightIn(t *testing.T) { |
| p := newExchangePair(t) |
| session := signInFully(t, p.credential, sealtest.CanaryAddress) |
| - _, intent := p.start(t) |
| + pending, intent := p.start(t) |
| r := exchangeRequest(p.credential.App, "GET", Origin+"/authorize/resume", "", nil, intent, session) |
| - if r.Code != 200 || strings.Contains(r.Body.String(), `name="assertion"`) || !strings.Contains(r.Body.String(), `action="/authorize/resume"`) { |
| - t.Fatal("GET did not stop at Continue", r.Code) |
| + body := r.Body.String() |
| + m := regexp.MustCompile(`name="assertion" value="([^"]+)"`).FindStringSubmatch(body) |
| + if r.Code != 200 || len(m) != 2 { |
| + t.Fatal("GET did not go straight in", r.Code) |
| + } |
| + token := html.UnescapeString(m[1]) |
| + if strings.Contains(body, `action="/authorize/resume"`) || strings.Contains(body, "Continue to the app") { |
| + t.Fatal("the Continue page is still drawn") |
| + } |
| + // The delivery is the hop: auto-submit, with Continue for script-off. |
| + for _, want := range []string{`action="` + directoryOrigin + handoff.CallbackPath + `"`, `data-assertion-handoff`, `<button type="submit" rst-btn="primary">Continue</button>`, versioned("/static/assertion.js")} { |
| + if !strings.Contains(body, want) { |
| + t.Fatalf("delivery lacks %q", want) |
| + } |
| + } |
| + if r.Header().Get("Cache-Control") != "no-store" || r.Header().Get("Referrer-Policy") != "strict-origin-when-cross-origin" || r.Header().Get("Location") != "" { |
| + t.Fatal("delivery headers changed", r.Header()) |
| + } |
| + cleared := false |
| + for _, c := range r.Result().Cookies() { |
| + cleared = cleared || (c.Name == assertionIntentCookie && c.MaxAge < 0) |
| + } |
| + if !cleared { |
| + t.Fatal("intent survived the mint") |
| + } |
| + for _, h := range r.Header().Values("Set-Cookie") { |
| + if strings.Contains(h, token) { |
| + t.Fatal("assertion in a cookie") |
| + } |
| + } |
| + if strings.Contains(p.logs.String(), token) || strings.Contains(p.logs.String(), sealtest.CanaryAddress) { |
| + t.Fatal("assertion or address in the logs") |
| + } |
| + // And it finishes: the app's callback takes it. |
| + if p.finish(t, token, pending) == nil { |
| + t.Fatal("no app session") |
| + } |
| + // The POST still mints, for a Continue page left open in a tab, and |
| + // still behind csrf.Protect. |
| + _, again := p.start(t) |
| + if bad := exchangeRequest(p.credential.App, "POST", Origin+"/authorize/resume", "https://evil.invalid", url.Values{}, again, session); bad.Code != 403 { |
| + t.Fatal("POST lacks CSRF protection", bad.Code) |
| } |
| - bad := exchangeRequest(p.credential.App, "POST", Origin+"/authorize/resume", "https://evil.invalid", url.Values{}, intent, session) |
| - if bad.Code != 403 { |
| - t.Fatal("Continue lacks CSRF protection", bad.Code) |
| + if good := exchangeRequest(p.credential.App, "POST", Origin+"/authorize/resume", Origin, url.Values{}, again, session); good.Code != 200 || !strings.Contains(good.Body.String(), `name="assertion"`) { |
| + t.Fatal("POST did not mint", good.Code) |
| + } |
| +} |
| + |
| +// TestIDStraightInWithoutSessionIsTheDoor: no id.* session, no mint; the |
| +// sign-in door, coming back to the resume. |
| +func TestIDStraightInWithoutSessionIsTheDoor(t *testing.T) { |
| + p := newExchangePair(t) |
| + _, intent := p.start(t) |
| + r := exchangeRequest(p.credential.App, "GET", Origin+"/authorize/resume", "", nil, intent) |
| + if r.Code != http.StatusSeeOther || !strings.HasPrefix(r.Header().Get("Location"), "/signin") || strings.Contains(r.Body.String(), `name="assertion"`) { |
| + t.Fatal("no session did not go to the door", r.Code, r.Header().Get("Location")) |
| + } |
| +} |
| + |
| +// TestIDStraightInNeverSkipsForcedAuthentication: a link or a step-up |
| +// (max_age=300) on a standing session, however recent, still goes to the |
| +// door for a new gesture; after that gesture the GET goes straight in. |
| +func TestIDStraightInNeverSkipsForcedAuthentication(t *testing.T) { |
| + p := newExchangePair(t) |
| + session := signInFully(t, p.credential, sealtest.CanaryAddress) |
| + _, intent := p.startFresh(t, session) |
| + r := exchangeRequest(p.credential.App, "GET", Origin+"/authorize/resume", "", nil, intent, session) |
| + if r.Code != http.StatusSeeOther || !strings.HasPrefix(r.Header().Get("Location"), "/signin?") || strings.Contains(r.Body.String(), `name="assertion"`) { |
| + t.Fatal("forced authentication was skipped", r.Code) |
| } |
| - good := exchangeRequest(p.credential.App, "POST", Origin+"/authorize/resume", Origin, url.Values{}, intent, session) |
| - if good.Code != 200 || !strings.Contains(good.Body.String(), `name="assertion"`) { |
| - t.Fatal("Continue did not mint", good.Code) |
| + fresh := signInFully(t, p.credential, sealtest.CanaryAddress) |
| + if after := exchangeRequest(p.credential.App, "GET", Origin+"/authorize/resume", "", nil, intent, fresh); after.Code != 200 || !strings.Contains(after.Body.String(), `name="assertion"`) { |
| + t.Fatal("a fresh gesture did not go straight in", after.Code) |
| } |
| } |
diff --git a/internal/home/render.go b/internal/home/render.go| index e5e645d..7d488ec 100644 |
| --- a/internal/home/render.go |
| +++ b/internal/home/render.go |
| @@ -140,7 +140,7 @@ func (a *App) renderPage(w http.ResponseWriter, r *http.Request, status int, nam |
| // renderFailed answers a page that could not be drawn: the 500 page, |
| // unless the page that failed was the error page itself. |
| func (a *App) renderFailed(w http.ResponseWriter, r *http.Request, name string) { |
| - if name == "error.html" || r == nil { |
| + if name == "error.html" || name == "id_error.html" || r == nil { |
| http.Error(w, "internal error", http.StatusInternalServerError) |
| return |
| } |
diff --git a/internal/home/shared_chrome_test.go b/internal/home/shared_chrome_test.go| index 1731934..712c3ca 100644 |
| --- a/internal/home/shared_chrome_test.go |
| +++ b/internal/home/shared_chrome_test.go |
| @@ -366,8 +366,14 @@ func TestErrorPagesSplitByAccept(t *testing.T) { |
| if rec.Code != http.StatusNotFound || !strings.HasPrefix(rec.Header().Get("Content-Type"), "text/html") { |
| t.Fatalf("browser: %d %q, want a 404 page", rec.Code, rec.Header().Get("Content-Type")) |
| } |
| - if titleOf(body) != "Page not found · Oficina" || !strings.Contains(body, "<div rst-error>") || !strings.Contains(body, "We can’t find that page") || !strings.Contains(body, "<header estilo-bar") { |
| - t.Errorf("not estilo's error page under the bar: %q", titleOf(body)) |
| + // On id.* the same words sit in the door's card, branded |
| + // Oficina ID (Paul, 2026-11-20: every id.* page in the card). |
| + onID := strings.HasPrefix(c.name, "id.*") |
| + if titleOf(body) != "Page not found · Oficina" || strings.Contains(body, "<div rst-error>") == onID || !strings.Contains(body, "We can’t find that page") || !strings.Contains(body, "<header estilo-bar") { |
| + t.Errorf("not the error page under the bar: %q", titleOf(body)) |
| + } |
| + if onID && (!strings.Contains(body, "<div estilo-door estilo-sky-host>") || !strings.Contains(body, "<span>Oficina ID</span>") || !strings.Contains(body, `<a rst-btn="primary" href="`+directoryOrigin+`/">Go to Oficina</a>`)) { |
| + t.Errorf("id.*'s error page is not in the door's card:\n%s", body) |
| } |
| if got := strings.Contains(body, "<details estilo-account"); got != c.account { |
| t.Errorf("account menu %v, want %v", got, c.account) |
diff --git a/internal/home/static/handoff-noscript.css b/internal/home/static/handoff-noscript.css| index 710cab1..8b5ea44 100644 |
| --- a/internal/home/static/handoff-noscript.css |
| +++ b/internal/home/static/handoff-noscript.css |
| @@ -1,3 +1,3 @@ |
| /* With scripts off nothing submits, so the hand-off card shows at once. |
| Linked inside <noscript> on each hop page. */ |
| -[estilo-handoff] { animation: none; } |
| +[estilo-door] > [estilo-signin] { animation: none; } |
diff --git a/internal/home/static/handoff.css b/internal/home/static/handoff.css| index b16dd63..e506985 100644 |
| --- a/internal/home/static/handoff.css |
| +++ b/internal/home/static/handoff.css |
| @@ -2,6 +2,8 @@ |
| so the card stays hidden for 1.5 s and shows only if the submit stalls |
| (spec shared-chrome §9.3). Linked from each hop page's head. A file, not |
| a <style> block: rastrillo's default CSP, which Home keeps, allows no |
| - inline style since v0.27.0. */ |
| -[estilo-handoff] { animation: estilo-reveal 0s 1.5s both; } |
| + inline style since v0.27.0. The card is the door's (estilo-door-open, |
| + with the brand at its head); this file is linked only from hop pages, |
| + so the rule hides no other page's card. */ |
| +[estilo-door] > [estilo-signin] { animation: estilo-reveal 0s 1.5s both; } |
| @keyframes estilo-reveal { from { visibility: hidden } to { visibility: visible } } |
diff --git a/internal/home/templates/id_continue.html b/internal/home/templates/id_continue.html| deleted file mode 100644 |
| index 90e4f07..0000000 |
| --- a/internal/home/templates/id_continue.html |
| +++ /dev/null |
| @@ -1,7 +0,0 @@ |
| -{{define "title"}}Continue to the app · Oficina{{end}} |
| -{{define "content"}} |
| -<h1>Continue to the app</h1> |
| -<form method="post" action="/authorize/resume" rst-form> |
| -<button type="submit" rst-btn="primary">Continue</button> |
| -</form> |
| -{{end}} |
diff --git a/internal/home/templates/id_error.html b/internal/home/templates/id_error.html| new file mode 100644 |
| index 0000000..34d2add |
| --- /dev/null |
| +++ b/internal/home/templates/id_error.html |
| @@ -0,0 +1,14 @@ |
| +{{define "title"}}{{.Data.Title}}{{end}} |
| +{{define "content"}} |
| +{{/* estilo-error's words (chrome.ErrorPage) in the door's card, on id.* |
| + only (chrome.go, errorPage). */}} |
| +{{- with .Data.Error}} |
| +<h1>{{.Title}}</h1> |
| +<p estilo-signin-body>{{.Body}}</p> |
| +<p><a rst-btn="primary" href="{{.Home.Href}}">{{.Home.Label}}</a> |
| + {{- with .Back}} <a rst-btn href="{{.Href}}">{{.Label}}</a>{{end}}</p> |
| +{{- with .Ref}} |
| +<p class="rst-mono" dir="auto">{{$.Data.Error.RefLabel}} {{.}}</p> |
| +{{- end}} |
| +{{- end}} |
| +{{end}} |
diff --git a/internal/home/templates/layout.html b/internal/home/templates/layout.html| index cc18c18..18be9e3 100644 |
| --- a/internal/home/templates/layout.html |
| +++ b/internal/home/templates/layout.html |
| @@ -30,16 +30,13 @@ |
| {{template "estilo-bar" .Chrome}} |
| <main rst-page id="main"> |
| {{- if door}} |
| -{{template "estilo-door-open" doorView}} |
| +{{template "estilo-door-open" (doorView .Brand)}} |
| {{template "content" .}} |
| {{template "estilo-door-close"}} |
| {{- else if hop}} |
| -<div estilo-door estilo-sky-host> |
| -{{template "estilo-sky" hopSky}} |
| -<section estilo-signin estilo-handoff> |
| +{{template "estilo-door-open" (hopDoor .Brand)}} |
| {{template "content" .}} |
| -</section> |
| -</div> |
| +{{template "estilo-door-close"}} |
| {{- else}} |
| {{template "content" .}} |
| {{- end}} |