-
Notifications
You must be signed in to change notification settings - Fork 1
fix(tokens): Hash tokens in tokens
module to resist ND2DB-style timing attack
#83
base: 06-07-chore_migrate_from_yaml_to_json
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @Blckbrry-Pi and the rest of your teammates on Graphite |
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'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
@@ -13,18 +13,22 @@ export async function run( | |||
ctx: ScriptContext, | |||
req: Request, | |||
): Promise<Response> { | |||
const hashed = await Promise.all(req.tokens.map(hash)); | |||
console.log(hashed); |
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.
remove
row: prisma.Prisma.TokenGetPayload<any>, | ||
): Token { | ||
return { | ||
...withoutKeys(row, ["tokenHash"]), |
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.
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