The get_secret()
attempts to retrieve the Vault resource for the owner address without first checking if it exists.
If the Vault resource has not been set for the owner, borrow_global<Vault>(@owner)
will abort.
Likelihood: Medium
This issue will occur if a user tries to get the secret before it has been set.
Impact: Low
Users or integrators may be confused by the generic error message, leading to a poor user experience and more difficult debugging.
Put the test_get_secret_before_set
into the test section of secret_vault.move
.
Run the test with aptos move test -f test_get_secret_before_set
.
Before calling borrow_global<Vault>(@owner)
, check if the resource exists and provide an explicit error code or message.
Document the new error code for clarity.
There is no security impact on the protocol, therefore this is an Informational finding. Also, it is a user mistake, if the user calls `get_secret` without first calling `set_secret`.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.