-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix basic auth options type issue #584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix basic auth options type issue #584
Conversation
347d688 to
785e4f9
Compare
|
ping @thornjad |
thornjad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch and fix! And great job with the tests!
| var usernameEqual = secureCompare(options.username.toString(), credentials.name); | ||
| var passwordEqual = secureCompare(options.password.toString(), credentials.pass); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also convert the credentials to strings? If the server were given a numeric password, as in the tests you added, the user will likely expect numeric to work. Or are we guaranteed to receive a string as credentials?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from the definition of basic-auth which we use here to parse credentials, I think, yes, the credentials are guaranteed to be string :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, perfect, that looks like it will always be a string! Could we just add in a comment here saying the same and/or why we need to use .toString() here? It could be added to the comment above the if, or a new comment within the if block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @thornjad , sorry for the late replay, the comment is added, pls review again :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coule we also mention in the comment that credentials.name and credentials.pass will be strings, so we don't need to convert them to strings?
785e4f9 to
eaf82a5
Compare
| var usernameEqual = secureCompare(options.username.toString(), credentials.name); | ||
| var passwordEqual = secureCompare(options.password.toString(), credentials.pass); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coule we also mention in the comment that credentials.name and credentials.pass will be strings, so we don't need to convert them to strings?
eaf82a5 to
1361eb9
Compare
1361eb9 to
cde6e5b
Compare
|
ping @thornjad |
cde6e5b to
bd36f7b
Compare
Fixes #583