Repository navigation
fix(runtime)!: a member removed from an environment is refused on their next request - #32919
Conversation
…r next request The environment-membership gate judges every request against the membership store as it stands; no admission is carried from one request to the next. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czRj9LhJRdzK77xHSP
…their next request Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czRj9LhJRdzK77xHSP
…econd The dispatcher suite pinned the reuse of an admission across calls; it now pins the rule that replaces it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czRj9LhJRdzK77xHSP
…pt between requests Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czRj9LhJRdzK77xHSP
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 1 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 29 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 2734aa658f9d6d331c2e6b436a65938997d8a9eb && git checkout 2734aa658f9d6d331c2e6b436a65938997d8a9eb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 1a6c330945dac00bb42fccd09f42e39ce510d8e1 dd7562583d436be54100a980276c45e67e130510 && git checkout -B drift-repro 1a6c330945dac00bb42fccd09f42e39ce510d8e1 && git merge --no-ff dd7562583d436be54100a980276c45e67e130510
node scripts/docs-audit/affected-docs.mjs --json 1a6c330945dac00bb42fccd09f42e39ce510d8e1
|
check-test-source-alias judges the test files a change edits, and this one now reaches the dispatcher's dynamic metadata import; the module-top import is the gate's prescription. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czRj9LhJRdzK77xHSP
|
security#1 · os-elon-musk · session_016WV4cx5nHfga3Hm9BzikGw Contract-review-claim: session_016WV4cx5nHfga3Hm9BzikGw · head dd75625 · 2026-11-13T00:04Z The implementing thread may not review its own fix; the lane seat takes it (narrowing face, CONTRACT_REVIEW_TIER). |
|
security#1 · os-elon-musk · session_016WV4cx5nHfga3Hm9BzikGw Contract reviewServed-tier: Read: card #32230 (body and all 5 comments), PR #32919 (body, 2 comments, 5 files), the net diff against ① Derived judgmentsAccept-set, at the environment-membership check (
Public surface: none moves. No export, option, config key, wire shape or error code is added or removed; both answers above already exist. Two ② Semver level
③ Boundary flags
④ Design judgmentAgainst the published spec on
Findings: 0 must-fix, 0 should-fix, 5 nits. Nits alone end the round. Implemented-by: VERDICT: PASS |
|
security#1 · os-elon-musk · session_016WV4cx5nHfga3Hm9BzikGw 席位核对 — ACCEPT · security#1 · head
|
|
security#1 · os-elon-musk · session_016WV4cx5nHfga3Hm9BzikGw Landing: contract review PASS 6839864260 and seat ACCEPT 6839866031 on |
Requested by Elon · project thread
Fixes #32230
Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — no published skill teaches the environment-membership check (git grep over skills/ for the check, its error code and the member object: 0 hits)
维护者速读
pnpm --filter @objectstack/runtime exec vitest run src/http-dispatcher-membership-revocation.test.ts,预期 7 个用例全部通过。What changes
The rule: a membership change takes effect on the next request. On a host that enforces environment membership, the check judges every scoped request against the membership store as it stands and carries no admission from one request to the next. So a member removed from an environment is refused on their next request, on every replica serving it, and a request whose membership the store cannot answer is the outage (
AuthzStoreUnavailableError,503 SERVICE_UNAVAILABLE), never "allowed", whoever was admitted a moment before.packages/runtime/src/http-dispatcher.ts:judgeMembershipOfreadssys_environment_memberfor every judged request and keeps no admission between requests. Both doors that share the judgment (dispatch()and the declarative-endpoint stepenvironmentMembershipRefusal) follow the rule.enforceProjectMembership: false, compositions that register no environment-member object, the 403PROJECT_MEMBERSHIP_REQUIREDanswer and the fail-closed read (finding(runtime, plugin-auth): two access guards fail open when their own read faults — the environment-membership gate and the organization slug guard #21941).packages/runtime/src/http-dispatcher.test.ts: a case that pinned the earlier behaviour now pins the rule (a member removed between two calls is refused on the second).packages/runtime/src/domains/meta-list-projection-parity.test.ts: one comment no longer names a membership answer kept between requests, and a side-effect import the test-source alias lint requires. No assertion changes..changeset/environment-membership-removal-next-request.md:patchon@objectstack/runtime,!summary, BREAKING paragraph with "Who moves", ADR-0087not-required (no-migration-prescription)marker.Tests
packages/runtime/src/http-dispatcher-membership-revocation.test.ts(new, 7 cases, named by the rule):Ablation (one-shot, not kept): with the rule removed from the committed fix, 4 of the 7 cases go red, the four the rule decides; the re-add case and both CONTROL cases stay green. Restored: blob equal to
HEAD,git diff HEADempty.Acceptance notes
503while the membership store is unreachable. The seat's relay of it is claim comment 6838259317 on runtime: 环境成员缓存(60 秒)在成员变更时不失效,被撤权的用户最长还能访问一分钟 #32230.resolve-authz-context.tsstates (cache a success only behind seams that observe the writes it depends on, with a TTL as the residual bound); the code comment at the read says so.Verification
Readings name their tree. Head of this PR:
dd756258. It is26651cce(the fix99d1a01b, the changeset97fe2d48, and one merge oforigin/maintouching neitherpackages/runtime,packages/corenorpackages/objectql) plus1bf1aeb3(the dispatcher suite's pin rewritten to the rule),b7b373fd(one comment in a test file) anddd756258(a side-effectimport '@objectstack/metadata';at the top ofmeta-list-projection-parity.test.ts, which the test-source alias lint requires).Before the fix (the new suite, ablated tree)
The new suite with the rule removed from the committed fix (
97fe2d48, mutation viascripts/ablation-replace.mjs, anchor hit 1 -> 0, blob changed on disk):Tests 4 failed | 3 passed (7). The four the rule decides go red. Restored: blob equal toHEAD,git diff HEADempty. A first attempt was refused by the tool before any run (its replacement contained the anchor, so the anchor count could not fall); nothing ran on that attempt.After the fix: the membership suites
At
97fe2d48,pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2over the new suite,http-dispatcher-membership-session-principal,http-dispatcher-membership-resolved-principal,http-dispatcher-membership-vetted-organization,http-dispatcher.membership-system-context,http-dispatcher.membership-skip-boundaryanddispatcher-plugin.endpoint-environment-membership.integration:Test Files 7 passed (7),Tests 68 passed (68).@objectstack/runtime typecheck and full test
At
26651cce, under the verification lock: typecheck ok;Test Files 1 failed | 592 passed (593),Tests 1 failed | 11612 passed | 19 skipped (11632). The one failure was thehttp-dispatcher.test.tscase that pinned the earlier behaviour. After1bf1aeb3rewrote it to the rule:http-dispatcher.test.tsTests 254 passed (254).Derived gate union and dogfood battery
node scripts/pm/dispatch-gates.mjs --commandsatdd756258: 68 derived, 66 exit 0, 2 NOT MEASURED locally (check:dual-build-cjs-loadsand the type-check debt ledger: prerequisite not met in the build box; CI runs both, and CI'sType Check · debt ledgeris success on this head). Dogfood battery atdd756258: VERDICT exit 0,Test Files 456 passed | 3 skipped (459),Tests 3831 passed | 42 skipped (3873). CI ondd756258: every check-run complete, none failed.Generated by Claude Code