Skip to content

[Bug]: Store transfers: a negative min without members is accepted, so every signed-in user can mint #974

Closed

Description

@jimhoyd

Severity: low (configuration footgun; the sum is still conserved). Found in an adversarial review of transfers (#926/#943).

Runtime revision and environment

origin/main ba9f3204, Node 26.10, macOS.

What happens

The docs describe a negative min only as an issuer on a members-gated transfer ("A negative min on a members-gated transfer is an issuer", README and schema description). Activation accepts a negative min with no members, so on an owned collection any signed-in principal can debit their own empty record below zero and credit anyone, i.e. mint credit (more with more records).

Minimal reproduction

transfers:
  pay: { amount: balance, min: -500 }   # no members
  • normalize('wallets', spec) → accepted (no error).
  • eve (no membership): POST /api/wallets/transfers/pay {from: <eve's new wallet>, to: <other>, amount: 500} → 200, eve's balance -500, recipient 500.

Root cause

packages/store/src/collection.ts transfersOf (≈line 604) checks min is a safe integer but not min < 0 && members === undefined.

Suggested fix

Refuse a negative min without members at activation (with a test), or document explicitly that it lets every caller mint.

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