Skip to content

docs(adr-0135): on D6, an SSO link and a sign-in that would change an account's address follow the proven-domain rule - #33356

Merged
os-zhuang merged 2 commits into
mainfrom
claude/adr-0135-d6-sso-link-and-address-change
Nov 15, 2026
Merged

os-zhuang merged 2 commits into
mainfrom
claude/adr-0135-d6-sso-link-and-address-change

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

维护者速读

What changes

docs/adr/0135-identity-and-access-architecture.md, D6 only:

  • A dated note (2026-11-14). With SSO domain verification on, the proven-domain account rule also decides two more cases. An implicit link to an existing account is made only at a proven domain. A sign-in into an already-linked account is refused when it would change the stored address to one outside the proven domains, and refused where whether it would change the address cannot be determined.
  • What the note leaves unjudged: a sign-in that changes nothing is admitted, and an explicit link is not judged.
  • The rule's own refusal answers EMAIL_DOMAIN_NOT_ALLOWED; an input the gate cannot read is refused by the gate's general refusal.
  • The authority is the maintainer's ruling of 2026-11-14, relayed in review record 6884303063. Record 6880992920 is cited as the review that required the note. fix(plugin-auth)!: with SSO domain verification on, an SSO sign-in links to an existing account, or changes its email address, only at a domain the provider has proven #33307 implements the rule.
  • In the D6 body, "Accounts that already exist are not re-checked" now names its two exceptions and points to the note.
  • "What this record does NOT settle": the exception now points at the proven-domain account rule the D6 notes name, plural.

No code, no published package, so skip-changeset.

Verification

  • At d2d02d8838, the dispatch-gates --commands derivation for this diff (21 families), reconciled with --ran: 21 run, 0 not measured.

Acceptance notes


Generated by Claude Code

… sign-in follow the proven-domain rule

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head 6049778 · 2026-11-14T19:09Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 604977848d763bc36473bb85a58066de7d8f5a50
Local-runs: none
Scope: docs/adr/0135-identity-and-access-architecture.md + none (read, not reviewed: PR #33307 at head ba3fd25ea8, its implicit-account-linking.ts, sso-account-at-proven-domain.ts and auth-manager-auth-instance.ts; records 6880992920 and 6882064855; references/security-findings.md and lanes/security.md on main)

① Derived judgments

  • The diff is one file, ADR-0135: a dated note under D6 and one sentence in "What this record does NOT settle". No code, no schema, no published package, no error code. Right.
  • The note changes what D6 publishes as the unchanged set: "accounts that already exist are not re-checked" is narrowed to a sign-in that neither links nor changes the stored address. That is a change to a recorded decision (AGENTS.md Prime Directive 13), carried by an amendment to the record on a Tier H path. The vehicle is right; the authority the note names for it is ④ finding 1.
  • The rule sentences, read against the first consumer (fix(plugin-auth)!: with SSO domain verification on, an SSO sign-in links to an existing account, or changes its email address, only at a domain the provider has proven #33307 at ba3fd25ea8): an implicit link judged by the creation rule's own comparison; a sign-in judged only when it would change the stored address; a sign-in that changes nothing not judged; refusal code EMAIL_DOMAIN_NOT_ALLOWED; the same user.validateUserInfo gate. Each agrees with that tree, with the one over-reach in ④ finding 2.
  • "What this record does NOT settle": "the D6 notes", plural, now covers both notes. Right.
  • The cited path packages/plugins/plugin-auth/src/implicit-account-linking.ts exists on main, so the citation resolves in either landing order.
  • Check-runs on the head: 49 runs, 26 success, 23 skipped, none failed or pending. Governed Surface Queue Guard, Check Documentation Links, Check Changeset and the docs and code guards are green.

② Semver level

skip-changeset label, no changeset. The diff publishes nothing, so that is the correct level. Clause-②: none declared and none owed; the narrowing itself is declared on #33307, where it ships.

③ Boundary flags

④ Design judgment

docs/adr/0135-identity-and-access-architecture.md — the rule text is an accurate account of what #33307 implements, and a dated D6 note is the right place for it. It does not hold on who authorises it.

  1. must-fix — the authority sentence of the 2026-11-14 note. It names two authorities: the security lane seat's order, and a contract review's reading. Neither can be one. The file's own Status line says nothing is decided in it; the 2026-11-13 note rests the creation rule on the maintainer's ruling "not this file"; D6 on main records that existing accounts are not re-checked; and references/security-findings.md section 6 sends a fix that sets a contract to the maintainer. A seat's order dispatches work, and a review record reads a rule against the tree; record 6880992920 itself asked for "the ruling that authorises it" and said it could read none. The note as written would put on a governed record that a seat extended a maintainer ruling. Required, one of: (a) if the maintainer has ruled on the extension, the note names that ruling and its date, as the 2026-11-13 note does; or (b) the note says plainly that the extension is decided by the maintainer's approval of this amendment, and the PR's 维护者速读 asks for that decision in those words. In both, record 6880992920 may be cited as the review that required the note, not as authority.
  2. should-fix — the summary clause "now holds only for a sign-in that neither links nor changes the stored address". The tree judges an implicit link only; a link the user starts from their own session is not judged (rule 4 in the consumer's header, and fix(plugin-auth)!: with SSO domain verification on, an SSO sign-in links to an existing account, or changes its email address, only at a domain the provider has proven #33307's Unchanged list). Say "neither implicitly links", and name the explicit link among what is not judged, so the record's unchanged set matches the tree's.
  3. nit — the D6 body paragraph still carries "Accounts that already exist are not re-checked." with no pointer; a reader of the paragraph alone gets the old rule. Add "(see the 2026-11-14 note)" or the like. Prose only.
  4. nit — "Both fail closed and answer EMAIL_DOMAIN_NOT_ALLOWED": the code is what the rule's own refusal answers; an input the gate cannot read is refused by the gate's general refusal. One clause apart would be exact. Prose only.

Finding 1 is a must-fix; findings 1 and 2 earn a delta review of their fix by this seat.

Implemented-by: claude/adr-0135-d6-sso-link-and-address-change
Reviewed-by: session_01FEkQ5nhu4dRbKVQKDB4CDB

VERDICT: FAIL

…ty; an implicit link, not every link

Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract-review-claim: session_01FEkQ5nhu4dRbKVQKDB4CDB · head d2d02d8 · 2026-11-15T04:11Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5nhu4dRbKVQKDB4CDB

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: d2d02d8838df61c2e27d620e53f9cb6decb1d6fd
Local-runs: none
Scope: docs/adr/0135-identity-and-access-architecture.md + none (read, not reviewed: earlier record 6882817474; ruling record 6884303063 on PR #33307; PR #33307 at head c21b6b600c, its implicit-account-linking.ts; the same file and ADR-0135 on main)

Delta review of the hop 604977848d to d2d02d8838, against record 6882817474. The hop is one commit of the PR's own, no merge of main, touching the one scope file (+18 −12).

① Derived judgments

  • The diff is still one file, ADR-0135: the dated 2026-11-14 note under D6, one clause added to the D6 body paragraph, and the sentence in "What this record does NOT settle". No code, no schema, no published package, no error code. Right.
  • The hop changes three things and nothing else: the note's authority sentence, the note's rule sentences (implicit link, the address-change wording, the explicit link, the two refusals told apart), and the pointer in the D6 body paragraph. Each maps to a finding of the earlier record; see ④.
  • The rule sentences, read against the ruling and against the first consumer (fix(plugin-auth)!: with SSO domain verification on, an SSO sign-in links to an existing account, or changes its email address, only at a domain the provider has proven #33307 at c21b6b600c, rule 4 of the consumer's header and refuseSsoAddressChangeOutsideProvenDomain): an implicit link judged by the creation rule's comparison; a sign-in into a linked account judged only when it would change the stored address; a sign-in that asserts an outside address but changes nothing admitted; an explicit link, verification off and a non-SSO source not judged; the rule's refusal answering EMAIL_DOMAIN_NOT_ALLOWED, an unreadable input refused by the gate's general refusal. Each agrees with the ruling's text and with that tree, with the one imprecision in ④ nit 5.
  • The cited path packages/plugins/plugin-auth/src/implicit-account-linking.ts exists on main, so the citation resolves in either landing order.
  • Check-runs on the head: 44 runs, 25 success, 19 skipped, none failed or pending. Governed Surface Queue Guard, Check Documentation Links, PR-body guards and the docs and code guards are green; Check Changeset is skipped under the skip-changeset label.

② Semver level

Unchanged from the earlier record: skip-changeset, no changeset, nothing published, so that is the correct level. Clause-②: none declared and none owed; the narrowing is declared on #33307, where it ships.

③ Boundary flags

④ Design judgment

docs/adr/0135-identity-and-access-architecture.md — findings of record 6882817474, then what the hop adds.

  1. must-fix of the earlier record (the authority sentence) — closed, by its option (a). The note now names the maintainer's ruling of 2026-11-14 and its chosen option as the authority, says "That ruling, not this file, is its authority" as the 2026-11-13 note does, and cites record 6880992920 only as the review that required the note. No seat order and no review reading is named as authority any more. The rule is stated as ruled: refused only when the sign-in would change the stored address, refused where that cannot be determined, admitted when an outside address is reported but nothing changes, creation and implicit-link rules unchanged.
  2. should-fix of the earlier record (an implicit link, not every link) — closed. The heading, the summary clause ("neither links implicitly nor would change the stored address") and the body all say implicit, and the explicit link is named among what is not judged, matching the consumer's header and its unchanged set.
  3. nit of the earlier record (no pointer in the D6 body paragraph) — closed. The paragraph now reads "not re-checked, except on an implicit link or a sign-in that would change the stored address (see the 2026-11-14 note)".
  4. nit of the earlier record (one code for both refusals) — closed. The rule's own refusal and the gate's general refusal are now told apart.

New in the hop:

  1. nit — "and refused where whether it would change the address cannot be determined". This is the ruling's own wording, but the tree is one step more exact: an undetermined write is judged as a change, so it is refused only when the asserted address is outside the proven domains, and a sign-in asserting the account's own address is admitted before the question arises. No reasonable reading refuses an in-domain address that a determined change would admit, so the contract is not misread. "where that cannot be determined, it is judged as a change" would be exact. Prose only; accepted deviation or follow-up.
  2. nit — the citation "on the security lane's decision card ... relayed in contract review record 6884303063". The card was not the security lane's; record 6884303063 is a maintainer ruling record, not a contract review record; and it lives on PR fix(plugin-auth)!: with SSO domain verification on, an SSO sign-in links to an existing account, or changes its email address, only at a domain the provider has proven #33307, which the citation does not say. "the maintainer's decision card, recorded in ruling record 6884303063 on fix(plugin-auth)!: with SSO domain verification on, an SSO sign-in links to an existing account, or changes its email address, only at a domain the provider has proven #33307" resolves for a later reader. The authority named (the maintainer's ruling, its date and option) is right either way. Prose only.

No must-fix and no should-fix remains. Nits 5 and 6 are accepted deviations unless the seat folds them into a prose-only touch; this is the final round for this PR's rule text.

Implemented-by: claude/adr-0135-d6-sso-link-and-address-change
Reviewed-by: session_01FEkQ5nhu4dRbKVQKDB4CDB

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f

席位意见: 同意落地,纯文档、不改代码,记录的是维护者 2026-11-14 对 #33307 的裁决(选项 B)。请在 #33307 合并后再合并本 PR。

席位核对

ACCEPT at Head-sha: d2d02d8838df61c2e27d620e53f9cb6decb1d6fd (2026-11-15T04:31Z).

Implemented-by: os-dev (security#1 order, session_017xRBcT1w3zpekijraHJE4f) · Reviewed-by: review#2 (session_01FEkQ5nhu4dRbKVQKDB4CDB).


Generated by Claude Code

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 15, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 15, 2026 04:47
@os-zhuang
os-zhuang enabled auto-merge November 15, 2026 04:48
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit e9884e1 Nov 15, 2026
54 checks passed
@os-zhuang
os-zhuang deleted the claude/adr-0135-d6-sso-link-and-address-change branch November 15, 2026 05:14
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…nks to an existing account, or changes its email address, only at a domain the provider has proven (objectstack-ai#33307)

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no file under `skills/**` teaches SSO domain
verification, account linking or an address change through an SSO
provider; `content/docs/permissions/sso.mdx` ("Domain verification
(opt-in)") states the rule.

## 维护者速读

- 改了什么:开启 SSO
域名验证后,"经由身份提供方到达的账号,其邮箱只能位于该提供方已验证的域名"这条规则(此前只管新建账号)现在也管另外两条路径:隐式关联到已有账号,以及会改写已关联账号已存邮箱的登录。会改写邮箱、而新邮箱不在已验证域名时拒绝;无法判定是否会改写时也拒绝;不改写任何东西的登录照常放行。拒绝码为
`EMAIL_DOMAIN_NOT_ALLOWED`,不写关联、不发会话、已存邮箱不变。依据为维护者裁决(review#2 记录
6884303063 转述,选项 B「只拦会改邮箱的登录」)。
-
为什么改:让域名验证的保证在账号被"到达"的每一条会落地变化的路径上都成立,而不只是在新建时;匹配方式与新建时完全相同(精确匹配,子域名须自身列出并验证)。
- 风险与回滚:仅在开启域名验证的环境生效;关闭验证、非 SSO 来源、用户自己发起的显式关联、不改写邮箱的登录(含所有 SAML
提供方,以及平台自身注册流程下从不开启更新的 OIDC 提供方)均不变。本地账号位于"已列出域名的未列出子域名"的人,首次经 SSO
登录会被拒,需把该子域名加到提供方并重新验证;完全未列出的域名此前就不关联,不受影响。回滚即还原本 PR。D6 的 ADR 说明在
objectstack-ai#33356(Tier H,另行审批)。
- 先看:`packages/plugins/plugin-auth/src/implicit-account-linking.ts`(规则
4:`refuseImplicitAccountLink`
新增判定;`refuseSsoAddressChangeOutsideProvenDomain` 与
`ssoSignInWritesAddress`,后者读不到即按"会改写"处理);`packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts`(`validateUserInfo`
串接顺序);`packages/plugins/plugin-auth/src/sso-account-at-proven-domain.ts`(仅抽出
`readSsoProviderProvenDomains`,新建规则行为不变)。
- 两分钟验证:`pnpm --filter @objectstack/plugin-auth exec vitest run
src/implicit-account-linking.test.ts src/sso-oidc-refusal-cause.test.ts
src/sso-saml-refusal-landing.test.ts
src/sso-account-at-proven-domain.test.ts`,预期 `Tests 255 passed (255)`(合并
main 后)。
- 需要你做的:无,席位落地。

## What changes

The rule, as ruled (the maintainer's ruling relayed in review#2 record
6884303063): with SSO domain verification on, an account reached through
a provider holds an email address only at a domain that provider has
proven. Account creation already follows it. This PR applies the same
rule, with the same module, to the two other ways an SSO sign-in (SAML
or OIDC) reaches an account:

- **An implicit link.** A sign-in that links to an account that already
exists is admitted only when the asserted address is at a domain the
provider has proven, compared exactly: a subdomain counts only when it
is itself listed and verified (`refuseImplicitAccountLink`, rule 4 in
the `implicit-account-linking.ts` header). The two cases are kept apart.
An address at a domain the provider does not list at all was already not
linked, and is still refused as before with the same answer (pinned as a
CONTROL). An address at a subdomain of a listed domain that is not
itself listed and verified was linked before and is now refused.
- **A sign-in that would change the stored address.** A sign-in into an
already-linked account is refused when it would change the stored
address to one outside the proven domains, and refused where whether it
would change the address cannot be determined. A sign-in that reports an
address outside the proven domains but changes nothing is admitted, as
before. This is `refuseSsoAddressChangeOutsideProvenDomain`, chained
into `validateUserInfo` after the link gate and before the audience
gate. Whether the sign-in writes the address is the vendor's own
decision, read from the inputs it reads (`ssoSignInWritesAddress`): for
OIDC, the provider's stored update setting, which the platform's own
provider registration never turns on; for SAML, none; and a configured
`defaultSSO` entry or `resolveUser` selection where one is composed. A
decision that cannot be read is judged as a write.
- **The refusal** is `EMAIL_DOMAIN_NOT_ALLOWED`, the code creation
answers, with a rule-level description per case that names no domain. No
new error code. A provider row that cannot be read refuses; an account
that cannot be read throws, which the sign-in answers with the gate's
general refusal.
- **Reuse.** The provider read moves out of
`refuseSsoAccountOutsideProvenDomain` into the exported
`readSsoProviderProvenDomains`. The creation rule's behaviour is
unchanged and its tests are untouched.
- **Unchanged.** Verification off; sign-ins that would not change the
stored address; non-SSO sources (the cloud identity provider and
enterprise OAuth providers); a link the user starts from their own
session (an explicit link); the domain-matching rule itself.
- **Texts.** `content/docs/permissions/sso.mdx` states the rule for an
implicit link (both cases) and for a sign-in that would change the
address. The gate comments in `sso-account-at-proven-domain.ts` and
`auth-manager-auth-instance.ts`, the SSO mount comment in
`auth-manager-plugin-list.ts`, and the TSDoc of
`isSsoDomainVerificationEnabled` all state the rule for creation,
implicit link and address change.
- **ADR.** The dated ADR-0135 D6 note recording this extension and its
ruling is the separate governed PR objectstack-ai#33356.

## Tests

Named by the rule.

- `sso-oidc-refusal-cause.test.ts`, section 6 (real `AuthManager`, real
vendor callback, stubbed IdP), covering:
- an implicit link at an unlisted subdomain: refused, with no
`sys_account` row and no session;
- an implicit link at a domain the provider does not list at all:
refused as before (CONTROL);
  - an implicit link at a proven domain: links and signs in;
- with a provider that updates the account, a change to an outside
address or to an unlisted subdomain: refused, stored email unchanged, no
new session;
  - a change to another proven domain: applies;
- with a provider that does not update the account, an outside address
asserted later: signs in, and nothing changes;
- CONTROLS: verification off, and a later sign-in with the stored
address.
- `sso-saml-refusal-landing.test.ts`:
  - the implicit-link pair over SAML, plus the verification-off CONTROL;
- a later SAML sign-in asserting an outside address: signs in, and the
stored address is unchanged.
- `implicit-account-linking.test.ts`, new top-level describe: the rule
on its own inputs, OIDC and SAML, including:
  - the write decision read as the vendor reads it;
  - fail-closed cases;
- CONTROLS for verification off, a non-SSO source, an explicit link (an
OAuth source), and the creation rule unchanged.

<details><summary>Readings</summary>

- Before the fix, on this branch's base: the new end-to-end cases ran
red, 3 failed of 8 (OIDC) and 1 failed of 3 (SAML).
- At `c21b6b600c`, the four affected files: `Test Files 4 passed (4)`,
`Tests 218 passed (218)`. `pnpm --filter @objectstack/plugin-auth
typecheck` exit 0.
- At `ba3fd25ea8`, the last code change (`c21b6b600c` adds comment and
prose only), `pnpm --filter @objectstack/plugin-auth test`: `Test Files
270 passed (270)`, `Tests 5157 passed | 10 skipped (5167)`, and
typecheck exit 0.
- Ablation. Each leg ran through `scripts/ablation-replace.mjs`, with
the anchor proven on disk and the restore proven by blob equality with
`HEAD`.
- The implicit-link check removed: `Tests 5 failed | 200 passed (205)`;
restored.
- The address-change judge removed (first rule): `Tests 4 failed | 201
passed (205)`; restored.
- The write-decision call removed: `Tests 4 failed | 207 passed (211)`;
restored.
- The stored update setting forced on: `Tests 2 failed | 209 passed
(211)`; restored.
- The SAML branch of the write decision removed: `Tests 2 failed | 209
passed (211)`; restored.
- Dogfood battery:
- Last full run at `b0796f0239` (before the narrower address rule):
`Tests 2 failed | 3925 passed | 42 skipped (3969)`. Both failures were 5
s timeouts on a contended box. Re-run alone: `Tests 36 passed (36)`.
- At `ba3fd25ea8`: the local run was interrupted, so it is NOT MEASURED
locally. CI's `Dogfood Regression Gate` on that head: success.
  - `c21b6b600c` is comment and prose only, so it owes no battery.

</details>

## Acceptance notes

- Two open drafts touch nearby text. One edits the header of
`implicit-account-linking.ts` at the spot where rule 4 is inserted,
which is a textual merge of two doc paragraphs. The other edits a
different section of `sso.mdx`. Neither touches the gate code.
- Local gates at `c21b6b600c`: the `dispatch-gates --commands`
derivation for this diff, 105 families, reconciled with `--ran`: 105
run, 0 not measured.

## Verification

- `pnpm --filter @objectstack/plugin-auth exec vitest run
src/implicit-account-linking.test.ts src/sso-oidc-refusal-cause.test.ts
src/sso-saml-refusal-landing.test.ts
src/sso-account-at-proven-domain.test.ts`

---
_Generated by [Claude
Code](https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f)_

<details><summary>Merge of origin/main (head 4a7e194)</summary>

- Two files conflicted, both from main's new SAML account-key and
address-value checks in the same `validateUserInfo` chain:
- `auth-manager-auth-instance.ts`: both kept, in the order identity
locale, SAML account key, the proven-domain creation check, the
address-value check, the implicit-link gate, the address-change gate,
then audience admission.
  - `implicit-account-linking.test.ts`: both appended describes kept.
- The rule text and code are unchanged from the reviewed head.
`implicit-account-linking.ts`, `sso.mdx` and the changeset merged
cleanly and are byte-identical in this PR's own lines.
- At `4a7e194f97`:
  - the four touched files: `Tests 255 passed (255)`;
- `pnpm --filter @objectstack/plugin-auth test`: `Test Files 275 passed
(275)`, `Tests 5355 passed | 10 skipped (5365)`; typecheck exit 0;
  - dispatch-gates: 105 derived, 105 run, 0 NOT-MEASURED;
- dogfood battery (owed: the merge brought non-text plugin-auth
changes): `Test Files 467 passed | 3 skipped (470)`, `Tests 3953 passed
| 42 skipped (3995)`, VERDICT command-exit 0.

</details>

<!-- signed: security#1 · sunhaolin · session_017xRBcT1w3zpekijraHJE4f
-->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants