Problem
The current (stub) unlockAssets and the planned lockAssets / configureBoost flows build a Soroban transaction and immediately pass it to walletApi.signTransaction. They do not inspect the simulateTransaction response's auth array before signing.
A compromised RPC node or a man-in-the-middle could return a simulation response with injected auth entries that authorise additional contract calls beyond what the user intended. The user would see the Freighter dialog and sign without knowing.
Expected Behaviour
Before presenting any transaction to Freighter for signing, the app verifies that the simulation response contains exactly the expected number and type of auth entries. Any unexpected auth entry causes the transaction to be aborted and a clear warning is shown.
Acceptance Criteria
Relevant Files
src/lib/soroban.ts — add validateSimulationAuth; call it inside unlockAssets, lockAssets, configureBoost
src/context/ErrorContext.tsx — useErrorHandler for user-facing error display
src/lib/error-handler.ts — may need a new SecurityError class
Problem
The current (stub)
unlockAssetsand the plannedlockAssets/configureBoostflows build a Soroban transaction and immediately pass it towalletApi.signTransaction. They do not inspect thesimulateTransactionresponse'sautharray before signing.A compromised RPC node or a man-in-the-middle could return a simulation response with injected
authentries that authorise additional contract calls beyond what the user intended. The user would see the Freighter dialog and sign without knowing.Expected Behaviour
Before presenting any transaction to Freighter for signing, the app verifies that the simulation response contains exactly the expected number and type of auth entries. Any unexpected auth entry causes the transaction to be aborted and a clear warning is shown.
Acceptance Criteria
validateSimulationAuth(simResult, expected: { contractId: string; functionName: string }[])utility is added tosrc/lib/soroban.tssimResult.result?.auth(aSorobanAuthorizationEntry[]), decodes eachcredentialsfield, and asserts thecontractFn.contractAddressandcontractFn.functionNamematch the expected listSecurityErrorwith a user-facing messagelockAssets,unlockAssets, andconfigureBoostall callvalidateSimulationAuthbefore assembling the final transactionuseErrorHandlertoast (not swallowed silently)simResultwith an extra unexpected auth entry and asserts the function throwsRelevant Files
src/lib/soroban.ts— addvalidateSimulationAuth; call it insideunlockAssets,lockAssets,configureBoostsrc/context/ErrorContext.tsx—useErrorHandlerfor user-facing error displaysrc/lib/error-handler.ts— may need a newSecurityErrorclass