-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add skipBodyHash check flag in verifyDkimSignature function #251
Conversation
Can you bump version by minor amount then we can release on NPM to use? |
Hey @sukhman-sukh Can you give some context on why this is needed? DKIM should pass even now for empty bodies. Did you run in to any issues? |
We need it since the archive needs to calculate email header without body access in order to reverse engineer keys, and often body hash calculation fails |
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.
Added a minor comment
@@ -180,7 +182,7 @@ export class DkimVerifier extends MessageParser { | |||
|
|||
async finalChunk() { | |||
try { | |||
if (!this.headers || !this.bodyHashes.size) { | |||
if ((!this.headers || !this.bodyHashes.size) && !this.skipBodyHash) { |
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.
How about (!this.headers || (!this.skipBodyHash && !this.bodyHashes.size))
? (easier to read I guess)
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.
Yeah, I did the same but It was failing before, I fixed that but forgot to change it back.
Fixed.
This PR adds an optional flag for skipBodyHash and tests for pass on tampered body as well as bodyless emails with skipBodyHash=true.