Skip to content

fix(security): add short-lived payment tokens, referrer policy, and log sanitization - #786

Open
omosvico wants to merge 2 commits into
Pulsefy:mainfrom
omosvico:fix/770-payment-token-security
Open

fix(security): add short-lived payment tokens, referrer policy, and log sanitization#786
omosvico wants to merge 2 commits into
Pulsefy:mainfrom
omosvico:fix/770-payment-token-security

Conversation

@omosvico

Copy link
Copy Markdown

Description

Fixes #770 - Security: payment tokens in links/deeplinks may leak via referrers or logs

Changes

Token-based payment links:

  • New payment_link_tokens DB table for short-lived, revocable tokens
  • PaymentTokenService with generate, validate, rotate, consume, revoke
  • PaymentTokenController with REST API (POST /payment-tokens/generate, GET /payment-tokens/resolve/:token, POST /payment-tokens/consume/:token, POST /payment-tokens/revoke/:token, POST /payment-tokens/rotate/:token)
  • LinksService.generateMetadata() now generates tokens alongside canonical params
  • BulkPaymentLinksService uses tokens in generated URLs instead of raw query params
  • Token expiry sweep integrated into existing 1-minute cron worker

Referrer leakage prevention:

  • Referrer-Policy: no-referrer header added to all frontend responses via middleware
  • X-Content-Type-Options: nosniff and Strict-Transport-Security headers added
  • <meta name="referrer" content="no-referrer"> added to payment page metadata

Log sanitization:

  • PaymentPageClient.tsx: removed payment data (amount, asset, username, txHash) from console.log analytics tracking
  • notification-routing.ts: removed payload details from warning logs
  • Backend: removed run IDs and link IDs from expiry sweep log messages
  • Backend: removed error details from payment status check log

…og sanitization

Implements Pulsefy#770 - Security: payment tokens in links/deeplinks may leak via referrers or logs

- Add payment_link_tokens DB table with short-lived, revocable tokens
- PaymentTokenService: generate, validate, rotate, consume, revoke tokens
- PaymentTokenController: REST API for token lifecycle management
- LinksService now generates tokens alongside canonical params
- BulkPaymentLinksService uses tokens in generated URLs
- Add Referrer-Policy: no-referrer, X-Content-Type-Options, HSTS to middleware
- Add referrer meta tag to payment pages
- Sanitize console.log in PaymentPageClient (remove payment data from logs)
- Sanitize notification-routing.ts payload logs
- Sanitize backend error logs (remove run IDs, link IDs from log messages)
- Token expiry sweep integrated into existing cron job
@drips-wave

drips-wave Bot commented Jul 29, 2026

Copy link
Copy Markdown

@omosvico Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich

Cedarich commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@omosvico

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.

Security: payment tokens in links/deeplinks may leak via referrers or logs

2 participants