Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Incorrect NatSpec Documentation in `getPassword` Function

Vulnerability Details

The getPassword function in the PasswordStore.sol contract contains a NatSpec comment that describes a parameter @param newPassword The new password to set. However, the getPassword function does not have any parameters. This indicates that the documentation is either outdated or incorrectly copied from another function (possibly setPassword). Additionally, the NatSpec comment lacks a @return entry, which should be present to describe the return value of the function, given that it returns the stored password.

31 /*
32 * @notice This allows only the owner to retrieve the password.
33 * @param newPassword The new password to set.
34 */
35 function getPassword() external view returns (string memory) {

Impact

Low. While the actual functionality of the contract is not impacted by the incorrect NatSpec comment, it can lead to confusion for developers, auditors, or anyone reviewing the contract. Proper documentation is essential for understanding the intended behavior of a function, especially in a context where clarity and security are paramount.

Recommendations

  • Update the NatSpec comment for the getPassword function to remove the incorrect @param entry. Ensure that the documentation accurately describes the function's behavior and intent.

  • Add a @return entry in the NatSpec comment for the getPassword function to describe its return value, such as @return The stored password.
    -Ensure that the documentation accurately describes the function's behavior and intent.

/*
* @notice This allows only the owner to retrieve the password.
- * @param newPassword The new password to set.
+ * @return The stored password.
*/
function getPassword() external view returns (string memory) {
Updates

Lead Judging Commences

inallhonesty Lead Judge
almost 2 years ago
inallhonesty Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.