Skip to content
This repository was archived by the owner on Apr 3, 2019. It is now read-only.

Conversation

@vbudhram
Copy link
Contributor

@vbudhram vbudhram commented Mar 23, 2018

From debugging mozilla/fxa-auth-server#2351, I found that the verifyTokenWithMethod stored procedure was not correctly updating an already verified session's verificationMethod. This could help explain why mozilla/fxa-auth-server#2346 (comment) happened.

Either way, this PR fixes the issue and matches how the mem db's method works.

@vbudhram vbudhram added the WIP label Mar 23, 2018
@vbudhram vbudhram added this to the FxA-143: MFA milestone Mar 23, 2018
@vbudhram vbudhram self-assigned this Mar 23, 2018
@ghost ghost added the waffle:active label Mar 23, 2018
UPDATE `sessionTokens` SET verificationMethod = verificationMethodArg, verifiedAt = verifiedAtArg
WHERE tokenId = tokenIdArg;

SET @updateCount = (SELECT ROW_COUNT());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The count returned should be the the number of session's updated, previously it was number of tokens verified.

return db.sessionToken(tokenId)
}, assert.fail)
.then((token) => {
assert.equal(!! token.mustVerify, false, 'mustVerify is null')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment here suggest we expect it to be null, but then for the test we coerce it to a boolean and compare it to false, which seems kinda funny.

If the comment is true why aren't we comparing to null? Or if the comment is wrong and we expect a boolean, why are we coercing it first? Is it expected that it might be null or false? Or can we guarantee that it will always be a boolean and eliminate the coercion? The stricter the tests are the better, is all I'm thinking.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops you are right, this doesn't need coercing. It just needs to check that the value is false.

Copy link
Contributor

@philbooth philbooth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@vbudhram vbudhram force-pushed the update-verify-with-method branch from dc06bc8 to d91ffbd Compare March 26, 2018 14:22
@vbudhram vbudhram merged commit 9c433ba into master Mar 26, 2018
@ghost ghost removed the waffle:active label Mar 26, 2018
@shane-tomlinson shane-tomlinson deleted the update-verify-with-method branch April 18, 2018 12:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants