fix(tokens): Hash tokens in tokens module to resist ND2DB-style timing attack#83
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @Blckbrry-Pi and the rest of your teammates on |
MasterPtato
left a comment
There was a problem hiding this comment.
I'm not too familiar with this kind if attack, is it possible to write a unit test that confirms this attack is no longer valid after this patch?
Almost definitely not. I can almost guarantee that this style of timing attack will be impossible until a method is released to manipulate SHA256 hashes bit by bit. |
b2cefc7 to
3d5d946
Compare
3d5d946 to
29dbcf2
Compare
| req: Request, | ||
| ): Promise<Response> { | ||
| const hashed = await Promise.all(req.tokens.map(hash)); | ||
| console.log(hashed); |
| row: prisma.Prisma.TokenGetPayload<any>, | ||
| ): Token { | ||
| return { | ||
| ...withoutKeys(row, ["tokenHash"]), |
There was a problem hiding this comment.
this is more lines of code and harder to understand than just manually passing in each parameter from the row in to the response.
29dbcf2 to
32c725a
Compare

Resolves OGB-53