Confirm it's you: count a fresh identity-provider sign-in (auth_time) as the confirmation #907

Closed
opened 2026-10-15 09:44:19 +00:00 by Cordy · 4 comments
Owner

From Nikola's live check of v0.6.341 (2026-10-15): right after signing in through Keycloak, connecting a device still asks "Confirm it's you" (Sign in again). By the #895 design a normal IdP sign-in never counts, because the IdP may sign the person in silently from an existing SSO session.

Idea: when the ID token of the normal sign-in carries an auth_time within the last 10 minutes (the person really authenticated at the IdP just now), treat it as the confirmation, like a local/LDAP sign-in. A silent SSO sign-in (old auth_time) still asks.

Research first (Nikola, 2026-10-15): market (how Nextcloud, GitHub sudo mode, Google, Microsoft, AWS console, GitLab, Keycloak's own step-up/ACR handle re-authentication after a fresh login), standards (OIDC Core auth_time/max_age, NIST SP 800-63B-4 reauthentication, OWASP), pitfalls (clock skew, auth_time on refresh, IdPs that omit or lie about auth_time, MFA/acr levels, Keycloak basic scope), user/operator needs. Then decisions, then the small change.

From Nikola's live check of v0.6.341 (2026-10-15): right after signing in through Keycloak, connecting a device still asks "Confirm it's you" (Sign in again). By the #895 design a normal IdP sign-in never counts, because the IdP may sign the person in silently from an existing SSO session. Idea: when the ID token of the normal sign-in carries an `auth_time` within the last 10 minutes (the person really authenticated at the IdP just now), treat it as the confirmation, like a local/LDAP sign-in. A silent SSO sign-in (old `auth_time`) still asks. Research first (Nikola, 2026-10-15): market (how Nextcloud, GitHub sudo mode, Google, Microsoft, AWS console, GitLab, Keycloak's own step-up/ACR handle re-authentication after a fresh login), standards (OIDC Core auth_time/max_age, NIST SP 800-63B-4 reauthentication, OWASP), pitfalls (clock skew, auth_time on refresh, IdPs that omit or lie about auth_time, MFA/acr levels, Keycloak `basic` scope), user/operator needs. Then decisions, then the small change.
Author
Owner

Research (2026-10-15)

Full file: cairn-work/scratch/b7e/batch907/907-research.md.

Finding: safe to count a fresh identity-provider sign-in.

  • OIDC Core: auth_time is the time the person actually authenticated, so a silent SSO sign-in carries the old time.
  • NIST SP 800-63C-4 §4.7 describes exactly this check, and 800-63B-4 §5.2 makes the relying party authoritative for it.
  • Keycloak (checked in its source): updates the auth time only on a real login and sends acr "0" for SSO and "1" for a fresh login. authentik and ZITADEL behave the same way. Entra and Google send auth_time only when asked; without it, nothing changes.
  • Market: WorkOS and Auth0 document the same pattern. Nextcloud's OIDC app skips the confirmation entirely for SSO users, so Cairn stays stricter either way.
  • Residual risk: a Keycloak broker in front of another IdP without "Pass max_age" stamps a fresh time on an upstream silent login. Today's Sign in again has the same hole; the docs will tell operators to turn on "Pass max_age".

Recommended rules (in oidclib.HandleCallback). A normal sign-in counts when:

  • auth_time is present;
  • acr is absent or not "0";
  • age = iat - auth_time (both IdP clock, so no skew between Cairn and the IdP) is between -60 s and 10 min;
  • the operator switch is on.

Then ConfirmedAt = now - age. Sign in again is anchored to auth_time the same way: today it uses the callback time, which can stretch its window to about 12 minutes. A sign-in that doesn't qualify behaves as today and logs a debug line saying why.

Decisions (my recommendation in brackets):

  1. Count a fresh sign-in [yes].
  2. Operator switch "Always ask to sign in again" [add it, default off: a fresh sign-in counts].
  3. acr: only reject "0" [yes; a configurable level later if a customer asks].
  4. Anchor Sign in again to auth_time [yes].
  5. Measure age as iat - auth_time [yes].
  6. Adjust the devCfOidc hint text in 4 languages [yes; text list for approval].

Mockup: none (no flow change). Size: about half a day.

## Research (2026-10-15) Full file: `cairn-work/scratch/b7e/batch907/907-research.md`. **Finding: safe to count a fresh identity-provider sign-in.** - **OIDC Core:** `auth_time` is the time the person actually authenticated, so a silent SSO sign-in carries the old time. - **NIST SP 800-63C-4 §4.7** describes exactly this check, and 800-63B-4 §5.2 makes the relying party authoritative for it. - **Keycloak (checked in its source):** updates the auth time only on a real login and sends `acr` "0" for SSO and "1" for a fresh login. authentik and ZITADEL behave the same way. Entra and Google send `auth_time` only when asked; without it, nothing changes. - **Market:** WorkOS and Auth0 document the same pattern. Nextcloud's OIDC app skips the confirmation entirely for SSO users, so Cairn stays stricter either way. - **Residual risk:** a Keycloak broker in front of another IdP without "Pass max_age" stamps a fresh time on an upstream silent login. Today's Sign in again has the same hole; the docs will tell operators to turn on "Pass max_age". **Recommended rules** (in `oidclib.HandleCallback`). A normal sign-in counts when: - `auth_time` is present; - `acr` is absent or not "0"; - age = `iat - auth_time` (both IdP clock, so no skew between Cairn and the IdP) is between -60 s and 10 min; - the operator switch is on. Then `ConfirmedAt = now - age`. Sign in again is anchored to `auth_time` the same way: today it uses the callback time, which can stretch its window to about 12 minutes. A sign-in that doesn't qualify behaves as today and logs a debug line saying why. **Decisions** (my recommendation in brackets): 1. Count a fresh sign-in [yes]. 2. Operator switch "Always ask to sign in again" [add it, default off: a fresh sign-in counts]. 3. `acr`: only reject "0" [yes; a configurable level later if a customer asks]. 4. Anchor Sign in again to `auth_time` [yes]. 5. Measure age as `iat - auth_time` [yes]. 6. Adjust the `devCfOidc` hint text in 4 languages [yes; text list for approval]. Mockup: none (no flow change). Size: about half a day.
Author
Owner

Decisions (Nikola, 2026-10-15): all recommendations accepted (comment 9151): D1 yes, D2 operator switch (default: a fresh sign-in counts), D3 reject acr "0" only, D4 anchor Sign in again to auth_time, D5 age = iat - auth_time with -60 s..10 min, D6 hint text in 4 languages. Built in batch A.

**Decisions (Nikola, 2026-10-15): all recommendations accepted** (comment 9151): D1 yes, D2 operator switch (default: a fresh sign-in counts), D3 reject acr "0" only, D4 anchor Sign in again to auth_time, D5 age = iat - auth_time with -60 s..10 min, D6 hint text in 4 languages. Built in batch A.
Author
Owner

Shipped in v0.6.343 (PR #910). Both dogfoods run v0.6.344.

A normal OIDC sign-in now counts as "Confirm it's you" when all of these hold:

  • the ID token carries auth_time;
  • acr is not "0";
  • iat - auth_time is between -60 s and 10 min.

ConfirmedAt is anchored to auth_time. Sign in again is anchored the same way. New switch: auth.oidcAlwaysSignInAgain (default off). The devCfOidc text is updated.

On Keycloak, a silent SSO login carries acr "0", so it never counts. With a brokered IdP, see the "Pass max_age" caveat in deployment.md.

Tests: real RS256 tokens through the go-oidc verifier, with a boundary table.

Still open: the live check on files-bao with Keycloak, steps 1-10 from the Task 6 report. Nikola signs in. Closing after that.

## Shipped in v0.6.343 (PR #910). Both dogfoods run v0.6.344. A normal OIDC sign-in now counts as "Confirm it's you" when all of these hold: - the ID token carries `auth_time`; - `acr` is not "0"; - `iat - auth_time` is between -60 s and 10 min. `ConfirmedAt` is anchored to `auth_time`. Sign in again is anchored the same way. New switch: `auth.oidcAlwaysSignInAgain` (default off). The `devCfOidc` text is updated. On Keycloak, a silent SSO login carries `acr` "0", so it never counts. With a brokered IdP, see the "Pass max_age" caveat in deployment.md. **Tests:** real RS256 tokens through the go-oidc verifier, with a boundary table. **Still open:** the live check on files-bao with Keycloak, steps 1-10 from the Task 6 report. Nikola signs in. Closing after that.
Author
Owner

Live check on files-bao with Keycloak (Nikola, 2026-10-15): PASS

  1. Password sign-in at Keycloak, then Connect a device within 10 minutes: no confirm step, and the device was created.
  2. More than 10 minutes later, connecting another device: the "Confirm it's you" step appeared with the new text. Sign in again (password at Keycloak) completed it, and the device was created without a second prompt.

The switch auth.oidcAlwaysSignInAgain and the silent-SSO case are covered by the real-token tests (TestSwitchAlwaysSignInAgain, TestOIDCConfirmRule acr "0"). Turning the switch on live would need a GitOps config change, so it was not done. Closing.

## Live check on files-bao with Keycloak (Nikola, 2026-10-15): PASS 1. Password sign-in at Keycloak, then Connect a device within 10 minutes: **no confirm step**, and the device was created. 2. More than 10 minutes later, connecting another device: the **"Confirm it's you"** step appeared with the new text. Sign in again (password at Keycloak) completed it, and the device was created without a second prompt. The switch `auth.oidcAlwaysSignInAgain` and the silent-SSO case are covered by the real-token tests (`TestSwitchAlwaysSignInAgain`, `TestOIDCConfirmRule` acr "0"). Turning the switch on live would need a GitOps config change, so it was not done. Closing.
Cordy closed this issue 2026-10-15 17:18:56 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#907
No description provided.