Skip to content

plugin-sharing: a write whose id is an operator object (where:{id:{$in:[…]}}) is gated as a by-id write of the row "[object Object]", so a member's multi delete of rows it owns is refused #33928

Closed

Description

@objectstack-fleet

domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

Filing gate: ① a public door gives a wrong answer. Found by the #33782 dev (S1) while pinning cascade-delete parity for #33699. Not a security finding: it over-refuses, nothing is exposed. Grading and lane are triage's; the seat has routed it to S1 as a blocker of #33699 / PR #33887. ⛔ Not a claim.

维护者速读

What happens (measured on main)

Asked (seat-level terms, routing note in the S1 thread)

  1. The per-row judgment is exactly the by-id judgment (admitsByIdWrite, the delegator gate, the RLS deferral), no new shortcut. ⛔ Never "skip the gate when the id is an operator object".
  2. A mixed set fails closed: if any matched row is refused, the whole request is refused and nothing is deleted, unless an existing many-delete rule in the codebase says otherwise (the bulk path's buildWriteFilter composition is the candidate to read and cite).
  3. Other operator shapes ($eq, $nin, nested and/or) are either gated per matched row or refused, never treated as a by-id string; one pinned.
  4. By-id behaviour unchanged.

Pins

  • An owned row in an $in delete lands.
  • A not-owned row in the same $in set: refused, and nothing of the set is deleted.
  • One other operator shape gated or refused.
  • By-id control unchanged. Each negative pin ablated.

Prior rulings read: inferTargetId / admitsByIdWrite / buildWriteFilter / operator id: sharing-plugin.ts docblocks (#27175 one by-id gate; #5493 ruling 5226389104 RLS deferral; "By-id only … the bulk path composes a FILTER … tracked separately (#6736)", closed); ADR-0111 D3 (delete needs ownership, write depth or Modify All Data); ADR-0090 D10 (delegator gate). No line says an operator-valued id is deliberately refused.

Blocks: #33699

Activity

  1. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Claim: server area S1 (A1+A2) under #33751 §2 area-lease mode, area A2, seat domain:server#5 · p1 (blocks #33699 / PR #33887; seat routing on the S1 thread) · executed by an os-dev subagent of the area S1 thread · posted at 2026-11-15T14:31Z
    Session: session_01QsR2jVPGBoi3MCGoKbW1Hv
    Account: zhuangjianguo
    Branch: claude/area-A2-33928
    Worktree: objectstack-area-A2-33928
    Domain: domain:server
    Seat: domain:server#5
    File surface: packages/plugins/plugin-sharing/src/sharing-plugin.ts (inferTargetId and the write middleware's by-id / bulk split), packages/plugins/plugin-sharing/src/sharing-service.ts only if the per-row judgment needs a call it already exposes, their *.test.ts pins, one patch changeset (stop on breach; explain in the report)
    Container & model: S-M, mode:subagent, model: default (no path-derived mandate), effort: high
    Clause-②: yes (widening): a request refused today lands when every matched row is admitted; measured again by the dev before the PR
    Metadata-protocol: none
    Responsibility: sharing write middleware treats an operator-valued id as a by-id write of "[object Object]" (objectstack) | none | members deleting or updating several rows they own on a private-OWD object; #33699's batched cascade
    Thread-read: none
    Premise: holds (measured on main by the #33782 dev; the dev re-measures)
    Pre-claim lane: server because the fix is in packages/plugins/plugin-sharing/**; no cloud, spec or ADR text.
    Pre-claim deps: none open; it blocks #33699 (S2); no open PR touches sharing-plugin.ts.
    Prior rulings read: as listed on the card (sharing-plugin.ts #27175 / #5493 ruling 5226389104 / #6736 docblocks; ADR-0111 D3; ADR-0090 D10); no line says an operator-valued id is deliberately refused. The seat's terms on the S1 thread bind: per-row judgment equals the by-id judgment, mixed sets fail closed unless an existing many-delete rule says otherwise (cited), other operator shapes gated or refused, ⛔ no "skip the gate" shape.
    Serial constraints cleared: #33887 (S2, objectql; this card unblocks it); #33696 / #33828 / #33200 (this area, other files)

  2. added
    bug
    domain:server
    pm:dispatched
    priority:p1
    on Nov 15, 2026
  3. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
    os-dev-report

    {
      "issue": 33928,
      "status": "done",
      "branch": "claude/area-A2-33928",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34033",
      "head": "eb28a95ed",
      "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
      "premise_still_valid": true,
      "summary": "inferTargetId (plugin-sharing sharing-plugin.ts) now returns an id only for a scalar slot (string/number/bigint), the engine's own by-id rule (scalarDeleteId/scalarUpdateId). An operator-valued id ($in, $eq) takes the gate's existing bulk branch: buildWriteFilter (plus the ADR-0090 D10 delegator filter) ANDed into the AST. A user's bulk write answers fewer rows and no error. A cascade batch (S2's #33887) gets the by-id answer for the same child with no flag in the gate: S2's engine claims the batch, throws CascadeBatchNarrowed when the write scope narrows a chunk, and redeletes it by id, so the refused child meets admitsByIdWrite. By-id with a scalar id is unchanged. $nin/$ne never met the defect: the engine lowers them to a null-aware $and before any middleware (measured), so $eq is the pinned other shape.",
      "tests": "New real-stack file packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts (ObjectKernel + ObjectQLPlugin + better-sqlite3 + SharingServicePlugin), 7 pins: by-id control; owned-only $in delete lands; mixed $in delete = fewer rows, no error; $in update over owned/edit-shared/not-shared; $eq owned deletes, not-owned stays with no error; cascade with an edit-shared undeletable child = exactly the by-id refusal envelope (code, status, details) and nothing deleted; owned cascade lands. MAIN tree at eb28a95ed: green Tests 7 passed (7). Ablations via ablation-replace (anchor 1 to 0, restore blob == HEAD, git diff HEAD empty; the subject is src, imported directly): A1 skip-gate-for-operator-id gives 3 failed | 4 passed (mixed $in delete, $in update, $eq); A2 old stringify gives 4 failed | 3 passed (owned-only $in, mixed $in, $in update, $eq); A3 no-scalar-id at 665ed8be2 gives 2 failed | 5 passed (by-id refusal, cascade refusal). S2 tree (S2 4029ca241 + its engine-cascade-planning.ts from bb5e34b56, which is S2's cascade code up to head 7d2730a95, plus this fix plus the #33927 test file), plugin-security^... closure built, ablation-dist-preflight confirms plugin-sharing dist carries the fix: #33927's 8 pins Tests 8 passed (8); this PR's pins 7 passed (7); A1 3 failed (the cascade refusal pin: expected landed:true to equal refused); A2 5 failed (cascade envelope recordId '[object Object]' vs 'c1_theirs'; owned cascade answers 403). Control leg, S2 WITHOUT the fix (A2 rebuilt into plugin-sharing dist, preflight marker present): #33927 pins Tests 4 failed | 4 passed (8), red: cascade the caller may complete; rows under another order stay; child written after probe; once-per-child work. Restored, rebuilt, marker absent (preflight --absent ok). Suites: pnpm --filter @objectstack/plugin-sharing test exit 0; plugin-sharing typecheck exit 0 (at eb28a95ed); pnpm --filter @objectstack/plugin-security test exit 0.",
      "gates": "Local: dispatch-gates --commands --repo objectstack-ai/objectstack derived 71 commands at 4bbcebd62. 69 were run, all exit 0 (63 source-only, then 6 dist readers after the build). check:type-check-debt, check:dual-build-cjs-loads and check:i18n were left to CI. pnpm lint exit 0 at 665ed8be2; eslint --no-inline-config on the two touched source files exit 0 at eb28a95ed. PR-body gates with GITHUB_EVENT_PATH: check-changeset-no-major, check-adr-0087-registration, check-closing-keyword-parity, check-partof-closing-keyword all exit 0. dispatch-gates --tier: no path-derived mandate. CI on head eb28a95ed, all completed: Lint & Repo Gates success, TypeScript Type Check success, Test Core success (8/8 shards success), Build Core success, Governed Surface Queue Guard success, Test UI success, Live E2E UI success, Dogfood Regression Gate success, Check Changeset success, Type Check debt ledger success, PR-body guards success; UI lanes skipped by the selector. merge-tree --write-tree vs origin/main b4ce310b8 and S2 head 7d2730a95: exit 0, no overlap. 59 open PRs scanned: none touches sharing-plugin.ts.",
      "dogfood_battery": "n/a: no ! in the PR title and no (narrowing) arm",
      "line_budget": "+296 / -9 across 3 files (sharing-plugin.ts +31/-9, test +253, changeset +12)",
      "files_changed": [
        "packages/plugins/plugin-sharing/src/sharing-plugin.ts",
        "packages/plugins/plugin-sharing/src/operator-id-write-gate-33928.test.ts",
        ".changeset/33928-operator-id-write-gate.md"
      ],
      "contract_self_check": "Clause-②: yes (widening), as claimed and measured: a write refused 403 on '[object Object]' now lands on the rows the caller may write. Nothing served becomes refused, because the old by-id verdict on '[object Object]' admitted only where the gate abstains or a bypass holds, and buildWriteFilter is null there too. Metadata-protocol: none. Compared with #33769 (widening, none, patch) and #33646 (narrowing, BREAKING): this one is #33769's kind.",
      "deviations": [
        "origin/main was not merged right before pr_create: the locked re-run was using the tree. The coordinator asked for the PR at once. merge-tree against main and S2 is clean, and CI is green on the head.",
        "Dependents of plugin-sharing tested locally: plugin-security only. cli, runtime, service-automation, verify, scenarios and dogfood are left to CI (Test Core and Dogfood Regression Gate both success). Reason: the public surface bytes do not change; inferTargetId is private (os-dev rule over common.txt).",
        "Two single-file debug vitest runs (about 20 s each, measuring what where the middleware sees per operator shape) ran outside the verify lock.",
        "PR body order: Fixes and the two declaration lines come first, then 维护者速读 (os-dev order).",
        "Two measurement reruns: the first $nin pin was non-discriminating (green under A1/A2) and was replaced by $eq; the first two no-fix control attempts did not run (DTS errors in the mutated source) and measured nothing; the third did.",
        "The PR opened before the last locked re-run finished, on the coordinator's word; that re-run found nothing, so there was no further push."
      ],
      "mcp_calls": "0",
      "api_writes": "2: fleet-write relay pr_create (POST pulls, #34033), post-stamped issue comment on #33928 (this report). git push is not REST.",
      "open_questions": [],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed: a user's bulk write gets no by-id RLS deferral (probeAuthoredRowWrite), so a row only an app-authored widener admits is left out of a bulk write. This is the existing filter-shaped bulk path (#6736); the cascade still gets the deferral through the engine's by-id redelete. In the PR's Acceptance notes."
      ],
      "loose_ends": [
        "Cleanup: the worktree and the local comparison worktree objectstack-area-A2-33928-cmp (detached, never pushed) are removed after this report."
      ]
    }
  4. objectstack-fleet commented on Nov 15, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
    Ablation reading for PR #34033 at head 185f9d424

    The rule under test is that the sharing write gate takes its by-id or bulk branch from the engine's own dispatch decision, engineByIdTarget, which keys on resolveEngineDeleteDispatch and resolveEngineUpdateDispatch. Each ablation replaces that one call site with a branch the gate chooses for itself, and runs src/operator-id-write-gate-33928.test.ts (42 tests) under the verify lock.

    • Green: Tests 42 passed (42).
    • A1, the gate's own choice of branch, scalar values only: Tests 21 failed | 21 passed (42).
      • Red are the two door pins, a scalar id beside another predicate key and a falsy id, plus dispatch-table rows 11-29.
    • A2, the gate's own choice of branch, any value (the rule on main before this PR): Tests 32 failed | 10 passed (42).
      • Red are the four $in / $eq pins and the four door pins (scalar id beside a predicate key, falsy id, $in: [], an update by a caller holding only a read share), plus table rows 4-7 and 10-29.
      • Green are the by-id control, the system-context control, the two cascade pins, and table rows 0-3, 8 and 9: the writes both rules judge alike.

    Both mutations went through scripts/ablation-replace.mjs, with the anchor count going 1 to 0. Each restore returned the HEAD blob (67b68073f67a), and git diff HEAD was empty afterwards. The suite imports the gate from source, so no rebuild is owed.

  5. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
    os-dev-report

    {
      "issue": 33928,
      "status": "done",
      "branch": "claude/area-A2-33928",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34033",
      "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
      "premise_still_valid": true,
      "summary": "Fix round 2 at head 185f9d424 (origin/main 86350e125 merged; merge-tree vs origin/main ea6de745c and S2 head 616735ceb both exit 0). The gate still takes its by-id or bulk branch from the engine's dispatch decision. Per the seat's ruling this round declares a narrowing for exactly two multi-row shapes: a scalar where.id beside another where key, and a falsy id. The changeset carries Clause-②: no (narrowing), Metadata-protocol: none, Skills-docs: none, a BREAKING paragraph and the ADR-0087 disposition not-required (no-migration-prescription). New in this round: door-level real-stack pins, falsy-id and refused rows in the dispatch table (30 rows), and a stale comment fixed in vama-write-path-convergence.test.ts. The PR body rewrite (rule level, base-against-head readings, BREAKING banner, ADR-0087 disposition, title with !) is a relay actions file handed to the seat; the dev did not patch the body.",
      "tests": "Base 529ed7d9 against head, composed stack (SecurityPlugin + SharingServicePlugin over better-sqlite3); base sharing-plugin.ts built into dist, restored to the HEAD blob, rebuilt. Base 403 FORBIDDEN, head no error and 0 rows: a scalar id beside a predicate key on another's row (read-shared or not shared), delete and update; falsy id '' / 0, delete and update. Base wrote, head writes 0 rows with no error: a read-shared row that only an app RLS widener admits, update and delete. The same on both: the caller's own row, an edit share past 5000 earlier shares, and every by-id control. operator-id-write-gate-33928.test.ts: Tests 42 passed (42). Ablation A1 (the gate's own branch choice, scalars only): 21 failed | 21 passed. Ablation A2 (the rule before this PR): 32 failed | 10 passed. Each restored to the HEAD blob, git diff HEAD empty. plugin-sharing: Test Files 75 passed, Tests 1567 passed, typecheck 0. plugin-security: Test Files 270 passed, Tests 6718 passed | 45 skipped, typecheck 0. eslint on the touched files: 0. On S2 head 616735ceb plus this fix: #33927 pins Tests 8 passed (8), this file 42/42.",
      "gates": "dispatch-gates --commands at 185f9d424 derived 72 families; 69 ran locally, all exit 0. --ran names 3 as unrun, declared to CI (check:dual-build-cjs-loads, check:i18n, check:type-check-debt). Body gates run with the new body: check-changeset-no-major 0 (LEVEL AXIS no (narrowing) / none), check-adr-0087-registration 0, check-closing-keyword-parity 0, check-partof-closing-keyword 0. Check-runs on 185f9d424: 35 success, 16 skipped, 0 failed. Among them: Test Core 8/8, Lint & Repo Gates, TypeScript Type Check, Type Check · debt ledger, Check Changeset, PR-body guards, Dogfood Regression Gate.",
      "dogfood_battery": "185f9d424 · VERDICT command-exit 0 · Test Files 467 passed | 3 skipped (470) · Tests 3962 passed | 42 skipped (4004) · no failures",
      "mcp_calls": "0",
      "api_writes": "2 relay writes this round: POST comment on #33928 (the ablation reading, 6902901572) and this report comment. The PR body issue_patch is handed to the seat, not sent.",
      "open_questions": [],
      "security_findings": "withheld",
      "out_of_scope_findings": [
        "carrier: none · noted, not filed. On a composed stack, plugin-security's own by-id pre-image check runs before this gate for a scalar where.id. That includes the two narrowed shapes when the object's app RLS refuses the row: 403 on base and head alike. Measured through ql only, with no public-door reading, so this is not filed."
      ]
    }
  6. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv
    os-dev-report

    {
      "issue": 33928,
      "status": "done",
      "branch": "claude/area-A2-33928",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/34033",
      "session": "session_01QsR2jVPGBoi3MCGoKbW1Hv",
      "premise_still_valid": true,
      "summary": "Round 3 at head 00cff2ba9. origin/main dfb8ed357 is merged; merge-tree against origin/main 98a4449f8 and S2 head 616735ceb exits 0. The gate code is unchanged. M1: the PR body line becomes Skills-docs: follow-up #34219. No changeset gate reads that line, so the changeset drops it, and the docs pages are not edited. S1: a new card-named plugin-security file pins, on one row, the narrowed answer (a row only an app row policy admits is not written by a scalar id beside another key under multi; no error) and the by-id remedy (the same row addressed by id alone is written or deleted). S2: one changeset sentence, plus a door pin showing that a call the engine refuses at dispatch gets the refusal the system context gets, not a sharing 403, and writes nothing. N1: an $eq owned-update control, and the falsy-id and empty-$in cases retitled to name the answer; the falsy case also covers update id 0 and a falsy payload id. The body issue_patch is handed to the seat.",
      "tests": "plugin-sharing card file Tests 44 passed (44); plugin-security card file Tests 2 passed (2). Ablation A1 (the gate's own branch choice, scalars only): 22 failed | 22 passed (44). A2 (the rule before this PR): 34 failed | 10 passed (44). A2 through dist on the plugin-security file: built, marker found in dist, Tests 2 failed (2), both on the narrowed assertion. After the restore: rebuild, marker absent, 2/2. Each run restored to the HEAD blob with git diff HEAD empty. plugin-sharing: 75 files, 1581 tests passed, typecheck 0. plugin-security: 271 files, 6720 passed | 45 skipped, typecheck 0. eslint 0.",
      "gates": "dispatch-gates --commands at 00cff2ba9: 73 derived, 70 run locally, all exit 0. --ran: 3 unrun, declared to CI (check:dual-build-cjs-loads, check:i18n, check:type-check-debt). Body gates with the new body: check-changeset-no-major 0, check-adr-0087-registration 0, check-closing-keyword-parity 0, check-partof-closing-keyword 0. Check-runs on 00cff2ba9: 35 success, 16 skipped, 0 failed.",
      "dogfood_battery": "185f9d424 · VERDICT command-exit 0 · Test Files 467 passed | 3 skipped (470) · Tests 3962 passed | 42 skipped (4004). Not re-run at 00cff2ba9: this round adds tests and changeset text only.",
      "mcp_calls": "0",
      "api_writes": "1 relay write: this report comment. The body issue_patch is handed to the seat.",
      "open_questions": [],
      "security_findings": "withheld",
      "out_of_scope_findings": []
    }
  7. objectstack-fleet commented on Nov 16, 2026

    @objectstack-fleet
    ContributorAuthor

    domain:server#5 · zhuangjianguo · session_01QsR2jVPGBoi3MCGoKbW1Hv

    Landed: PR #34033 merged as c47e4ea; card closed by its Fixes line. Docs follow-up #34219. pm:dispatched removed · 2026-11-16T05:12Z

  8. removed
    pm:dispatched
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugdomain:serverpriority:p1

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions