Lack of critical check on nearTokenId in newBridgeToken function
newBridgeToken does not validate that the nearTokenId argument equals result.token, allowing an attacker to register an incorrect nearTokenId and cause deposit and withdraw to always revert (DoS).
Description
The newBridgeToken function lacks a critical validation check for the nearTokenId argument. This argument should be required to equal result.token. The absence of this check allows any user to submit a metadata proof with an incorrect nearTokenId. As a result, the legitimate token ID will not be recognized in the _nearToEthToken and _isBridgeToken mappings. This causes the deposit and withdraw functions to always revert, effectively creating a Denial of Service (DoS) situation for these token functionalities.
Impact
The missing check on the nearTokenId argument can lead to a Denial of Service (DoS) attack. An attacker can submit a metadata proof with an incorrect nearTokenId, causing the deposit and withdraw functionalities to always revert. This is because the correct nearTokenId will not be found in the _nearToEthToken and _isBridgeToken mappings.
Recommendation
Add a validation check in the newBridgeToken function to ensure that the nearTokenId argument equals result.token. This will prevent users from submitting incorrect nearTokenId values and ensure that only legitimate token IDs are recognized in the mappings. Another fix is using result.token directly and removing the _nearToEthToken argument.
Resolution
Resolved.

