Skip to content

fix(api): skip no consent step in the hosted cloud until the Console revokes - #3583

Merged
fforootd merged 25 commits into
mainfrom
claude/remembered-consent
Dec 2, 2026
Merged

fforootd merged 25 commits into
mainfrom
claude/remembered-consent

Conversation

@fforootd

@fforootd fforootd commented Dec 2, 2026

Copy link
Copy Markdown
Member

Context

Summary

  • Adds oauth.consent_skip (NEXTGEN_OAUTH_CONSENT_SKIP), on by default, so self-hosted behaviour is unchanged. With it off, every client is asked, with the person's last answer ticked.
  • The cloud launcher sets it to false, and its environment test asserts that.
  • Configuration reference: the oauth.consent_skip row.

Validation

Run by the writing session:

  • go build; the service, cloud-launcher and cmd/server packages; the SQLite integration lane.
  • A service test shows that with the skip off a remembered answer for an assured web client still shows the step, with the last answer ticked. It fails without the gate; the launcher test fails without the environment line.
  • Not run: the Postgres and Spanner lanes (no statement changes).

Release notes / changeset

  • .changeset/oauth-consent-skip.md, @zitadel/server patch.

Notes

  • Known, not addressed here: two concurrent answers by the same person write last-wins, which can restore a scope they declined in the other tab; and a revoke that lands between the consent read and the code issue lets that one in-flight sign-in still get its code. Both need the person racing themselves.
  • Follow-ups from the same review, in a later pull request: on Postgres a revoke racing a code redemption can leave one refresh grant alive; the client digest is read when the answer is stored and not pinned to what the screen showed; one spec response should use the shared error schema.
  • The branch name is the one feat(api): remember a person's OAuth consent, and let them list and revoke it #3574 used: GitHub deleted it on merge and the writing session, https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf, may push only there. The pull request was opened by the coordinating session below.

Generated by Claude Code

claude added 25 commits December 2, 2026 14:28
Amend ADR 082 (Proposed): a consent is remembered per person, client and
API. A client whose identity is assured (a secret, or an https answer)
skips the step for what it was granted; a client that returns to a
loopback address or a private-use scheme is asked each time with the
last choice ticked. Scopes of operations that return a credential are
never remembered. A person lists and revokes their consents, and a
revoke ends the client's refresh grants. ADR 092 points to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
…rompt

A consents table in the three dialects, one row per person, client and
API (ADR 082, amendment of 2026-12-02): the scopes the person granted
and the ones they declined, a digest of the client, the session and time
of the last answer, and an expiry. Revoking one deletes it and the
client's refresh grants for the person in one transaction. The
authorization request keeps its prompt for the flow to read. stmttest
covers the statements on every dialect, and ADR 047 registers the
consent prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
…o the policy work

A remembered consent holds the person's answer for every scope offered,
yes or no, so a client that asks for everything skips the step once the
person answered, and is issued the scopes answered yes. A scope that is
never remembered no longer forces the step: a skip does not issue it.
A declined scope is asked for again with prompt=consent after the API's
auth.scope_insufficient refusal. How long a consent lasts, and whether
use renews it, is left open for the policy work; the me operations
become two tools once #3559 lands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
… with it

The consent step stores the person's answer, granted or declined per
scope offered (ADR 082, amendment of 2026-12-02). On the next request a
client whose identity is assured (a secret, or an https answer off the
person's device) skips the step when every scope asked was answered,
and its code carries the scopes answered yes. A client that holds no
secret and returns to a loopback address or a private-use scheme sees
the step each time, ticked as the person last answered. A new scope,
a changed client, prompt=consent or an expired consent shows the step.
Scopes of operations that return a credential are never remembered.
The authorization endpoint keeps the request's prompt for the flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
listMyConsents (GET /users/me/consents) lists what the signed-in person
consented to OAuth clients doing, the last answered first, with the
scopes granted and declined and when the consent expires.
revokeMyConsent (DELETE /users/me/consents/{consent_id}) deletes one
and ends every refresh token its client holds for the person, so the
client is asked again at its next sign-in (ADR 082, amendment of
2026-12-02). Both take the session cookie, like the other me
operations, so the MCP endpoint offers neither as a tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
The Enable OAuth guide says which clients are asked once and which every
time, and how a person lists and revokes a consent. ADR 082's amendment
says the me operations take the session cookie until #3559 lets them
take a person's token. The changeset covers the three code pieces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
main renumbered the migrations (#3551) and marks a person's own
operations x-zitadel-self (#3559, #3560). listMyConsents takes the mark
and a person's token with user.read; revokeMyConsent takes the mark and
stays with the session cookie, as revokeMySession does. Generated files
regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
Amend ADR 082 (Proposed): a consent is remembered per person, client and
API. A client whose identity is assured (a secret, or an https answer)
skips the step for what it was granted; a client that returns to a
loopback address or a private-use scheme is asked each time with the
last choice ticked. Scopes of operations that return a credential are
never remembered. A person lists and revokes their consents, and a
revoke ends the client's refresh grants. ADR 092 points to it.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
…o the policy work

A remembered consent holds the person's answer for every scope offered,
yes or no, so a client that asks for everything skips the step once the
person answered, and is issued the scopes answered yes. A scope that is
never remembered no longer forces the step: a skip does not issue it.
A declined scope is asked for again with prompt=consent after the API's
auth.scope_insufficient refusal. How long a consent lasts, and whether
use renews it, is left open for the policy work; the me operations
become two tools once #3559 lands.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
Brings in main with personal access tokens (#3563), so PR 2 can stack on
the ADR's branch. A scope granted only on the consent step
(personal_access_token.create, domain.ConsentRequired) is never
remembered and always shows the step, to a first-party client too; the
ADR says so. Generated files regenerated; sets_test lists both the token
tools and listMyConsents.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
…odes on revoke

From review of #3574:
- A consent given to a client before its document changed is no consent:
  its answers neither tick the step nor carry over into what the person
  answers the changed client.
- Revoking a consent also deletes the client's authorization requests for
  the person that hold an unredeemed code, in the same transaction on all
  three dialects, so a code issued before the revoke buys no token after.
- Only a redirect off the person's device assures a public client: a
  trailing dot, localhost subdomains, the unspecified address and numeric
  IPv4 forms (127.1, 2130706433, 0x7f.1) count as the device. The check
  is the consent rule's own; IsLoopbackOrigin is unchanged for its other
  callers.
- Tests for each, and for the first-party answer that stores nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
…on the device, end consents on a password reset

The user's decisions on #3574's review (D1-D3):
- A request that names a scope a consent never remembers (one that
  returns a credential, or is granted only on the step) shows the step,
  ticked as answered: a skip never leaves out a scope the request named.
  An ask-everything client therefore sees the step at every sign-in; the
  ADR says so and leaves a scope of their own for those operations open,
  and no longer leans on prompt=consent as MCP's step-up.
- A client whose identity is not assured starts with no delete scope
  ticked, whatever the person answered before.
- setUserPassword, the reset by which a person gets back a lost account
  today, revokes every consent of theirs in the same transaction, with
  each client's refresh grants and unredeemed codes. The ADR records that
  a future self-service recovery must do the same, and a Console revoke
  surface as a condition before the skip is on for the hosted cloud.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
listMyConsents and revokeMyConsent are a person's own operations, on
their own credential (revoking on their session only); the CLI's
api-coverage test listed them as neither called nor explained.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
The amendment as the code's pull request now has it: a consent given to a client whose registration has changed counts as none; a revoke also ends the client's unredeemed codes; a request that names a scope that is never remembered always shows the step, so a client that asks for every listed scope is asked each time; delete scopes start unticked on the person's device; a password set ends the person's consents; and what a password set ends, like a consent's lifetime, is left to the policy work. A person reaching revoke from the Console is a condition before the skip is switched on for the hosted cloud.

The text was written in the session https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf and is taken from its branch unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
…onsent

Brings in main at eaced99 (#3552, #3562, #3564). The CLI's api-coverage
test keeps only the two consent operations as not called: the personal
access token commands now call theirs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
The ADR text it carries is on this branch through claude/remembered-consent-adr.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
Brings in #3570 (a password set ends personal access tokens). The consent
Spanner migrations sit behind its 000069 as 000070 and 000071.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
…revokes

ADR 082 makes reaching revocation from the Console a precondition of the
hosted cloud's skip. oauth.consent_skip (on by default) gates the skip; the
cloud launcher sets it off, so the step is shown there with the person's last
answer ticked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf

# Conflicts:
#	apps/api/cmd/server/server.go
#	apps/api/internal/service/flow_auth_request.go
#	apps/api/internal/service/flow_auth_request_remembered_test.go
#	apps/api/internal/service/flow_engine.go
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmUEzNb3SNs7Rj5USYf
Copilot AI balanced review requested due to automatic review settings December 2, 2026 19:49
@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Dec 2, 2026 7:52pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-12-02T20:01:16.595179Z eec65d4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: eec65d4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 27 packages
Name Type
@zitadel/server Patch
@zitadel/cli Patch
@zitadel/testing Patch
@zitadel/server-darwin-arm64 Patch
@zitadel/server-darwin-x64 Patch
@zitadel/server-linux-arm64 Patch
@zitadel/server-linux-x64 Patch
@zitadel/server-win32-x64 Patch
@zitadel/api Patch
@zitadel/components Patch
@zitadel/config Patch
@zitadel/sdk-angular Patch
@zitadel/sdk-core Patch
@zitadel/sdk-next Patch
@zitadel/sdk-nuxt Patch
@zitadel/sdk-qwik Patch
@zitadel/sdk-qwik-router Patch
@zitadel/sdk-react Patch
@zitadel/sdk-solid Patch
@zitadel/sdk-solid-start Patch
@zitadel/sdk-svelte Patch
@zitadel/sdk-sveltekit Patch
@zitadel/sdk-tanstack-start Patch
@zitadel/sdk-vue Patch
@zitadel/cloud Patch
@zitadel/client-sdk-contract Patch
@zitadel/server-sdk-contract Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new consent-skip changeset duplicates an existing unreleased entry and must be merged into it, preserving the minor bumps for both packages.

1 open issue
What changed in this PR

Adds a deployment switch for remembered-consent skipping, following #3574. Hosted cloud defaults it off until consent revocation is available in the Console; self-hosted defaults remain unchanged.

Changes:

  • Adds and wires oauth.consent_skip, defaulting to true.
  • Disables skipping by default in the cloud launcher while preserving remembered selections.
  • Adds regression tests, configuration documentation, and a release note.
File Description
docs/​quick-start/​configuration.md Documents the switch and cloud behavior.
apps/​api/​internal/​service/​flow_engine.go Passes the switch into consent handling.
apps/​api/​internal/​service/​flow_auth_request.go Gates remembered-consent skipping.
apps/​api/​internal/​service/​flow_auth_request_remembered_test.go Tests showing consent with remembered selections.
apps/​api/​cmd/​server/​server.go Sets the default and wires configuration.
apps/​api/​cmd/​server/​config.go Defines the configuration field.
apps/​api/​cmd/​cloud-launcher/​main.go Defaults cloud consent skipping to off.
apps/​api/​cmd/​cloud-launcher/​main_test.go Asserts the cloud default.
.changeset/​oauth-consent-skip.md Adds a server release note.

Review effort: Balanced

Comment on lines +1 to +3
---
"@zitadel/server": patch
---
@fforootd
fforootd enabled auto-merge December 2, 2026 19:52
@fforootd
fforootd added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 324fbe0 Dec 2, 2026
19 checks passed
@fforootd
fforootd deleted the claude/remembered-consent branch December 2, 2026 19:57
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Dec 2, 2026

This branch was successfully deployed

1 active deployment
Preview — eec65d4b Deployed Dec 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants