Skip to content

fix: bound lovelace amounts to uint64 + keep payment-gate network server-owned#104

Merged
MorganOnCode merged 2 commits into
masterfrom
fix/amount-bounds-and-server-owned-network
May 28, 2026
Merged

fix: bound lovelace amounts to uint64 + keep payment-gate network server-owned#104
MorganOnCode merged 2 commits into
masterfrom
fix/amount-bounds-and-server-owned-network

Conversation

@MorganOnCode
Copy link
Copy Markdown
Owner

Summary

Final low-risk re-derived slice from the closed #88 — two trust-boundary fixes.

  • core: LovelaceAmountSchema now caps length (20) and refines that the value is <= 2^64-1, so an over-uint64 amount string can't slip through to BigInt math / downstream assumptions.
  • sdk: createPaymentGate's 402 accepted.network now comes from server config (options.network), not the client-supplied payload.accepted.network — a client can no longer steer the network field in the verify payload. (This is the trust-boundary invariant the payment-security check guards.)
  • Tests: over-uint64 rejection; payment-gate uses server-owned network despite an attacker-supplied cardano:mainnet/attacker accepted block.

Risk

Low: config-compatible. Bounds an unbounded input + removes a client-controllable field from the server's verify payload. Verified: typecheck clean, core 70 + root 457 tests pass.

Completes the low-risk re-delivery batch from #88. (Remaining: the gated config/infra tier + the coupled CI checks + Lucid bumps.)

🤖 Generated with Claude Code

MorganOnCode and others added 2 commits May 28, 2026 05:49
…ver-owned

Final low-risk re-derived slice from the closed #88 — two trust-boundary fixes.

- core: LovelaceAmountSchema now caps length (20) + refines that the value is
  <= 2^64-1, so an over-uint64 amount string can't slip through to BigInt math.
- sdk: createPaymentGate's 402 `accepted.network` now comes from server config
  (options.network), not the client-supplied payload.accepted.network — a client
  can no longer steer the network field in the verify payload.
- Tests: over-uint64 rejection; payment-gate uses server-owned network despite an
  attacker-supplied mainnet/attacker accepted block.

Config-compatible. Verified: typecheck clean, core 70 + root 457 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MorganOnCode MorganOnCode merged commit ed175f5 into master May 28, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant