What changed, and why it matters
This commit is a routine mix of small fixes and test-tool updates. It makes a UI key more specific to avoid list-item conflicts, adds a safety check before showing a post-transaction popup, updates a test helper to match new app settings, improves how exchange rates are quoted in an internal diagnostic script, and fixes a type-conversion issue when reading a fee value. None of these changes appear to be security fixes for a vulnerability, and the commit message gives no security context.
No immediate security action required. Review the `context.mounted` change as a normal stability improvement. If triaging for a security release, note that this commit does not disclose or fix a known vulnerability and should not be treated as a security patch without additional evidence.
Security signals we found
Flutter BuildContext used across async gap now guarded by context.mounted
No explicit security keywords, CVE references, or advisory links in commit or title
Changes are split across UI, test tooling, and fixture scripts with no coherent security theme
Evidence from the diff
The diff contains four unrelated changes: (1) a key-value string change in the buy/sell provider list to disambiguate list items by including rampId and paymentType; (2) a context.mounted guard before calling showModalBottomSheet after an async gap in the transaction-committed screen; (3) updates to tool/exchange_provider_check.dart to implement newly added SettingsStore interface members and to refactor rate quoting to use ProviderRate/TradeRequest consistently; (4) a defensive .toString() on secrets.nearIntentsAppFee before int.tryParse in tool/fetch_exchange_fixtures.dart. The context.mounted change is a best-practice Flutter fix that prevents a potential Looking up a deactivated widget's ancestor / use-after-dispose exception, but it is not a clear-cut security vulnerability. The other changes are functional/test-tooling only.
Changed components
lib/new-ui/pages/buy_sell/buy_sell_provider_page.dartlib/new-ui/widgets/send_page/send_confirm_sheet.darttool/exchange_provider_check.darttool/fetch_exchange_fixtures.dartInspect captured patch +76 / −18
### lib/new-ui/pages/buy_sell/buy_sell_provider_page.dart
@@ -162,7 +162,7 @@ class _BuySellProviderPageState extends State<BuySellProviderPage> {
ListItem quoteListItem(Quote quote) {
final fiatAmount = widget.buySellViewModel.fiatAmountForQuote(quote);
return ListItemRegularRow(
- keyValue: quote.provider.title+(quote.rampName??""),
+ keyValue: [quote.provider.title, quote.rampId ?? "", quote.paymentType.name].join("|"),
label: quote.rampName ?? quote.provider.title,
secondaryLabel: quote.rampName != null ? quote.provider.title : null,
subtitle: quote.badges.isEmpty ? null : quote.badges.join(" - "),
### lib/new-ui/widgets/send_page/send_confirm_sheet.dart
@@ -556,11 +556,14 @@ class _TransactionCommitedScreenState extends State<TransactionCommitedScreen> {
final page = getIt.get<TransactionDetailsModal>(
param1: widget.sendViewModel!.transactionInfo!, param2: true);
- showModalBottomSheet(
- isScrollControlled: true,
- context: context,
- builder: (context) =>
- FractionallySizedBox(heightFactor: 0.9, child: page));
+ if (context.mounted) {
+ showModalBottomSheet(
+ isScrollControlled: true,
+ context: context,
+ builder: (context) =>
+ FractionallySizedBox(heightFactor: 0.9, child: page),
+ );
+ }
}),
],
),
### tool/exchange_provider_check.dart
@@ -41,6 +41,7 @@ import "package:cake_wallet/exchange/provider/whynot/whynot_exchange_provider.da
import "package:cake_wallet/exchange/provider/trocador/trocador_exchange_provider.dart";
import "package:cake_wallet/new-ui/viewmodels/swap/provider_registry.dart";
import "package:cake_wallet/new-ui/viewmodels/swap/util/exchange_limits.dart";
+import "package:cake_wallet/new-ui/viewmodels/swap/util/provider_rate.dart";
import "package:cake_wallet/store/settings_store.dart";
import "package:cake_wallet/view_model/settings/sync_mode.dart";
import "package:cw_core/amount/money.dart";
@@ -457,6 +458,45 @@ class FakeSettingsStore implements SettingsStore {
// TODO: implement updateAllTrocadorProviderStates
throw UnimplementedError();
}
+
+ @override
+ late bool accountsHomePromoDismissed;
+
+ @override
+ late bool shouldShowChartsInDashboard;
+
+ @override
+ late bool shouldShowNftsTab;
+
+ @override
+ late bool showCiBuildOverlay;
+
+ @override
+ late bool useRobinhoodScan;
+
+ @override
+ Future<void> dismissEducation(String educationId) {
+ // TODO: implement dismissEducation
+ throw UnimplementedError();
+ }
+
+ @override
+ bool hasViewedExplainer(String preferencesKey) {
+ // TODO: implement hasViewedExplainer
+ throw UnimplementedError();
+ }
+
+ @override
+ bool isEducationDismissed(String educationId) {
+ // TODO: implement isEducationDismissed
+ throw UnimplementedError();
+ }
+
+ @override
+ Future<void> setExplainerViewed(String preferencesKey) {
+ // TODO: implement setExplainerViewed
+ throw UnimplementedError();
+ }
}
class FakeSharedPreferences implements SharedPreferences {
@@ -898,12 +938,34 @@ Future<TradeResult> checkProvider(
// FIXED=1 exercises the fixed-rate path, which is otherwise never covered.
final isFixedRate = Platform.environment["FIXED"] != null;
var from = baseline;
+ var payout = baselineAmount(to);
+
+ TradeRequest tradeRequest() => TradeRequest(
+ refundAddress: placeholderAddress(from.currency as CryptoCurrency),
+ payoutAddress: placeholderAddress(to),
+ depositAmount: from,
+ isFixedRate: isFixedRate,
+ payoutAmount: payout,
+ );
+
+ // As in the app, a fixed rate is quoted for the payout amount and a
+ // floating rate for the deposit amount; the rate fills in the other side.
+ Future<ProviderRate> quote() async {
+ final rate = await provider.fetchRate(tradeRequest().rateRequest);
+ if (isFixedRate) {
+ from = rate.rate.convert(payout);
+ } else {
+ payout = rate.rate.convert(from);
+ }
+ return rate;
+ }
+
try {
// Mirrors the real app flow: a rate is always fetched before the user
// can confirm a trade. This is also a hard requirement for some
// providers internally (e.g. Trocador populates its enabled-provider
// list only inside fetchRate).
- var rate = await provider.fetchRate(from: from, to: to, isFixedRate: isFixedRate);
+ var rate = await quote();
// Our baseline is a rough USD guess, so it can easily land outside a
// provider's accepted range. Being out of range is expected behavior,
@@ -913,8 +975,9 @@ Future<TradeResult> checkProvider(
? amountWithinLimits(from, rate.limits)
: null;
if (corrected != null) {
+ payout = rate.rate.convert(corrected);
from = corrected;
- rate = await provider.fetchRate(from: from, to: to, isFixedRate: isFixedRate);
+ rate = await quote();
}
if (rate.rate.quote.isZero || rate.rate.quote.isNegative) {
@@ -929,15 +992,7 @@ Future<TradeResult> checkProvider(
);
}
- final request = TradeRequest(
- refundAddress: placeholderAddress(from.currency as CryptoCurrency),
- payoutAddress: placeholderAddress(to),
- depositAmount: from,
- isFixedRate: isFixedRate,
- payoutAmount: rate.rate.convert(from),
- );
-
- final trade = await provider.createTrade(request: request);
+ final trade = await provider.createTrade(request: tradeRequest());
return TradeResult(
provider: provider.title,
### tool/fetch_exchange_fixtures.dart
@@ -367,7 +367,7 @@ Map<String, String> _nearIntentsHeaders() => {
List<Object> _nearIntentsAppFees() {
const recipient = secrets.nearIntentsAppFeeRecipient;
- final fee = int.tryParse(secrets.nearIntentsAppFee);
+ final fee = int.tryParse(secrets.nearIntentsAppFee.toString());
if (recipient.trim().isEmpty || fee == null) {
return const [];
}Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.