Skip to content

[Bug]: Store transfers: transfer_limit and record_too_large on the credited record disclose another owner's hidden balance #973

Closed

Description

@jimhoyd

Security-sensitive (information disclosure), severity: low–medium. Found in an adversarial review of transfers (#926/#935/#943).

Runtime revision and environment

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

What happens

On an owned collection, transferIn validates the credited record (another owner's, whose balance is hidden from the payer, e.g. behind a projected directory) and answers distinguishably when it fails:

  1. 409 transfer_limit when credited fails the amount property's schema (maximum, exclusiveMaximum, multipleOf, enum, …). The comment withholds the issue list, but the status/code itself tells the payer whether recipientBalance + amount exceeds the bound. A refused probe moves nothing, so repeating it with different amounts reads the recipient's exact balance (observed: 10 requests for a maximum: 1000 property). The only precondition is that the payer holds the probed amount (the insufficient_balance check comes first).
  2. 413 record_too_large when the credited record would exceed maxRecordBytes: tells the payer roughly how large the recipient's hidden fields are. Side effect: an owner whose record is near the limit cannot receive a credit that adds digits.

Minimal reproduction

Collection wallets (ownership owner, balance: {type: integer, default: 0, maximum: 1000} in readOnlyProperties, transfers issue (members-gated, negative min) and pay), plus a projected readers directory showing name only.

  • treasurer issues 1000 to ann and 737 to bob.
  • ann: POST /api/wallets/transfers/pay {from: ann, to: bob, amount: 264} → 409 transfer_limit, nothing moves.
  • ann: same with amount: 263 → 200.
    So ann learns that bob holds exactly 737.

For (2): with maxRecordBytes: 400, once bob's record is just under the limit, amount: 1 → 200 but amount: 100000 → 413 record_too_large.

(Observed by running both; test file available on request.)

Root cause

packages/store/src/collection.ts transferIn: propertyIssue(this.spec.records, field, credited) (≈line 1524) and this.sized(credit) (≈line 1527) on the counterparty's record, answered with distinct errors.

Suggested fix

For owned collections, either refuse at activation any amount-property keyword that constrains the credited value beyond minimum/integer, or make credit-side failures indistinguishable from something the payer can already know; reserve size headroom for the amount at write time so a credit can't cross maxRecordBytes. Document that a credited record's constraints are observable to the payer if any remain.

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