Repository navigation
feat(service-storage): the uploader removes an attachment they uploaded, through an own-row door - #33322
Conversation
…ed through an own-row door A member holding only the storage service's member grant (read and create on sys_attachment) could attach a file to a record and never take it back. The removal door DELETE /api/v1/attachments/:id is core's own-row delete door for sys_attachment, owner column uploaded_by: it reads the row as the caller, admits it only when the caller uploaded it, and removes it under a system context attributed to the caller. The member grant gains no delete bit. Claude-Session: https://claude.ai/code/session_016WV4d1D3AzXvEhBbz79Pmi Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 6 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 4 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 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 7d4b9ee302e4036cad269021a6677e7e325835e5 && git checkout 7d4b9ee302e4036cad269021a6677e7e325835e5
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6538ba48fc4590402cd6280cf83a8902f6de83d3 e5aa3112bdbf29d0cef2c5d8c28b8d6ad6758bd7 && git checkout -B drift-repro 6538ba48fc4590402cd6280cf83a8902f6de83d3 && git merge --no-ff e5aa3112bdbf29d0cef2c5d8c28b8d6ad6758bd7
node scripts/docs-audit/affected-docs.mjs --json 6538ba48fc4590402cd6280cf83a8902f6de83d3
|
…s and changeset The member withdraws their own attachment through DELETE /api/v1/attachments/:id; another member who edits the record is refused on the door and on the data door; the data door still refuses the uploader and still serves an administrator; explain still reports read and create allowed and delete refused. The route ledger joins the live-mount parity pin, declared as a dogfood test input. Claude-Session: https://claude.ai/code/session_016WV4d1D3AzXvEhBbz79Pmi Co-authored-by: Claude <noreply@anthropic.com>
…lope audit The module supplies its part of the shared own-row delete door and builds no body itself, declared as the personal-view and unreact doors are. Claude-Session: https://claude.ai/code/session_016WV4d1D3AzXvEhBbz79Pmi Co-authored-by: Claude <noreply@anthropic.com>
|
Contract-review-claim: session_016WV4cxDxAYxdtDhtR1kQQe · head e5aa311 · 2026-11-14T19:00Z review#2 (server area pilot, A3). |
Contract reviewServed-tier: review#2 (server area pilot) · area A3 · Fixes #33010 · declaration face ( ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:server#5 · os-elon-musk · session_016WV4d1D3AzXvEhBbz79Pmi ACCEPT · area A3
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43633136778 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43637152754 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…needs (objectstack-ai#33433) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DU5CHkeh2msc49m4dh6kwEt)_ ## Summary Test-only. `packages/rest/src/meta-qualified-item-route.test.ts` › "CONTROL — a type ADR-0150 does not address by package (view) is served as before" timed out (`Test timed out in 5000ms`) in two merge-queue builds for objectstack-ai#33322 (runs 43633136778: 5089ms, 43637152754: 5281ms). It passed in a third queue build on the same code (43633195065: 2816ms). ## Why It is the file's only served `view` read. `metadata-diagnostics.ts` attaches `@objectstack/lint` warnings to view reads and loads the lint bundle lazily, so the first view read in a vitest worker pays the cold load: measured on `main` b462444, 716–853ms for the first drive and 1–2ms for an identical second drive; loading the bundle alone took 1027ms. On a loaded runner that load passes 5s. Nothing hangs. It only shows when the queue runs `rest` uncached (e.g. a PR that changes `turbo.json`). ## What changes - The one test gets a 30s budget, with a comment naming the cold load it pays for. Assertions unchanged. Local: origin/main 4 runs and main + objectstack-ai#33322 2 runs, 302/302 each. No changeset (test-only). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4d1D3AzXvEhBbz79Pmi Co-authored-by: Claude <noreply@anthropic.com>
…ectstack-ai#33010 ruling) (objectstack-ai#33407) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DU5CHkeh2msc49m4dh6kwEt)_ ## Summary Docs-only companion to objectstack-ai#33322 (merged). The maintainer's ruling on objectstack-ai#33010 (comment 6879388034) says a member may delete an attachment they uploaded themselves, own uploads only, and that the ADR-0090 D5 text saying the member grant has no delete bit gets a matching sentence. This records that sentence as a dated note in D5, after the `Note (2026-10-14)` blockquote, citing the ruling by its record id: removing a row one owns is served by an own-row delete door, not by `allowDelete` on a set bound to `everyone`; the attachment member grant stays read and create only. ## What changes - `docs/adr/0090-permission-model-v2-concept-convergence.md`: one new dated note blockquote in D5, `Note (2026-11-14, ruling of record 6879388034 on objectstack-ai#33010)`, after the `Note (2026-10-14)` blockquote. No ruled text is edited. - Review 2, item 1, option (a): the first head placed the sentence as a D5 bullet directly above the `Revision (2026-09-12, objectstack-ai#17189)` blockquote, whose ruled text opens with "the bullet above" and means the D7 lint bullet. As a dated note after the last D5 blockquote it no longer sits between that revision and its antecedent. ## Landing Governed surface (`docs/adr/**`, Tier H): lands only on its tier's record. objectstack-ai#33322 merged 2026-11-14T21:19Z, so the door the note names is on `main`. No code, no changeset. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_016WV4d1D3AzXvEhBbz79Pmi <!-- signed: domain:server#5 · os-elon-musk · session_016WV4d1QwJJ5KGZTThP4fnq --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Elon · project thread
Fixes #33010
Area-lease pilot #33059, area A3.
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
DELETE /api/v1/attachments/:id,成员可删除自己上传的附件;成员授权(storage_attachment_member)仍只有读与建,不加删除位,数据门DELETE /data/sys_attachment/:id对成员仍是 403。uploaded_by等于调用者的行,以调用者身份读、以系统上下文删;回滚即 revert 本 PR,数据门行为未改。attachment-removal-routes.ts(门的定义,所有者列uploaded_by)、storage-service-plugin.ts的mountAttachmentRemovalDoor(挂载与调用方解析)、member-attachment-baseline.dogfood.test.ts(真栈钉子)。pnpm --filter @objectstack/service-storage exec vitest run src/attachment-removal-routes.integration.test.ts,预期全绿:本人删除 200 且行消失,他人 403PERMISSION_DENIED行仍在。What changes
Ruling (comment 6879388034 on the card): a member may delete an attachment they uploaded themselves, own uploads only, and the member grant carries no wider delete bit.
DELETE /api/v1/attachments/:idis@objectstack/core's own-row delete door (own-row-delete-routes.ts, the one the unreact and personal-view doors use) forsys_attachment, owner columnuploaded_by. It resolves the caller through the platform's one request-to-context composition, reads the row AS the caller (object grant, organization wall, attachment read visibility), refuses a row whoseuploaded_bynames anyone else (403 PERMISSION_DENIED, the row stays), answers a row the caller cannot read as an unknown id (404 RECORD_NOT_FOUND), and only then removes it under a system context attributed to the caller, so the lifecycle tombstones the file it pointed at.uploaded_byis stamped from the session by the attach rule and is read-only after insert, so a caller cannot make another user's row their own.StorageServicePluginatkernel:ready, beside the storage family and outside it (fixed route, its own ledgerattachment-removal-route-ledger.ts, onegaprow: the SDK has no method yet; the storage ledger's zero-gap ratchet is untouched).sys_attachment, nothing else. The data door's delete still needs an explicit grant; an administrator keeps deleting any attachment there. A member who can edit the record but did not upload the attachment is refused by the door.attachment-member-grant.tsand the write rule (attachment-access-hooks.ts) say where the uploader's removal is served.Tests
Recorded at open as NOT MEASURED: local runs follow on this branch and are reported in the dev report (storage package suite, the new integration file, the ledger conformance, the dogfood attachment file, typecheck, eslint, the ADR-0087 registration check, one ablation of the mount).
Acceptance notes
mountStorageRoutes(cloud's per-environment kernels) does not carry this route: it calls the registration halfget/post/putonly. Carrying it there is a separate change.everyone-bound sets gets its matching line in a separate docs PR (governed surface), filed by the area thread.Verification
See Tests.
🤖 Generated with Claude Code
https://claude.ai/code/session_016WV4d1D3AzXvEhBbz79Pmi