Skip to content

[Bug]: Store: showOwner on an ungated projected readers mount gives every signed-in user every owner's principal id #972

Closed

Description

@jimhoyd

Security-sensitive (information disclosure), severity: medium. Found in an adversarial review of #943/#966.

Runtime revision and environment

origin/main ba9f3204, Node 26.10, macOS; store package tests via packages/store/test/direct.ts.

What happens

A projected readers mount may omit members (#929). Activation does not refuse showOwner: true on such a mount, so every principal its route admits receives _owner (the owner's principal id, e.g. the Better Auth user id) for every owner's record.

This contradicts packages/store/SECURITY.md ("Requester visibility"): "Only members of the declared membership collection receive it", and the showOwner schema description, which speaks of "a member".

Minimal reproduction

// modelled on packages/store/test/readers-grid.test.ts
const wallets = {
  mount: '/api/wallets', ownership: 'owner',
  schema: { type: 'object', additionalProperties: false, required: ['name'], properties: { name: { type: 'string', maxLength: 40 } } },
  readers: { directory: { mount: '/api/directory', properties: ['name'], showOwner: true } }, // no members
};
const store = await direct(t, { collections: { wallets } }, { mounts: ['/api/wallets', '/api/directory'] });
await store.call('POST', '/api/wallets', { who: 'user_bob_123', body: { name: 'bob' } });
const r = await store.call('GET', '/api/directory', { who: 'random_signed_in_user' });

Expected: activation refuses showOwner without members (or the documented guarantee is changed deliberately).
Observed (run):

200 [{"id":"b1a3…","_owner":"user_bob_123","name":"bob"}]

Root cause

packages/store/src/collection.ts readers normalization (around line 567) refuses members and properties both missing, but never checks showOwner === true && members === undefined.

Suggested fix

Refuse showOwner: true without members at activation, with a test; keep the SECURITY.md sentence true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions