Skip to content

fix(plugin-sharing, runtime): a password-protected signed_in share link answers an anonymous visitor SIGN_IN_REQUIRED, whatever password was sent - #23369

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-23328-share-link-refusal-order
Oct 14, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-23328-share-link-refusal-order

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #23328
Clause-②: no — every input refused today is still refused; only which refusal code an anonymous caller reads changes. Nothing is admitted that is refused today. ⛔ If the change would admit anything refused today, or make the answer differ by whether the password was correct before sign-in (an anonymous password oracle), the dev stops and reports needs_decision.

What changes

When resolveToken refuses, the share-link resolve door probes the link row to name the refusal. For a live link with both a password and audience signed_in, that probe answered the password arm first. But resolveToken had refused the anonymous caller on the audience before verifying any password, so the probe knew only whether a password was sent. The visitor with the correct password read WRONG_PASSWORD, and the console's shared-record page said "Wrong password." and never offered sign-in.

Both mounts now judge the audience first. Before sign-in the probe asks the audience and never the password:

Caller No password Wrong password Correct password
anonymous, signed_in + password link 401 SIGN_IN_REQUIRED 401 SIGN_IN_REQUIRED 401 SIGN_IN_REQUIRED
signed in, same link 401 NEEDS_PASSWORD 401 WRONG_PASSWORD 200
  • Mounts. registerShareLinkRoutes (plugin-sharing/src/share-link-routes.ts) and the dispatcher twin handleShareLinksRequest (runtime/src/domains/share-links.ts).
  • Unchanged. Every other arm keeps its order. The switched-off/unknown 404 INVALID_OR_EXPIRED and the 410 EXPIRED_OR_REVOKED are decided outside the live-link block this edit touches. A non-signed_in link with a password still answers the password arms to an anonymous caller. resolveToken is untouched: the cause was in the two probes, not in the service.
  • Fewer reads. For an anonymous caller of a signed_in link, the probe now refuses before it reads the internal password_hash at all.
  • Oracle-free by construction. An anonymous caller's answer cannot depend on the password, because the arm that answers it reads none.
  • Console. objectui's landing page already maps SIGN_IN_REQUIRED to its sign-in state (apps/console/src/pages/shared-record-shape.ts, RESOLVE_GATE_BY_CODE). That code is unchanged at objectui origin/main 2b06a91 and at the pin 1fb1ced362. After sign-in, the page receives NEEDS_PASSWORD and shows its password prompt. No objectui edit.

One rule, two mounts: why the twin keeps its own copy

The seat's direction was to put the order in one helper in plugin-sharing that the twin consumes, if the twin can import plugin-sharing today. It cannot: @objectstack/plugin-sharing is a devDependency of @objectstack/runtime (packages/runtime/package.json), and no non-test file under packages/runtime/src imports it. Consuming a helper from it would add a production dependency edge, so no dependency was added. Following the direction's fallback, the two copies are kept in step, each comment names the other, and one shared table test pins both mounts.

The pin

packages/runtime/src/domains/share-links-refusal-order.test.ts: one table, describe.each over both mounts' production entries. It runs over one ObjectQL on @objectstack/driver-sql + better-sqlite3 with the shipped sys_share_link (internal password_hash), and one ShareLinkService with the production password hasher. The password is sent the way the console sends it. Refusals assert the ADR-0112 envelope (status + error.code, success: false).

  • signed_in + password, anonymous: no, wrong and correct password all 401 SIGN_IN_REQUIRED.
  • signed_in + password, signed in: NEEDS_PASSWORD, WRONG_PASSWORD, 200 with the record.
  • The oracle property, as its own case: the anonymous answers for no, a wrong and the correct password are deep-equal (status, body, headers).
  • Controls: a public link with a password answers anonymous NEEDS_PASSWORD / WRONG_PASSWORD / 200; an unprotected public link serves; a revoked link answers 410 EXPIRED_OR_REVOKED to anonymous and signed-in callers alike.

Measured before the fix (test committed first, run on the unmodified tree at ea17bb7a36, both mounts): anonymous with no password answered 401 NEEDS_PASSWORD; with a wrong one and with the correct one 401 WRONG_PASSWORD. The signed-in rows and all controls already passed (8 failed / 18 passed). Today's order therefore had no correct-vs-wrong oracle, only the wrong code. The card's hypotheses H1 (on a real SqlDriver) and H2 (the twin, now run rather than read) both hold.

Negative-pin ablation (two mutations, both mounts, then restored)

Both legs ran on the committed fix (HEAD a6992eee30), through scripts/ablation-replace.mjs (anchor hit exactly once per file, blob changed), with a trap restore on absolute paths. Each leg rebuilt plugin-sharing and proved the marker reached dist/ with scripts/ablation-dist-preflight.mjs before reading the result. The runtime test reads that package through dist/.

Leg 1: today's password-first order restored on both mounts (marker ablation23328PasswordFirst, present in 2 built files):

     × 'signed_in + password', 'anonymous', 'no password' → 401 'SIGN_IN_REQUIRED'
     × 'signed_in + password', 'anonymous', 'a wrong password' → 401 'SIGN_IN_REQUIRED'
     × 'signed_in + password', 'anonymous', 'the correct password' → 401 'SIGN_IN_REQUIRED'
     × no anonymous password oracle: no, a wrong and the correct password read one identical answer
  (the same four on the dispatcher twin)
AssertionError: plugin route: {"success":false,"error":{"code":"WRONG_PASSWORD","message":"Incorrect password"}}: expected 'WRONG_PASSWORD' to be 'SIGN_IN_REQUIRED'
AssertionError: the correct password against none: expected { status: 401, … } to deeply equal { status: 401, … }
      Tests  8 failed | 18 passed (26)

The direction observed here is not the template's. Under today's order the oracle case goes red on its "against none" leg, because a wrong and the correct password both read WRONG_PASSWORD. Its "correct against wrong" leg was not exercised. So:

Leg 2: an oracle-creating anonymous arm on both mounts (marker ablation23328Oracle, present in 2 built files). The anonymous signed_in arm verifies the presented password through resolveToken and answers WRONG_PASSWORD when it fails, SIGN_IN_REQUIRED when it succeeds. That is the plausible "helpful" fix the card warns against:

     × 'signed_in + password', 'anonymous', 'a wrong password' → 401 'SIGN_IN_REQUIRED'
     × no anonymous password oracle: no, a wrong and the correct password read one identical answer
  (the same two on the dispatcher twin)
AssertionError: the correct password against a wrong one: expected { status: 401, … } to deeply equal { status: 401, … }
      Tests  4 failed | 22 passed (26)

Restore, both legs: ablation-replace --restore per file: blob == HEAD blob (60b20243e310 routes, 04e3629ed6fb twin) and git diff HEAD empty. The plugin-sharing rebuild then passed preflight --absent (marker absent from all 6 built files; whole tree clean against HEAD), and the table read 26 passed (26) again. No ablation file is left in the tree.

Verification

Everything below ran on HEAD a6992eee30, the final commit. origin/main is 18cd410dc4, unchanged since the branch point.

  • plugin-sharing. pnpm --filter @objectstack/plugin-sharing test: 44 files, 1055 passed. run typecheck (tsc, the scripts project and the test layer): exit 0.
  • runtime tests. pnpm --filter @objectstack/runtime exec vitest run --project local --maxWorkers=2: 372 files, 5402 passed, 19 skipped. --project repo: 3 files, 808 passed.
  • runtime typecheck. run typecheck: exit 0. The new test is in the test-layer program: tsc -p tsconfig.test.json --listFiles has 1 hit and 0 errors in that file; the 190 ledgered errors are unchanged.
  • The pin. share-links-refusal-order.test.ts: 26 passed (26).
  • Gates. node scripts/pm/dispatch-gates.mjs --commands (no paths; change set from the merge base) derived 68 commands, and all 68 ran with exit 0.
    • check:i18n and check:dual-build-cjs-loads first answered exit 3 PREREQUISITE NOT MET, which measures nothing. Rerun with their named build prerequisites, both exit 0.
    • --ran reconciliation: 68 derived, 68 run, 0 NOT-MEASURED, derived from 68 recorded exit codes.
  • Lint, narrowed and proven. eslint's own --print-config resolves all three changed code files to a config, so none is ignored. eslint --no-inline-config --format json over them: 3 files, 0 errors, 0 warnings. Invariance: no parserOptions.project is set and the 5 active rules are per-file AST rules, so this diff cannot change the verdict on any untouched file. The whole-repo pnpm lint is CI's.
  • Not measured locally (CI's). The path-scheduled CI jobs and the type-check lanes that the derivation lists outside its commands.

Acceptance notes

  • Out-of-scope finding (same class, not fixed here, decision needed): the email audience. A live link with a password and audience email answers an anonymous caller who presents the correct password with no email, or an email off the allowlist, 401 WRONG_PASSWORD on both mounts (measured in-process, both mounts, on the same real-SqlDriver harness). It is the same password-before-audience shape. It is not a mechanical fix: there is no email-audience refusal code, and answering the allowlist arm before the password arm would hand an anonymous token holder an allowlist-membership oracle. The console's share dialog offers no email audience today. Handed to the seat to file.
  • Out-of-scope finding (mount divergence): the plugin mount's conversation-messages door ignores the caller. It calls resolveToken without the caller's identity (its serve ignores the context the family door resolved), while the dispatcher twin passes it. A signed-in caller of a signed_in conversation link reads 404 NOT_FOUND from the plugin mount and 200 from the twin (measured, both mounts). The console offers the signed_in audience and fetches the conversation's messages. Handed to the seat to file.
  • Single source, later. If the seat wants the order to live in one place without a new dependency edge, @objectstack/types already hosts the password-header reading both mounts share for exactly this reason (readSharePasswordHeader). That would be a follow-up outside this card's file surface.
  • Cross-lane. packages/runtime is declared to domain:cli (comment 6158867992 on [PM seat] domain:cli · seat 2 — ⏳ vacant #22648) and plugin-sharing to [epic] ADR-0131 — total organization ownership: no NULL organization_id (v18 line) #15194 (comment 6158874477).

Generated by Claude Code

…ounts

Pins, on the plugin route and the dispatcher twin alike: an anonymous
caller of a password-protected signed_in link reads one identical answer
for no, a wrong and the correct password; a signed-in caller keeps the
password arms; public and revoked controls are unchanged.

Committed ahead of the fix so the measurement of today's order runs
against this exact file.

Claude-Session: https://claude.ai/code/session_01FzQy26KznSa5j2gnf3AzsE
Co-authored-by: Claude <noreply@anthropic.com>
… before its password

An anonymous caller of a password-protected signed_in link is refused by
resolveToken on the audience before any password is verified, so the
resolve refusal probe's password arm could only report whether a
password was sent: it answered WRONG_PASSWORD for the correct password.
Both mounts now answer such a caller SIGN_IN_REQUIRED whatever it sent;
a signed-in caller keeps NEEDS_PASSWORD / WRONG_PASSWORD; every other
arm keeps its order.

The dispatcher twin keeps its own copy of the order: plugin-sharing is
a dev dependency of runtime, so it cannot import a shared helper. The
refusal-order table pins both copies.

Claude-Session: https://claude.ai/code/session_01FzQy26KznSa5j2gnf3AzsE
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

4 anchor(s) derived from 2 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 54 of 206 client-bound route-ledger rows — the other 152 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 152: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 97 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 31 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json dc393266fda0bd7b7d22753d572584ee0d7cbf59 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from d3c5cf52a1683682c4efdeaf688a97fce5fd3e37 — the merge of head a6992eee303eb339bd10da1ade90dbb0fea07d32 into base dc393266fda0bd7b7d22753d572584ee0d7cbf59, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin d3c5cf52a1683682c4efdeaf688a97fce5fd3e37 && git checkout d3c5cf52a1683682c4efdeaf688a97fce5fd3e37
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin dc393266fda0bd7b7d22753d572584ee0d7cbf59 a6992eee303eb339bd10da1ade90dbb0fea07d32 && git checkout -B drift-repro dc393266fda0bd7b7d22753d572584ee0d7cbf59 && git merge --no-ff a6992eee303eb339bd10da1ade90dbb0fea07d32

node scripts/docs-audit/affected-docs.mjs --json dc393266fda0bd7b7d22753d572584ee0d7cbf59

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 14, 2026 02:55
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 14, 2026 02:55
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit 28e294f Oct 14, 2026
41 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-23328-share-link-refusal-order branch October 14, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

2 participants