You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a callback function to the options, so that the user can control the nonce field in challenge and perform additional validation for the nonce, thereby preventing replay attacks.
1,
The Digest scheme is based on a simple challenge-response paradigm. The Digest scheme challenges using a nonce value.
However, in current implementation of passport-http, the nonce value in challenge has not been saved.
Therefore, we can not know whether the authentication request corresponds to the challenge we sent before, which may not conform to the challenge-response paradigm.
Of course, if the digest values match the nonce, it indicates that the client knowns user password or HA1 value, which may not cause any security issues.
2,
Although you can check the nonce in validate callback.
However, to prevent replay attacks, the server must save all used nonce values to detect any repeated/reused nonce value.
This is more complex, and with time gose by there will be more and more nonce values which may take too many resources in server side.
As an alternative, if we allow the user to generate nonce value, users will have more choices to achieve additional checks, even without relying on the saved nonce values.
For example: user can generate a nonce with server timestamp using some algorithm, and retrieve the server timestamp from the nonce value received from client. Then user can further checks whether the timestamp is within the allowable range.
Similarly, the client IP address can be also added to the nonce generation algorithm.
Reference: RFC2617 "4.5 Replay Attacks"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a callback function to the options, so that the user can control the nonce field in challenge and perform additional validation for the nonce, thereby preventing replay attacks.