Skip to content

fix(logging): mask live payment intent ids in RPC and submit logs - #1853

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/payment-intent-id-logging
Oct 25, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/payment-intent-id-logging

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

A payment request's payment_intent_id can be used up by anyone who reads it before the share is paid, which blocks the payment (paymentrequest_service.proto:192). RPC body logging printed it in full, and the SubmitIntent trace printed 8 of its characters.

While an id is still usable, logs now show … plus its last 6 base58 characters:

  • formatProto masks the paymentIntentId field. The response that carries it always comes before the payment, so this field is always masked. The rest of each body logs as before.
  • LiveSecrets (in :libs:logging) holds ids that are still usable. formatProto masks a held IntentId wrapper the same way, which covers the SubmitIntent request body when a payment uses the server's id. The submitting intent trace masks a held id too.
  • A released id logs in full, so a paid share stays debuggable.

code/cash has no request pay path yet, so nothing calls hold here. The pay path in #1851 holds the server's id before it submits, logs the suffix if the payment fails, and releases the id and logs it in full once the payment succeeds.

Tests: FormatProtoTest (a GetPaymentRequestResponse logs only the suffix; a held IntentId logs the suffix and a released one logs in full) and LiveSecretsTest. :services:opencode gets the flipcash2 protos as a test-only dependency for the first case.

Anyone who reads a payment request's payment_intent_id before the share
is paid can use it up and block the payment. RPC body logging printed it
in full, and the SubmitIntent trace showed 8 of its characters.

- formatProto logs paymentIntentId as "…" plus its last 6 base58
  characters. The response that carries it always precedes payment.
- LiveSecrets holds ids that are still usable. formatProto masks a held
  IntentId the same way, which covers the SubmitIntent request body when
  a payment uses the server's id, and the submit trace does too. A
  released id logs in full, as every id does today.
@bmc08gt bmc08gt self-assigned this Oct 25, 2026
@github-actions github-actions Bot added area: network gRPC, connectivity, API, exchange rates type: fix Bug fix labels Oct 25, 2026
@bmc08gt
bmc08gt marked this pull request as ready for review October 25, 2026 15:28
@bmc08gt
bmc08gt merged commit 429f591 into code/cash Oct 25, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant