Skip to content

fix(plugin-auth)!: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants - #36173

Merged
os-zhuang merged 16 commits into
mainfrom
claude/sec2-ggfh
Nov 22, 2026
Merged

os-zhuang merged 16 commits into
mainfrom
claude/sec2-ggfh

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill teaches deleting an SSO provider, its sessions or its projected grants; the rule is documented in content/docs/permissions/sso.mdx ("Deleting an SSO provider")

维护者速读

  • 管理员删除一个企业单点登录提供方后,经它登录的用户的在线会话随之结束;其他方式登录的会话不受影响。
  • 安全加固:删除身份提供方即收回它所担保的访问(安全席位的无卡派单)。
  • 若出错,经该提供方登录的用户会被要求重新登录;改动可直接撤回,会话表多出的一列不影响旧版本。
  • 要你做的事:无(合同层审核归安全席位)。

What changes

Rule: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants.

  1. Sessions. Each session an SSO sign-in opens (OIDC or SAML, SP- or IdP-initiated, new or returning user) records the provider it was signed in through, in a new read-only, system-managed column sys_session.sso_provider_id. After POST /api/v1/auth/sso/delete-provider succeeds, the live sessions that record the deleted provider are revoked in place (revoke_reason: 'sso_provider_deleted'), the same shape every other revocation writes. A session signed in any other way is left as it is; a delete the vendor refuses ends nothing.
  2. The delete's answer carries revokedSessions beside the other counts, and its message says it.
  3. Projected grants of a provider that no longer exists are removed at every boot, as are live sessions recording such a provider. The delete already removes its own projected grants at delete time (unchanged, on main since the SSO provider lifecycle landed); the boot sweep settles what a provider with no sys_sso_provider row left behind. It reads only marker grants and stamped live sessions, re-reads the provider rows after reading the candidates (a provider registered mid-sweep keeps its own), and logs at info what it removed and at error (with the remedy) when it could not.

Bounded batches. Every revoke and removal is written in batches of at most 500 rows, walked in id order (keyset paging), so the rule holds for any number of sessions or grants; a batch that fails is logged at error with the remedy, and the next boot's sweep ends what remains.

Boot sweep, not one-shot backfill — chosen by measurement:

  • A path that leaves a projected grant behind once the provider row is gone still exists after this change: a delete whose cleanup fails after the vendor's own delete succeeded (dependentsRemoved: false). A one-shot backfill would leave those for good; the pin "what a delete whose cleanup failed left behind is removed at the next boot" shows the sweep settling it.
  • Cost, measured on better-sqlite3 with 20,000 grants (10% projected, all by live providers) and 10,000 sessions (half stamped): a sweep with nothing to remove takes median 5.3 ms over 5 runs (min 4.2, max 17.5) and does 3 reads; removing 1,000 grants of a gone provider took 0.9 s, once.
  • Neither changes product behaviour beyond the two rules: the sweep removes only what rule 2 (and rule 1 for sessions) already says must not exist.

Where the producer lives. The rule lands in packages/plugins/plugin-auth (lifecycle, sign-in seams, boot hook). One file outside it: packages/platform-objects/src/identity/sys-session.object.ts declares the new column (plus its index and the sso_provider_deleted revoke reason in the published vocabulary), because sys_session is declared there; its translation bundles are regenerated and the new label translated. The tenant-audit census page for plugin-auth is regenerated for the two new session writes, both stating their system context.

Not touched: client-address.ts and objectql-adapter.ts (other in-flight work).

Tests

  • src/sso-saml-refusal-landing.test.ts — new top-level describe on the real SAML end-to-end harness (real AuthManager, real sso() plugin, the IdP played with the vendor's own samlify): two providers, a new and a returning sign-in through one, a sign-in through the other, a real delete through the vendor's door. Pins that the first provider's sessions end (with the reason and the count in the answer) and the other provider's session stays; a control where the vendor refuses the delete and nothing ends. The sign-in helper gained an optional providerId (default unchanged).
  • src/sso-provider-lifecycle.test.ts (real ObjectQL over better-sqlite3, real AuthPlugin boot hooks):
    • the delete door revokes the provider's live sessions; an already-ended one keeps its own reason; another provider's and a password session stay;
    • at boot, grants of a provider with no row are removed while a live provider's, one by hand and a SCIM one stay;
    • at boot, live sessions of a gone provider are revoked while another provider's, an unstamped one and an ended one stay as they are;
    • a provider registered while the sweep runs keeps what its sign-ins wrote;
    • what a delete whose cleanup failed left behind is removed at the next boot;
    • the existing delete-answer pin now includes revokedSessions.
  • src/sso-session-provider.test.ts (new) — which sign-in source names a provider; the settle writes once on the session its request minted; a control for another request or a non-SSO sign-in; a write failure is said once at error naming the provider and the session, and the sign-in is not failed.

Acceptance notes

  • The preflight (GET /admin/sso/delete-impact, the delete action's confirmation) still counts users, mappings and grants only; the session count appears in the delete's own answer. Adding it to the preflight is a separate UX change, not done here.
  • L2 contract-tier review is owed to the security seat.

Verification

Current head 4beed2475: the three SSO suites 152/152 and the lifecycle file 48/48 (seat's contract-tier delta read, from a git archive export); pins at the bulk ceiling + 1 for the delete-time revoke and the boot sweep are red on the previous head and green here; CI green.

Earlier rounds below: Local runs on 6a7ee0ae unless a row names another commit.

  • Red on base (dc10b3b4): rule 1 pin — 1 failed (the assertion after a 200 delete); rule 2 pin — 1 failed (2 grants left that the rule removes). Green after.
  • Guard ablation (each: mutation proven on disk by scripts/ablation-replace.mjs, then restored to the HEAD blob with git diff HEAD empty): 6 guards — staging the provider at sign-in, settling it on the session, revoking at delete, the boot hook, the mid-sweep provider re-read, the liveness filter on revocation — each turned its pin red (1 or 3 failed) and green on restore. Two guards first stayed green (no pin reached them); the two pins above were added and both then went red under ablation.
  • Package suites: @objectstack/plugin-auth 292/292 files, 6194 passed, 10 skipped; @objectstack/platform-objects 125/125 files, 2117 passed. Typecheck of both packages: exit 0.
  • Gate union: the 111 families node scripts/pm/dispatch-gates.mjs --commands derives for this diff, each run locally on 6a7ee0ae with its exit code captured before any pipe: 111 exit 0. dispatch-gates --ran: 111 derived, 111 run, 0 unrun. An earlier run on a previous head surfaced four findings, each fixed on this branch (translation bundles, the tenant-audit census, the optional error-sink contract, module-top loading in edited test files), and three prerequisite refusals cleared by building or fetching what they read. CI-only families are read from this pull request's check-runs.
  • Dogfood battery (narrowing arm): 6a7ee0ae · lock VERDICT command-exit 0 · Test Files 483 passed, 3 skipped (486) · Tests 4101 passed, 68 skipped (4169) · no failures.

Read first (risk order): packages/plugins/plugin-auth/src/sso-provider-lifecycle.ts (sweepDeletedSsoProviderAccess, removeSsoProviderDependents), packages/plugins/plugin-auth/src/sso-session-provider.ts, packages/plugins/plugin-auth/src/auth-manager-database-hooks.ts (the settle call in session.create.after).

Two-minute check: pnpm --filter @objectstack/plugin-auth exec vitest run src/sso-saml-refusal-landing.test.ts -t "deleting an identity provider" — 2 passed.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes (CI).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Dispatched as a no-card security order by security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov; developer session session_017xRBcVBc1xrigvFwcDc9mc. The draft was opened by the seat from the developer's payload (the developer's own relay write was refused by its session's permission check).

🤖 Generated with Claude Code

https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc

…cess it vouched for

Red on base: both pins fail before the implementation lands.

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
…uched for

A session records the SSO provider it was signed in through; deleting the
provider ends those live sessions. What a provider that no longer exists
left behind is removed at every boot.

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
…weep's mid-run provider read

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
…e tenant audit census reads it

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 21, 2026
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/platform-objects, @objectstack/plugin-auth, touching 41 documentable anchor(s).

12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/ai/connect-mcp.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS))
  • content/docs/api/error-catalog.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS))
  • content/docs/data-modeling/objects.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS), revoked_at (literal, a string literal in SESSION_ROW_FIELDS))
  • content/docs/deployment/environment-variables.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/deployment/self-hosting.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS))
  • content/docs/kernel/contracts/cache-service.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/kernel/runtime-services/audit-service.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/permissions/authentication.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), expires_at (literal, a string literal in SESSION_ROW_FIELDS), provider_id (literal, a string literal in storedProviderIds), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/permissions/authorization.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/permissions/sharing-rules.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/permissions/sso.mdx (via removedGrants (symbol, a field of interface SsoProviderAccessSwept), revokedSessions (symbol, a field of interface SsoProviderAccessSwept; a field of interface SsoProviderDeleteAnswer; a field of interface SsoProviderDependentsRemoved), sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), mappingId (literal, a string literal in settleSsoProviderDelete), provider_id (literal, a string literal in storedProviderIds), sso_provider_deleted (literal, a string literal in SSO_PROVIDER_DELETED_REVOKE_REASON), sys_session (literal, a string literal in SESSION_OBJECT), /api/v1/auth/admin/scim/delete-group-mapping (route, a path literal in settleSsoProviderDelete))
  • content/docs/protocol/kernel/realtime-protocol.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS))

⛔ 6 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v15.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS))
  • content/docs/releases/v17/17-2.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/releases/v17/17-3.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/releases/v17/17-4.mdx (via sys_session (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects), sys_session (literal, a string literal in SESSION_OBJECT))
  • content/docs/releases/v17/17-5.mdx (via provider_id (literal, a string literal in storedProviderIds))
  • content/docs/releases/v18/18-0.mdx (via expires_at (literal, a string literal in SESSION_ROW_FIELDS))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: organization_id (literal, 41 pages)
  • 5 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 68 of 250 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 23 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json ed33f8aedcee622a0e9859c6a58a3398ee8ed705 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 39c2806e0f5f0ced5b11e7180fb6185e525b00eb — the merge of head 347227c59e9357b14d29709167939c3b8b715080 into base ed33f8aedcee622a0e9859c6a58a3398ee8ed705, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 39c2806e0f5f0ced5b11e7180fb6185e525b00eb && git checkout 39c2806e0f5f0ced5b11e7180fb6185e525b00eb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin ed33f8aedcee622a0e9859c6a58a3398ee8ed705 347227c59e9357b14d29709167939c3b8b715080 && git checkout -B drift-repro ed33f8aedcee622a0e9859c6a58a3398ee8ed705 && git merge --no-ff 347227c59e9357b14d29709167939c3b8b715080

node scripts/docs-audit/affected-docs.mjs --json ed33f8aedcee622a0e9859c6a58a3398ee8ed705

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs ed33f8aedcee622a0e9859c6a58a3398ee8ed705 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract-tier review (L2) — REWORK · head 6a7ee0ae1a1d8471a95fc2c350a522daf1446446. Reviewed by an isolated CONTRACT_REVIEW_TIER thread, read-only. Contract: PASS. Security: one blocking item.

What holds

  • Every vendor site that mints an SSO session stamps it through one seam, and a client cannot set the column.
  • The delete matches only that provider's id. The sweep requires the provider to be absent from both reads.
  • Metadata-protocol: none with patch is consistent with the precedent for a system column.
  • The BREAKING banner and the ADR-0087 marker are present. Bundles and census are regenerated.
  • 3 test files, 147 passed. CI is green.

Owed (head moves), then a delta read

  1. Blocking. sso-session-provider.ts ~38-39: the docblock states rule only. Delete the sentence that does not.
  2. sso-provider-lifecycle.ts ~628 and sso.mdx ~1038: the degradation log and the docs name the true fix for a failed cleanup. A restart's sweep settles grants and sessions; the provider's group mappings are not settled by it.
  3. sso-provider-lifecycle.ts ~530 and ~770: when two sweeps run over one candidate set (two nodes booting), a row already removed by the other sweep must not be logged as a failure.
  4. Title, changeset (~:6) and sso.mdx (~1016): name exactly what is ended (the sessions a sign-in through the provider opened, and its projected grants), so the claim is no wider than what is enforced.

Nits

  • Set-based session revoke (a multi update exists), or say why not.
  • Pin the sweep's failure log and its no-op when the provider object is unregistered.

…s and names the true remedy

The session revoke and the grant removal are predicate writes, so a row another
writer settled first is not matched rather than refused. The failed-cleanup
remedy, the docs and the changeset say what the boot sweep settles (the
sessions and projected grants) and how the group mappings are cleared.

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
…ed session as it is

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
…e to the tenant audit census

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

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcVBc1xrigvFwcDc9mc
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/sec2-ggfh",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/36173",
  "session": "session_017xRBcVBc1xrigvFwcDc9mc",
  "premise_still_valid": true,
  "delta_of": "L2 REWORK on head 6a7ee0ae (security#2 record, comment 7073575684); this report covers head ecc0144b",
  "summary": "All four owed items and both nits closed on claude/sec2-ggfh (6a7ee0ae -> ecc0144b, 5 commits). (1) The sso-session-provider.ts docblock now states the rule only. (2) The failed-cleanup error log and sso.mdx name the true remedy: a restart's boot sweep ends the provider's live sessions and removes its projected grants; it does not remove the provider's group mappings, which are deleted one by one with Setup's Delete Mapping or POST /api/v1/auth/admin/scim/delete-group-mapping (verified: that route takes any mapping id, with no provider check). (3) Session revoke and grant removal are predicate writes (multi: true, the id set always spelled $in), so a row another sweep settled first is not matched instead of refused: measured red before (Record ups_both not found, logged FAILED at boot), green after; a session the user signed out of between the candidate read and the write keeps its own reason (revoked_at: null in the predicate). (4) Changeset title/banner and the sso.mdx lead name exactly what is ended: the sessions a sign-in through the provider opened, and its projected grants. Nits: set-based revoke done (see tests for why it is an id-set predicate and not a provider-id predicate); the sweep's failure log (error, and warn for a sink without error) and its no-op with the provider object unregistered are pinned.",
  "new_title": "fix(plugin-auth)!: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants",
  "tests": "New pins in sso-provider-lifecycle.test.ts: two sweeps over one candidate set settle without a failure log (red on 6a7ee0ae: the racing sweep threw and boot logged FAILED; green after); a sweep that cannot read is said once at error, and on warn for a sink with no error; with the provider object unregistered the sweep removes nothing; the delete leaves an already-expired session unrevoked. Why an id-set predicate, not a provider-id one: an expires_at range predicate matched 0 rows on the in-memory engine the SAML e2e uses (measured: revokedSessions 0, pin red), and an expired-but-unrevoked row must stay an ordinary row the TTL sweep reaps; so liveness is filtered from the read and the write is one multi update over the id set with revoked_at null. Ablations on the new code (ablation-replace, restored to the HEAD blob each time): scalar id for one row -> race pin red; revoked_at null dropped from the predicate -> race pin red; delete-time revoke removed -> 2 red; liveness filter removed -> first run green (unpinned), expired-session pin added, then red. Suites at ecc0144b: the three SSO suites 3/3 files, 150 passed; full plugin-auth at 42bffe91 (runtime-identical to ecc0144b, which only removes two type casts and regenerates the census page) 292/292 files, 6199 passed, 10 skipped; plugin-auth tsc exit 0 at ecc0144b.",
  "gates": "Local union on ecc0144b: 111 families from dispatch-gates --commands, each exit captured before any pipe: 111 exit 0; dispatch-gates --ran: 111 derived, 111 run, 0 NOT-MEASURED, 0 UNRUN. Fixed in this round: check-tenant-audit-census (the predicate writes' system context was hidden by type casts; casts removed, census page regenerated, both writes read as elevated). CI: the PR's check-runs read at report time all completed success or skipped (Lint and Repo Gates, TypeScript Type Check, Test Core 10/10, Build Core, Dogfood Regression Gate, Live E2E UI, Governed Surface Queue Guard, Check Changeset among them); the read does not name the commit they ran on, so the seat reads ecc0144b's own.",
  "dogfood_battery": "tree built from 42bffe91 (ecc0144b differs only by two removed type casts and the census page) · lock VERDICT command-exit 0 · Test Files 483 passed, 3 skipped (486) · Tests 4101 passed, 68 skipped (4169) · no failures",
  "mcp_calls": "3 read-only: github issue_read get_comments on 36173, pull_request_read get_check_runs on 36173; claude-code-remote send_message to the seat (previous round). No MCP write.",
  "api_writes": "this comment via post-stamped (1); git push x6 (not REST)",
  "deviations": [
    "One run of the three SSO suites (after the cast removal) ran outside os-verify-lock; every other build and test went through it.",
    "A gate-union runner whose pid was not recorded was left to finish rather than killed (the process-kill hook refused a name match); the union was then re-run on ecc0144b with its pid recorded."
  ],
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": []
}

…of sessions and grants

Candidates are read and written in bounded pages, so no single write
reaches the engine's per-row-hook ceiling. Wording names exactly what a
delete ends.

Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl and removed size/l labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcVBc1xrigvFwcDc9mc
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/sec2-ggfh",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/36173",
  "session": "session_017xRBcVBc1xrigvFwcDc9mc",
  "premise_still_valid": true,
  "delta_of": "security#2 delta read at ecc0144b (new blocking item: one multi write above the engine's per-row-hook ceiling); this report covers head 4beed247",
  "summary": "Closed on claude/sec2-ggfh (ecc0144b -> 4beed247, 1 commit). The delete-time revoke and grant removal and the boot sweep now read and write in pages of SSO_PROVIDER_WRITE_BATCH = 500 rows (below MAX_BULK_PER_ROW_HOOK_ROWS 10,000 and SQLite's legacy 999-parameter bind limit), walking by an id cursor so any count is ended; the sweep re-reads the provider rows per page. Reproduced the seat's measurement first: with the ADR-0092 identity write guard bound (the unfiltered per-row hooks every served deployment has), 10,001 live sessions and 10,001 projected grants of one provider -> the delete answered dependentsRemoved false with 0 revoked, and the boot sweep failed; green after. Wording nits: sso-session-provider.ts docblock, the sys_session revoke-reason comment, the auth-plugin boot-hook comment, the lifecycle docblock and the e2e section header now name exactly what is ended (the sessions a sign-in through the provider opened, and its projected grants).",
  "new_title": "fix(plugin-auth)!: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants",
  "tests": "New in sso-provider-lifecycle.test.ts, describe 'a provider with more sessions and grants than one write may touch still has every one ended' (MAX_BULK_PER_ROW_HOOK_ROWS + 1 rows seeded through the driver in 500-row chunks, identity write guard bound): the delete ends every live session and removes every projected grant; the boot sweep does the same for a provider that is gone. Both red on ecc0144b (delete: dependentsRemoved false, revokedSessions 0; sweep: undefined, logged FAILED), green after (under 1 s each). The race pin was reshaped for the paged sweep: another node settles the grant after the grant page read and the sessions after the session page read; the outer sweep reports 0/0 with no failure log, and a session the user signed out of keeps user_revoked. Ablations (ablation-replace, each restored to the HEAD blob with git diff HEAD empty): batch raised to 20,000 -> both ceiling pins red; single page only -> both ceiling pins red; scalar id for one row -> race pin red; revoked_at null dropped from the write -> race pin red. Not ablated: the id cursor (without it a page of expired-but-unrevoked sessions would be re-read forever; a hang, not a verdict). Suites at 4beed247: the three SSO suites 3/3 files, 152 passed; tsc exit 0; full plugin-auth 292/292 files, 6201 passed, 10 skipped.",
  "gates": "Local union on 4beed247: 111 families from dispatch-gates --commands, each exit captured before any pipe. 107 exit 0 in the runner; 4 read build output that the concurrent dogfood closure build was rewriting at that moment (check:skill-examples and check:type-check-debt exit 3 prerequisite; check:dts-closure and check:dual-build-cjs-loads exit 1 naming missing dist files of service-analytics and driver-mongodb, which are not in this diff); all 4 re-run on 4beed247 once that build had finished: exit 0 each. CI: not read for 4beed247 at report time.",
  "dogfood_battery": "4beed247 · os-verify-lock VERDICT command-exit 0 (held 35m08s) · Test Files 483 passed, 3 skipped (486) · Tests 4101 passed, 68 skipped (4169) · no failures",
  "mcp_calls": "0 this round",
  "api_writes": "this comment via post-stamped (1); git push x1 (not REST)",
  "deviations": [
    "The first ceiling+1 run, on a harness with no per-row hooks bound, stayed green on ecc0144b; the pin now binds the identity write guard, as a served deployment does, and is red on ecc0144b."
  ],
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": []
}

@objectstack-fleet objectstack-fleet Bot changed the title fix(plugin-auth)!: deleting an identity provider ends the access it vouched for fix(plugin-auth)!: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 73141a2c79f74511fe81ecd521b5b75ea997e062
Local-runs: none
Scope: packages/platform-objects/src/apps/translations/ar.objects.generated.ts, packages/platform-objects/src/apps/translations/de.objects.generated.ts, packages/platform-objects/src/apps/translations/en.objects.generated.ts, packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts, packages/platform-objects/src/apps/translations/fr.objects.generated.ts, packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts, packages/platform-objects/src/apps/translations/ko.objects.generated.ts, packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts, packages/platform-objects/src/apps/translations/ru.objects.generated.ts, packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts, packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts, packages/platform-objects/src/identity/sys-session.object.ts, packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/auth-manager-database-hooks.ts, packages/plugins/plugin-auth/src/auth-plugin.ts, packages/plugins/plugin-auth/src/sso-provider-lifecycle.test.ts, packages/plugins/plugin-auth/src/sso-provider-lifecycle.ts, packages/plugins/plugin-auth/src/sso-saml-refusal-landing.test.ts, packages/plugins/plugin-auth/src/sso-session-provider.test.ts, packages/plugins/plugin-auth/src/sso-session-provider.ts + none

① Derived judgments

Deleting an SSO provider ends the sessions that a sign-in through it opened, and removes the grants projected from it. Every vendor site that mints an SSO session stamps it through one seam, and a client cannot set that column. The delete matches only that provider's id. The boot sweep acts only on a provider that both reads report absent. Writes run in bounded batches of 500 ids, behind a keyset walk, so every matching row is ended whatever the count. A failed batch is logged with its cause and remedy, and the next boot sweep settles what remains.

Review trail:

  • Full review: comment 7073575684 (REWORK; contract PASS, one blocking wording item).
  • Isolated delta reviews: one round sent back the paging; then PASS at 4beed2475, with every earlier item closed.
  • The seat refreshed the title and body to the delta's wording.
  • This head is 4beed2475 plus a merge of origin/main only. Its parents are 4beed2475 and d8599c2ca, and its tree equals git merge-tree of them.
  • CI at this head: 40 success, 15 expected skips, 0 failed. landing-k OK, K = 6.

② Semver level

patch, as declared: Clause-②: no (narrowing), Metadata-protocol: none. This is consistent with the precedent for a system column. The changeset and the title carry the BREAKING banner and !. The ADR-0087 marker is present, and the bundles and census are regenerated.

③ Boundary flags

The change narrows the accept-set: a session or grant that came through a deleted provider no longer admits. SQL push-down: none added; each batch is one id $in write.

④ Design judgment

One seam stamps the provider, and one bounded walk ends what depends on it, at delete and at boot alike. No must-fix or should-fix is open at this head; only nits remain.

Implemented-by: session_017xRBcVBc1xrigvFwcDc9mc
Reviewed-by: session_017xRBcW9L8Noz9BxEwjwiov

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

席位记录 · ACCEPT · head 73141a2c79f74511fe81ecd521b5b75ea997e062

维护者速读

  • 改了什么:删除一个 SSO 身份提供方后,经它登录产生的会话会被结束,由它投射出的授权会被移除。启动时的补扫会处理之前没清理完的部分。
  • 为什么:加固 SSO 生命周期的安全性,属于安全席位的无卡派单。
  • 若出错:只会多拒,不会多放(被删提供方的用户需要重新登录);可以直接撤回。
  • 要你做什么:请用授权账号批准当前 head 73141a2c7(签名契约审核记录:评论 7076035891)。批准后,由席位翻 ready、入队、落地。

席位意见:ACCEPT。完整审核和两轮改动复核提出的应修项已全部关闭。

席位核对

  1. 形态: draft PR,以 main 为基,无卡。改动 plugin-auth 和 platform-objects(均为 patch)、一个文档页和一个 changeset。当前 head 只是在已复核的 head 4beed2475 上合入了 main,树与 merge-tree 一致。
  2. 前提实测: 修前红,修后绿。撤掉分页后,处在上限的两条钉子测试都会变红;中途失败的批次会被下次启动补扫收尾,已实测。
  3. 门禁: 当前 head 上 40 项成功、15 项预期跳过、0 项失败。landing-k OK,K = 6。
  4. 接受的偏差: 写入按每批 500 个 id 分批,没有做成一条集合语句,以免超过引擎的行数上限和 SQLite 的绑定上限。
  5. 范围外去向,Skills-docs:: Skills-docs: none,规则写在 content/docs/permissions/sso.mdx。范围外事项已由安全席位另行记录。未触及 skills/**。
  6. 落地条款:
    • 本 PR 申报为收窄,落地需要两半同时在案:授权账号对当前 head 的批准,以及本 head 上的签名契约审核 PASS。
    • 两半齐备后,执行 pr_ready 与 automerge_enable。
    • 合并后记入台账。

@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 22, 2026
@os-zhuang
os-zhuang marked this pull request as ready for review November 22, 2026 07:40
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 22, 2026
# Conflicts:
#	packages/plugins/plugin-auth/src/auth-manager-database-hooks.ts
@os-zhuang
os-zhuang enabled auto-merge November 22, 2026 08:51
@os-zhuang
os-zhuang disabled auto-merge November 22, 2026 09:20
@os-zhuang
os-zhuang enabled auto-merge November 22, 2026 09:21
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 347227c59e9357b14d29709167939c3b8b715080
Local-runs: none
Scope: packages/platform-objects/src/apps/translations/ar.objects.generated.ts, packages/platform-objects/src/apps/translations/de.objects.generated.ts, packages/platform-objects/src/apps/translations/en.objects.generated.ts, packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts, packages/platform-objects/src/apps/translations/fr.objects.generated.ts, packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts, packages/platform-objects/src/apps/translations/ko.objects.generated.ts, packages/platform-objects/src/apps/translations/pt-BR.objects.generated.ts, packages/platform-objects/src/apps/translations/ru.objects.generated.ts, packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts, packages/platform-objects/src/apps/translations/zh-Hant.objects.generated.ts, packages/platform-objects/src/identity/sys-session.object.ts, packages/plugins/plugin-auth/src/auth-manager-auth-instance.ts, packages/plugins/plugin-auth/src/auth-manager-database-hooks.ts, packages/plugins/plugin-auth/src/auth-plugin.ts, packages/plugins/plugin-auth/src/sso-provider-lifecycle.test.ts, packages/plugins/plugin-auth/src/sso-provider-lifecycle.ts, packages/plugins/plugin-auth/src/sso-saml-refusal-landing.test.ts, packages/plugins/plugin-auth/src/sso-session-provider.test.ts, packages/plugins/plugin-auth/src/sso-session-provider.ts + none

① Derived judgments

Deleting an SSO provider ends the sessions that a sign-in through it opened, and removes the grants projected from it. Every vendor site that mints an SSO session stamps it through one seam, and a client cannot set that column. The delete matches only that provider's id. The boot sweep acts only on a provider that both reads report absent. Writes run in bounded batches of 500 ids, behind a keyset walk, so every matching row is ended whatever the count. A failed batch is logged with its cause and remedy, and the next boot sweep settles what remains.

Review trail:

  • Full review: comment 7073575684 (REWORK; contract PASS, one blocking wording item).
  • Isolated delta reviews: one round sent back the paging; then PASS at 4beed2475, with every earlier item closed.
  • The seat refreshed the title and body to the delta's wording.
  • 73141a2c7 is 4beed2475 plus a merge of origin/main only; its tree equals git merge-tree of its parents.
  • The previous record (comment 7076035891) named 73141a2c7. This head merges origin/main into it again, after fix(plugin-auth)!: a disabled or removed account keeps nothing running in its name #36163 landed. Its only hand-resolved hunk is in auth-manager-database-hooks.ts: the import block keeps both sides' imports and drops the conflict markers. No other line differs from git merge-tree of the parents. That merge is 13d1d9cdf. This head, 347227c59, merges origin/main into it once more, cleanly and with no hand edit, to bring K under 15. The seat read both merges under the review downgrade.
  • CI at this head: 35 success, 15 expected skips, 0 failed, 4 still running when this record was written. landing-k OK, K = 11.

② Semver level

patch, as declared: Clause-②: no (narrowing), Metadata-protocol: none. This is consistent with the precedent for a system column. The changeset and the title carry the BREAKING banner and !. The ADR-0087 marker is present, and the bundles and census are regenerated.

③ Boundary flags

The change narrows the accept-set: a session or grant that came through a deleted provider no longer admits. SQL push-down: none added; each batch is one id $in write.

④ Design judgment

One seam stamps the provider, and one bounded walk ends what depends on it, at delete and at boot alike. No must-fix or should-fix is open at this head; only nits remain.

Implemented-by: session_017xRBcVBc1xrigvFwcDc9mc
Reviewed-by: session_017xRBcW9L8Noz9BxEwjwiov

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · sunhaolin · session_017xRBcVBc1xrigvFwcDc9mc
os-dev-report

{
  "issue": null,
  "status": "done",
  "branch": "claude/sec2-ggfh",
  "pr": "https://github.com/objectstack-ai/objectstack/pull/36173",
  "session": "session_017xRBcVBc1xrigvFwcDc9mc",
  "premise_still_valid": true,
  "delta_of": "merge-queue removal of 73141a2c (reason MERGE_CONFLICT); this report covers head 13d1d9cd",
  "summary": "Merged origin/main (3faabd26) into claude/sec2-ggfh as 13d1d9cd (parents 73141a2c, 3faabd26). One conflict, imports only, in packages/plugins/plugin-auth/src/auth-manager-database-hooks.ts: main added two imports (removed-account-registrations, auth-actor-attribution) at the line where this PR adds the sso-session-provider import; resolved by keeping all three. The session.create.after settle call is unchanged. The PR's own diff is unchanged. The review record and the approval named 73141a2c, so the head they cover has moved; re-queueing is not the developer's act.",
  "tests": "On 13d1d9cd: plugin-auth tsc exit 0; the three SSO suites 3/3 files, 152 passed; full plugin-auth 293/293 files, 6251 passed, 10 skipped (main brought one more test file and more cases).",
  "gates": "Local union on 13d1d9cd: 111 families from dispatch-gates --commands; 108 exit 0 in the runner; check:skill-examples, check:dual-build-cjs-loads and check:i18n exit 3 (prerequisite: this fresh worktree had not built what they read); after building their prerequisites, all three exit 0. 111/111 exit 0.",
  "dogfood_battery": "13d1d9cd · os-verify-lock VERDICT command-exit 0 (held 35m41s) · Test Files 484 passed, 3 skipped (487) · Tests 4107 passed, 68 skipped (4175) · no failures",
  "mcp_calls": "0 this round",
  "api_writes": "this comment via post-stamped (1); git push x1 (not REST)",
  "deviations": [
    "The dedicated worktree, removed after the PASS, was recreated for this merge (primary checkout detached again)."
  ],
  "open_questions": [],
  "security_findings": "withheld",
  "out_of_scope_findings": []
}

Merged via the queue into main with commit 4e55e4e Nov 22, 2026
55 checks passed
@os-zhuang
os-zhuang deleted the claude/sec2-ggfh branch November 22, 2026 10:18
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/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants