-
Notifications
You must be signed in to change notification settings - Fork 45
isom-2003 feat(otp): update OTP verification to include IP address #2400
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
isom-2003 feat(otp): update OTP verification to include IP address #2400
Conversation
|
bugbot run |
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.
Bug: OTP Verification Test Fails Due to IP Mismatch
The POST /api/login/verify integration test primes the OTP cache with a hardcoded IP '127.0.0.1'. However, the actual HTTP request made by supertest may originate from a different IP address. As OTPs are now stored and retrieved using an email:ip key, this IP mismatch prevents successful OTP verification, causing the test to fail.
test/server/api/LoginRoute.test.ts#L58-L65
GoGovSG/test/server/api/LoginRoute.test.ts
Lines 58 to 65 in 6161aa4
| // Prime cache | |
| getOtpCache().setOtpForEmail('[email protected]', '127.0.0.1', { | |
| hashedOtp: '1', | |
| retries: 100, | |
| }) | |
| const res = await request(app) | |
| .post('/api/login/verify') | |
| .send({ email: '[email protected]', otp: '1' }) |
Was this report helpful? Give feedback by reacting with 👍 or 👎
dcshzj
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.
I think ok, but feels a bit like the blind leading the blind lol, need to really test on staging to make sure everything is still working as expected.
@dcshzj yeah i agree :sadge: |
Problem
What problem are you trying to solve? What issue does this close?
Closes https://linear.app/ogp/issue/ISOM-2003/vapt-active-denial-of-service-of-login-to-gogovsg
Solution
How did you solve the problem?
Features:
email:ipas redis key instead of justemailImprovements:
Tests
What tests should be run to confirm functionality?