Repository navigation
fix(plugin-auth)!: deleting an SSO provider ends the sessions a sign-in through it opened and removes its projected grants - #36173
Conversation
…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>
…d for 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>
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>
Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc Co-authored-by: Claude <noreply@anthropic.com>
…ecycle suites Claude-Session: https://claude.ai/code/session_017xRBcVBc1xrigvFwcDc9mc Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 2 package(s): 12 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 6 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 23 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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
|
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract-tier review (L2) — REWORK · head What holds
Owed (head moves), then a delta read
Nits
|
…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>
|
security#2 · sunhaolin · session_017xRBcVBc1xrigvFwcDc9mc {
"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>
|
security#2 · sunhaolin · session_017xRBcVBc1xrigvFwcDc9mc {
"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": []
} |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewServed-tier: ① Derived judgmentsDeleting 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:
② Semver level
③ Boundary flagsThe 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 ④ Design judgmentOne 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: VERDICT: PASS |
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov 席位记录 · ACCEPT · head 维护者速读
席位意见:ACCEPT。完整审核和两轮改动复核提出的应修项已全部关闭。 席位核对
|
# Conflicts: # packages/plugins/plugin-auth/src/auth-manager-database-hooks.ts
|
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov Contract reviewServed-tier: ① Derived judgmentsDeleting 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:
② Semver level
③ Boundary flagsThe 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 ④ Design judgmentOne 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: VERDICT: PASS |
|
security#2 · sunhaolin · session_017xRBcVBc1xrigvFwcDc9mc {
"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": []
} |
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.
sys_session.sso_provider_id. AfterPOST /api/v1/auth/sso/delete-providersucceeds, 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.revokedSessionsbeside the other counts, and itsmessagesays it.mainsince the SSO provider lifecycle landed); the boot sweep settles what a provider with nosys_sso_providerrow 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 atinfowhat it removed and aterror(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
errorwith the remedy, and the next boot's sweep ends what remains.Boot sweep, not one-shot backfill — chosen by measurement:
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.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.tsdeclares the new column (plus its index and thesso_provider_deletedrevoke reason in the published vocabulary), becausesys_sessionis 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.tsandobjectql-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 (realAuthManager, realsso()plugin, the IdP played with the vendor's ownsamlify): 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 optionalproviderId(default unchanged).src/sso-provider-lifecycle.test.ts(real ObjectQL over better-sqlite3, realAuthPluginboot hooks):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 aterrornaming the provider and the session, and the sign-in is not failed.Acceptance notes
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.Verification
Current head
4beed2475: the three SSO suites 152/152 and the lifecycle file 48/48 (seat's contract-tier delta read, from agit archiveexport); 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
6a7ee0aeunless a row names another commit.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.scripts/ablation-replace.mjs, then restored to the HEAD blob withgit diff HEADempty): 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.@objectstack/plugin-auth292/292 files, 6194 passed, 10 skipped;@objectstack/platform-objects125/125 files, 2117 passed. Typecheck of both packages: exit 0.node scripts/pm/dispatch-gates.mjs --commandsderives for this diff, each run locally on6a7ee0aewith 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.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 insession.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
packages/specholds no runtime logic.pnpm lintpasses (CI).main, one pull request.packages/spectouched: not touched.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Dispatched as a no-card security order by
security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov; developer sessionsession_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