Repository navigation
fix(plugin-security, plugin-auth)!: a person-to-permission-set assignment refuses an agent ceiling set at every write door, and so does the self-registration permission set - #30578
Conversation
…its pins, not yet registered Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
…in it at the grant table's HTTP write doors Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
…an agent ceiling set at every write door Pin each grant-table write door in its own answer shape: createMany and the cross-object batch answer the whole 400 VALIDATION_FAILED envelope with invalid_value at permission_set; updateMany and the per-object batch fail the row in their per-row report with the same code and status. Add the changeset (Clause-②: no (narrowing), Metadata-protocol: none). Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
📓 Docs Drift CheckThis PR changes 2 package(s): 36 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 8 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. 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 ca97d8c8e18c197f5e3808c03473710c0c035ce2 && git checkout ca97d8c8e18c197f5e3808c03473710c0c035ce2
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 14c67d446e577926460f3ed893e44cc32cbecb12 e1305f7524b9172978bdc542dfc538bf153ee479 && git checkout -B drift-repro 14c67d446e577926460f3ed893e44cc32cbecb12 && git merge --no-ff e1305f7524b9172978bdc542dfc538bf153ee479
node scripts/docs-audit/affected-docs.mjs --json 14c67d446e577926460f3ed893e44cc32cbecb12
|
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
…m-context skips Row 23f: a system writer of sys_user_permission_set is not judged by the agent ceiling grant check; a non-system write that would store an assignment naming an MCP agent ceiling set is refused for every caller. The site register is regenerated with `node scripts/check-system-context-census.mjs --write`. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
|
security#1 · os-sales · session_01L6bhgVfjk2i8T2D4RmxsKg Contract reviewServed-tier: Face: the paths decide no face (no published schema, no governed path); the committed changeset's line-initial ① Derived judgments
② Semver levelChangeset ③ Boundary flags
④ Design judgmentOn the narrowing face, the narrowing is judged against the published spec on One must-fix, in the file under review:
Not blocking, recorded for the seat and the lane: the shoulds and the question in ③; Implemented-by: VERDICT: FAIL |
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
…ent ceiling set A self-registrant is a person, and an agent ceiling is not a person's set (ADR-0090 D10): the audience validation refuses `selfRegistrationPermissionSet` naming one of the MCP agent ceiling sets, beside its refusal of `admin_full_access`, at construction and through the auth settings. Pins: each ceiling name refused under both self-registration postures and through the settings channel; a person's set still declarable. The agent ceiling grant refusal's stand-down note and row 23f of the system-context page now state, writer by writer, what keeps a ceiling out of a system write. The changeset adds `@objectstack/plugin-auth: patch`. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
… once Both blocks share one file-level boot and sign up their own users, so the file pays for a single showcase boot: measured 13.31 s and 13.52 s with two boots, 9.00 s to 10.05 s over five runs with one, on a shared agent box. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg
|
security#1 · os-sales · session_01L6bhgVfjk2i8T2D4RmxsKg Contract reviewServed-tier: This is a DELTA record by the same reviewer, on the commits that land the findings of the record on ① Derived judgments
② Semver levelChangeset at head: ③ Boundary flags
④ Design judgmentThe design judgment of the record on Implemented-by: VERDICT: PASS |
|
security#1 · os-sales · session_01L6bhgVfjk2i8T2D4RmxsKg 维护者速读
席位核对 — ACCEPT · security#1 · head
|
Requested by Sales · project thread
Clause-②: no (narrowing) — a non-system insert or update of
sys_user_permission_setthat would store an assignment naming one of the three MCP agent ceiling sets (mcp_agent_data_read,mcp_agent_data_write,mcp_agent_restricted) is refused with400 VALIDATION_FAILED(invalid_valueatpermission_set), for every caller, a platform administrator included; and an audience configuration whoseselfRegistrationPermissionSetnames one is refused ([audience] invalid audience configuration), at construction and through the auth settings; nothing is widened.Metadata-protocol: none
Skills-docs: none —
skills/**teaches neither the assignment door's sets nor the self-registration set. TheselfRegistrationPermissionSetdescription inpackages/spec/src/system/auth-config.zod.tsnames theadmin_full_accessrefusal, which stays true; it does not list every set the runtime refuses, and this change makes no sentence there false.维护者速读
sys_user_permission_set的每个写入口(单条新建、更新、createMany、updateMany、两种批量、两种导入)现在拒绝存入三个 MCP 智能体上限权限集,统一返回400 VALIDATION_FAILED,字段permission_set、代码invalid_value;受众配置的自助注册权限集selfRegistrationPermissionSet也拒绝这三个集(启动时与认证设置里同样拒绝)。packages/plugins/plugin-security/src/agent-ceiling-grant-refusal.ts的onUpdate(以写后行判定,覆盖按谓词的多行更新)与它的系统写入说明;②packages/plugins/plugin-auth/src/audience-posture.ts中admin_full_access拒绝旁新增的智能体上限拒绝;③content/docs/permissions/system-context.mdx的 23f 行。pnpm --filter @objectstack/plugin-security exec vitest run src/agent-ceiling-grant-refusal.test.ts,预期Tests 14 passed (14)。What changes
MCP_AGENT_PERMISSION_SETS, imported from@objectstack/spec/ai, never retyped) are an AI agent's own grants: the door that admits an agent connected over MCP derives the ceiling from the scopes its user consented to and puts it on the agent's request. No assignment row is read for it, and nosys_userrow is an agent principal, so everysys_user_permission_setrow is a person's grant and never names one.packages/plugins/plugin-security/src/agent-ceiling-grant-refusal.ts, registers abeforeInsertand abeforeUpdateengine hook onsys_user_permission_set(priority 35: after the catalog check that the name is a set at all, before the holder's membership is read). Every door that writes the table writes through the engine, so each one is covered: the data API's create and update,createMany,updateMany, the per-object and cross-object batch, and the sync and job import doors.permission_setwhen it carries one, the stored one when it does not. So an update that keeps an assignment naming a ceiling in force (a new holder, a validity window, an echo of the set) is refused as well as a rename to a ceiling, by id and by predicate.@objectstack/plugin-auth). A self-registrant is a person, soassertAudienceConfigrefuses an agent ceiling set asselfRegistrationPermissionSet, beside its refusal ofadmin_full_access, with the message that refusal uses ([audience] invalid audience configuration: selfRegistrationPermissionSet must not be '...'). It applies at construction (auth.audiencein the stack config stops the boot) and on the auth settings patch (audience_self_registration_permission_setis refused and the standing audience keeps ruling).AudienceConfigSchemain@objectstack/specis not touched by this PR.isSystem) is not judged. Writer by writer: the platform-admin promotion and the organization-admin reconcile name their sets in code, and neither is a ceiling; the self-registration grant writes only the validatedselfRegistrationPermissionSet; seed replay and the development-only demo-staff seed write the sets their stack declares, unjudged. Every other permission set stays assignable. An agent principal's ceiling is resolved exactly as before. An organization administrator is still refused the same sets on the organization boundary first (403 PERMISSION_DENIED).validationFailure(the constructor both HTTP doors map) with onefields[]entry:field: 'permission_set',code: 'invalid_value'(the ADR-0114 member: the set exists, so it is notreference_not_found),value, and a sentence naming the way through. No new error code (ADR-0112).security-plugin-start-hooks.tscallsregisterAgentCeilingGrantRefusal(ql, ctx.logger)beside the permission-set name hooks. It is idempotent on a re-run ofstart(), and warns and returnsfalseon an engine with no hook registry.dist/index.d.tsanddist/index.d.mts: 0 hits for each of the five names, positive controlSecurityPlugin24 hits each)..changeset/sec-hardening-r6-agent-ceiling-grant.md,patchon@objectstack/plugin-securityand@objectstack/plugin-authwith a BREAKING banner, both declaration lines, its ADR-0087 disposition, and the fix for a deployment that holds such an assignment (delete it, or rename it to a set meant for people) or names such a set for self-registrants (declare a set meant for people).content/docs/permissions/system-context.mdxgains row 23f. Its Get cell names, writer by writer, what keeps a ceiling out of a system write (the fixed-name writers by construction, the self-registration set by the audience validation); its Lose cell names the seeds, which write what their stack declares. A non-system write that would store an assignment naming an MCP agent ceiling set is refused for every caller. Its generated site register now namesagent-ceiling-grant-refusal.ts#onInsertand#onUpdateunder that row (regenerated withnode scripts/check-system-context-census.mjs --write).Tests
packages/plugins/plugin-security/src/agent-ceiling-grant-refusal.test.ts(new, 14 tests; real ObjectQL engine, SQL driver on in-memory SQLite, the realSecurityPluginstarted on it):400,VALIDATION_FAILED, one field entrypermission_set/invalid_value/ the value), and nothing is stored;falseand one warning.packages/plugins/plugin-auth/src/audience-posture.test.ts(beside theadmin_full_accesspin): each of the three ceiling sets is refused asselfRegistrationPermissionSetunderopenandemail_domain, with the message pinned; control:member_defaultandportal_userstay declarable.audience-posture-setting.test.ts: a ceiling set stored asaudience_self_registration_permission_setis refused through the settings channel and the standinginvite_onlykeeps ruling.packages/qa/dogfood/test/grant-table-write-contract.dogfood.test.ts(new top-level block, 5 tests on the booted showcase stack over HTTP, sharing the file's one showcase boot with the existing block; itsbeforeAllasserts the shipped catalog serves all three ceiling sets, so the catalog check does not answer first):POSTof each ceiling set, and aPATCHrenaming a person grant to one, answer the full envelope and store nothing;createManyand the cross-object/batchanswer the full envelope;updateManyand the per-object batch fail the row in their per-row report withcode: 'VALIDATION_FAILED',httpStatus: 400;code: 'invalid_value'atpermission_set.false(viascripts/ablation-replace.mjs, restored automatically): 4 failed / 75 passed across the two files (the three ceiling pins and the settings-channel pin red, the person-set control and every other pin green); restored, the file's blob equals the committed one and both files pass.scripts/ablation-replace.mjs, restored automatically): the unit file goes 7 failed / 7 passed (every refusal pin red, every control green), and the dogfood block, rebuilt and checked withscripts/ablation-dist-preflight.mjs, goes 5 failed / 3 passed (the 3 are the file's existing grant-table pins), and each of the four door pins after the first, run alone so no earlier row feeds a later one, also goes red. Restored and rebuilt, both are green again.Acceptance notes
fields[].updateManyand the per-object batch answer200with a per-row report whose failed row carries the refusal'scodeandhttpStatusbut not itsfields[]entry; that is those doors' existing report shape for every validation refusal, not something this change introduces, so it is pinned as it stands.test-budget:header; a CI reading over it would be the case for one.no (narrowing).Verification
Head:
e1305f7524(branchclaude/sec-hardening-r6, merged withmainat 6701c08). The plugin-security ablation readings were taken on1b9179369a, and that module's code is unchanged since (its note was reworded). The plugin-auth ablation ran on398fe7f1d6(the one commit after it changes only the dogfood test file). Both package suites, the battery and the gates ran ate1305f7524.plugin-auth pins: 79 passed; ablated: 4 failed, 75 passed
plugin-security unit file: 14 passed; ablated: 7 failed, 7 passed
Dogfood file: 8 passed on one boot; ablated through the built bundle: 5 failed, 3 passed
Package suites: plugin-auth 4018 passed, plugin-security 5407 passed; typecheck clean
Full dogfood battery at e1305f7: 420 files passed, 3505 tests passed
Derived gates at e1305f7: 93 derived, 93 run, 0 not measured; all exit 0
node scripts/pm/dispatch-gates.mjs --commandsderived 93 commands for this change set (nine paths);--ranon the record: 93 run, 0 NOT-MEASURED, 0 UNRUN. Each exit code was captured before any pipe.node scripts/check-adr-0087-registration.mjs --base origin/mainnode scripts/check-adr-0087-registration.mjs --self-testnode scripts/check-adr-links.mjsnode scripts/check-adr-links.mjs --self-testnode scripts/check-changeset-no-major.mjs --base origin/mainnode scripts/check-closing-keyword-parity.mjsnode scripts/check-closing-keyword-parity.mjs --self-testnode scripts/check-comment-mask-adoption.mjsnode scripts/check-comment-mask-adoption.mjs --self-testnode scripts/check-comment-mask-corpus.mjsnode scripts/check-dev-prereqs.mjs --self-testnode scripts/check-doc-route-spelling.mjs --advisorynode scripts/check-doc-route-spelling.mjs --self-testnode scripts/check-docs-section-name.mjsnode scripts/check-docs-section-name.mjs --self-testnode scripts/check-dts-emitted.mjs --self-testnode scripts/check-empty-changeset.mjs --base origin/mainnode scripts/check-empty-changeset.mjs --self-testnode scripts/check-issue-citations.mjsnode scripts/check-plugin-teardown-shape.mjsnode scripts/check-plugin-teardown-shape.mjs --self-testnode scripts/check-section-landing-index.mjsnode scripts/check-section-landing-index.mjs --self-testnode scripts/check-tenant-audit-census.mjsnode scripts/check-tenant-audit-census.mjs --self-testnode scripts/ci/assert-turbo-remote-cache.mjs --self-testnode scripts/ci/plan-test-core-shards.mjs --self-testnode scripts/ci/prune-turbo-cache.mjs --self-testnode scripts/docs-audit/check-affected-docs.mjsnode scripts/docs-audit/check-drift-comment.mjsnode scripts/pm/release-rehearsal-clone.mjs --self-testnode scripts/release-pending-publish.mjs --self-testpnpm --filter @objectstack/lint run check:doc-formula-expressionspnpm --filter @objectstack/lint run check:doc-security-posturepnpm --filter @objectstack/spec run check:docspnpm --filter @objectstack/spec run check:duration-unit-keyspnpm --filter @objectstack/spec run check:empty-statepnpm --filter @objectstack/spec run check:livenesspnpm --filter @objectstack/spec run check:skill-examplespnpm --filter @objectstack/spec run check:strictness-ledgerpnpm --filter @objectstack/spec run check:variant-docspnpm --filter @objectstack/spec run check:yaml-examplespnpm check:changeset-gate-self-testspnpm check:ci-filter-paritypnpm check:closed-ceremony-textpnpm check:corpus-claim-driftpnpm check:cross-package-test-inputspnpm check:dispatcher-error-vocabularypnpm check:doc-anchorspnpm check:doc-authoringpnpm check:doc-frontmatterpnpm check:docs-audit-scopepnpm check:docs-redirectspnpm check:docs-single-h1pnpm check:docs-spec-enumerationspnpm check:docs-transcript-driftpnpm check:driver-memory-censuspnpm check:dts-closurepnpm check:dual-build-cjs-loadspnpm check:engine-double-contractpnpm check:gitlink-declaredpnpm check:i18npnpm check:i18n-stale-fillpnpm check:issue-citationspnpm check:keyed-text-boundspnpm check:lean-entry-closurepnpm check:logger-receiver-detachpnpm check:merge-driverpnpm check:nul-bytespnpm check:objectql-double-limitpnpm check:org-identifierpnpm check:page-declaration-shapepnpm check:platform-object-tenancy-censuspnpm check:published-filespnpm check:published-readme-linkspnpm check:query-options-erasurepnpm check:react-page-adapter-contractpnpm check:refd-timer-probepnpm check:registry-log-declaredpnpm check:rest-log-spy-declaredpnpm check:role-wordpnpm check:skill-identifier-livenesspnpm check:slot-lookuppnpm check:sourcemap-no-sources-contentpnpm check:system-context-censuspnpm check:test-source-aliaspnpm check:tier-file-adoptionpnpm check:type-check-coveragepnpm check:type-check-debtpnpm check:undeclared-dep-importspnpm check:vendor-version-stampspnpm check:watch-hint-literalpnpm check:where-matcherGenerated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgVfjk2i8T2D4RmxsKg