Skip to content

fix(tron): align security warnings and scan preferences - #557

Merged
taran-a merged 2 commits into
mainfrom
feat/tron-align-security-warning-loading
Nov 5, 2026
Merged

taran-a merged 2 commits into
mainfrom
feat/tron-align-security-warning-loading

Conversation

@taran-a

@taran-a taran-a commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Explanation

Updates Tron security warning copy and shows the loading banner only during the initial scan. Respects security-alert and simulation preferences while preserving existing findings during background refreshes and keeping local transaction checks active.

Cases addressed from the reference:

  1. Initial scan loading
  2. Warning
  3. Background refresh
  4. Security/simulation preferences off

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@taran-a
taran-a requested review from a team as code owners November 4, 2026 19:40
@taran-a
taran-a force-pushed the feat/tron-align-security-warning-loading branch from 028dbb2 to 3855c09 Compare November 4, 2026 19:41
@taran-a
taran-a force-pushed the feat/tron-align-security-warning-loading branch from 3855c09 to f241d4d Compare November 5, 2026 07:17
@Julink-eth
Julink-eth requested a balanced review from Copilot November 5, 2026 09:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new security warning is untranslated in the Spanish catalog, and the changelog incorrectly attributes the unreleased fix to version 4.3.1.

2 open issues
What changed in this PR

Updates Tron transaction confirmations to respect security-alert and simulation preferences while keeping local validity checks active.

Changes:

  • Separates warning copy from malicious-request copy and limits the loading banner to the initial scan.
  • Makes send scans preference-aware and preserves existing findings during background refreshes.
  • Adds regression tests, warning-message entries, and changelog documentation.
File Description
packages/​tron-wallet-snap/​src/​ui/​confirmation/​views/​ConfirmTransactionRequest/​render.tsx Validates transaction structure and respects scan preferences.
packages/​tron-wallet-snap/​src/​ui/​confirmation/​views/​ConfirmTransactionRequest/​render.test.tsx Tests validation and scan-preference combinations.
packages/​tron-wallet-snap/​src/​ui/​confirmation/​views/​ConfirmTransactionRequest/​ConfirmTransactionRequest.test.tsx Tests initial loading and retained background warnings.
packages/​tron-wallet-snap/​src/​ui/​confirmation/​views/​ConfirmSignTransaction/​render.tsx Checks local expiry before enabling confirmation when scans are disabled.
packages/​tron-wallet-snap/​src/​ui/​confirmation/​views/​ConfirmSignTransaction/​render.test.tsx Tests preference handling and local blockers.
packages/​tron-wallet-snap/​src/​ui/​confirmation/​views/​ConfirmSignTransaction/​ConfirmSignTransaction.test.tsx Tests warning copy and background-refresh presentation.
packages/​tron-wallet-snap/​src/​ui/​confirmation/​utils/​getTransactionAlertProps.ts Uses distinct warning messages and initial-only loading state.
packages/​tron-wallet-snap/​src/​handlers/​cronjob/​cronjob.tsx Makes send refresh scans preference-aware while retaining transaction refreshes.
packages/​tron-wallet-snap/​src/​handlers/​cronjob/​cronjob.test.tsx Tests transaction refreshes with scans disabled.
packages/​tron-wallet-snap/​messages.json Defines dedicated risk-warning messages.
packages/​tron-wallet-snap/​locales/​es.json Adds warning entries to the Spanish catalog.
packages/​tron-wallet-snap/​locales/​en.json Adds English warning translations.
packages/​tron-wallet-snap/​CHANGELOG.md Documents warning and scan-preference changes.

Review effort: Balanced

Comment thread packages/tron-wallet-snap/CHANGELOG.md Resolved
@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

// Always request simulation for estimated changes;
// conditionally add validation based on user preference
const options: SecurityAlertsScanOption[] = ['simulation'];
// 3. Scan only when security alerts or simulation are enabled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!!! Very good 👏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified in the Tron transaction confirmation changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@taran-a
taran-a added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit c31e3e9 Nov 5, 2026
57 checks passed
@taran-a
taran-a deleted the feat/tron-align-security-warning-loading branch November 5, 2026 10:48
@Battambang

Copy link
Copy Markdown
Contributor

@metamaskbot publish-preview

LabinatorSolutions pushed a commit to LabinatorSolutions/metamask-extension that referenced this pull request Nov 7, 2026
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

Bumps the Solana, Stellar, and Tron wallet snaps to the versions
released in internal-snaps `22.0.0`:

- `@metamask/solana-wallet-snap`: `^7.2.0` → `^7.3.0`
- `@metamask/stellar-wallet-snap`: `^2.0.0` → `^2.1.0`
- `@metamask/tron-wallet-snap`: `^4.3.1` → `^4.4.0`

All three are backwards-compatible minor updates; no application code
changes are required.

### @metamask/solana-wallet-snap 7.3.0

- Remove the temporary fallback that injected `https://metamask.io` as
the request origin when `keyring_submitRequest` was called without one
([MetaMask#533](MetaMask/internal-snaps#533)).

### @metamask/stellar-wallet-snap 2.1.0

- `confirmSend` now throws when signing or submission fails after the
user confirms, instead of returning a JSON error response
([MetaMask#550](MetaMask/internal-snaps#550)).
- Bump `@stellar/stellar-sdk` from `^17.2.1` to `^17.4.0`
([MetaMask#545](MetaMask/internal-snaps#545)).
- Retry transient Token API, Price API, Security Alerts API, RPC, and
Horizon failures with bounded timeouts and circuit breaking
([MetaMask#534](MetaMask/internal-snaps#534),
[MetaMask#551](MetaMask/internal-snaps#551)).
- Fix `onAmountInput` to accept the optional destination as `toAddress`
instead of `to`
([MetaMask#558](MetaMask/internal-snaps#558)).

### @metamask/tron-wallet-snap 4.4.0

- Support `VoteWitnessContract` and `AccountPermissionUpdateContract`
transactions by upgrading TronWeb to 6.5.1
([MetaMask#561](MetaMask/internal-snaps#561)).
- Align transaction security warning copy and scan-loading behavior with
user preferences
([MetaMask#557](MetaMask/internal-snaps#557)).

## **Changelog**

CHANGELOG entry: null

## **Related issues**

n/a

## **Manual testing steps**

n/a

## **Screenshots/Recordings**

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [X] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [X] I've completed the PR template to the best of my ability
- [X] I’ve included tests if applicable
- [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [X] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
anxolin pushed a commit to anxolin/internal-snaps that referenced this pull request Nov 7, 2026
## Explanation

This release branch prepares version `22.0.0`. It contains:

- `@metamask/solana-wallet-snap` `7.2.0` → `7.3.0` (minor: remove
obsolete `https://metamask.io` origin fallback)
- `@metamask/stellar-wallet-snap` `2.0.0` → `2.1.0` (minor: fetch policy
for RPC, Horizon and HTTP clients, `@stellar/stellar-sdk` upgrade,
`onAmountInput` `toAddress` fix, `confirmSend` now throws after
confirmation failures)
- `@metamask/tron-wallet-snap` `4.3.1` → `4.4.0` (minor:
`VoteWitnessContract` and `AccountPermissionUpdateContract` support via
TronWeb 6.5.1, security warning copy and scan-loading alignment)
- Root monorepo version bumped to `22.0.0`

## References

- `@metamask/solana-wallet-snap`:
[MetaMask#533](MetaMask#533)
- `@metamask/stellar-wallet-snap`:
[MetaMask#550](MetaMask#550),
[MetaMask#545](MetaMask#545),
[MetaMask#534](MetaMask#534),
[MetaMask#551](MetaMask#551),
[MetaMask#558](MetaMask#558)
- `@metamask/tron-wallet-snap`:
[MetaMask#561](MetaMask#561),
[MetaMask#557](MetaMask#557)

## Checklist

- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/updating-changelogs.md)
- [ ] I've introduced [breaking
changes](https://github.com/MetaMask/internal-snaps/tree/main/docs/processes/breaking-changes.md)
in this PR and have prepared draft pull requests for clients and
consumer packages to resolve them
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.

5 participants