Skip to content

fix: avoid logging full FiatOrder on deposit order failure#26735

Merged
AxelGes merged 3 commits into
mainfrom
fix/TRAM-3260_deposit-order-error-log-pii
Mar 2, 2026
Merged

fix: avoid logging full FiatOrder on deposit order failure#26735
AxelGes merged 3 commits into
mainfrom
fix/TRAM-3260_deposit-order-error-log-pii

Conversation

@AxelGes

@AxelGes AxelGes commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Description

When a deposit order fails to process, the catch block in processDepositOrder was logging the full FiatOrder object to Sentry via Logger.error. This object can contain sensitive payment details (e.g. paymentDetails).

This fix replaces order with order.id in the log context so only the order identifier is sent to Sentry, not the full order payload.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/jira/software/c/projects/TRAM/boards/1568?assignee=712020%3Aff625c85-a003-41f4-9b73-e2af164f8214&selectedIssue=TRAM-3260

https://github.com/MetaMask/pm-security/issues/583

Manual testing steps

```gherkin
Feature: Deposit order error logging

Scenario: user triggers a deposit order processing failure
Given the user has an in-progress deposit order
When the SDK call to fetch the order fails
Then the error is logged to Sentry with only the order ID
And no sensitive paymentDetails are included in the log
```

Screenshots/Recordings

Before

Logger.error sends the full FiatOrder object (including paymentDetails) to Sentry.

After

Logger.error sends only { message, orderId } to Sentry.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk: changes only adjust Logger.error context fields and update a unit test, with no impact to order processing or UI behavior.

Overview
Redacts potentially sensitive FiatOrder data from Sentry logs by replacing full order objects with minimal metadata (e.g., orderId, provider, orderType, state, network) in multiple ramp order processing and order-details error paths.

Updates the processOrder unit test to assert the new structured logging payload for unsupported providers.

Written by Cursor Bugbot for commit f138be7. This will update automatically on new commits. Configure here.

@AxelGes AxelGes self-assigned this Mar 2, 2026
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-money-movement issues related to Money Movement features label Mar 2, 2026
@amitabh94

Copy link
Copy Markdown
Contributor

Can we add other non sensitive details to the order object in the error so that it becomes easy to debug like provider details and may be order link ?

AxelGes added 3 commits March 2, 2026 14:46
Only log the order ID instead of the full order object to prevent
sensitive paymentDetails from being sent to Sentry.
Avoid logging full FiatOrder (and paymentDetails) to Sentry in:
- RampsOrderDetails, Aggregator OrderDetails, DepositOrderDetails
- orderProcessor unrecognized provider, AggregatorProcessor
Update orderProcessor test to expect orderId in Logger.error.
Add provider, orderType, state, and network fields to Logger.error calls
in all Ramp order processors to aid debugging without exposing PII.
@AxelGes AxelGes force-pushed the fix/TRAM-3260_deposit-order-error-log-pii branch from 04d1d1b to f138be7 Compare March 2, 2026 17:49
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeRamps
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are purely logging improvements in the Ramp (buy/sell crypto) functionality. All modifications replace full order objects with specific fields (orderId, provider, orderType, state, network, status) in Logger.error calls across 6 files:

  1. OrderDetails.tsx (Aggregator) - Changed order to orderId: order.id
  2. aggregator.ts - Changed order to specific fields
  3. DepositOrderDetails.tsx - Changed order to orderId: order.id
  4. Deposit orderProcessor - Changed order to specific fields
  5. Ramp OrderDetails.tsx - Added specific fields to error logging
  6. Ramp orderProcessor - Changed order to specific fields
  7. Unit test updated to match new logging format

These are non-functional changes that:

  • Only affect error logging paths, not happy paths
  • Don't modify any business logic or UI
  • Have corresponding unit test updates
  • Reduce logged data for privacy/security (avoiding logging full order objects)

While the risk is low, selecting SmokeRamps provides confidence that the ramp flows (buy/sell crypto) still work correctly after these changes. The changes don't warrant additional tags like SmokeWalletPlatform since they don't affect wallet home or actions entry points - they only affect internal error logging.

Performance Test Selection:
These changes are purely logging improvements in error handling paths. They don't affect UI rendering, data loading, state management, or any user-facing flows. The changes only modify what gets logged when errors occur, which has no impact on app performance. No performance tests are needed.

View GitHub Actions results

@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 60
Missing keys 0
Type mismatches 1
Value mismatches 10 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

@AxelGes AxelGes marked this pull request as ready for review March 2, 2026 18:35
@AxelGes AxelGes requested a review from a team as a code owner March 2, 2026 18:35
@AxelGes AxelGes enabled auto-merge March 2, 2026 18:35
@AxelGes AxelGes added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit 9992ef6 Mar 2, 2026
92 checks passed
@AxelGes AxelGes deleted the fix/TRAM-3260_deposit-order-error-log-pii branch March 2, 2026 18:57
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-S team-money-movement issues related to Money Movement features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants