-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Hmac auth body validation #3347
Hmac auth body validation #3347
Conversation
@mvanholsteijn thanks for PR, would you please rebase before we start reviewing ? |
@shashiranjan84 Do you have any idea on when this PR might be reviewed? |
kong/plugins/hmac-auth/access.lua
Outdated
if not body then | ||
return false | ||
-- if no body, calculate sha-256 over 0 bytes | ||
body = '' | ||
end |
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.
you can drop this check and just do
sha256:update(body or '')
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.
Overall looks good, just requested minor change.
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.
LGTM
@mvanholsteijn would you please also update the doc, https://github.com/Kong/getkong.org/blob/master/app/plugins/hmac-authentication.md? |
@shashiranjan84 I added the documentation to getkong.org... |
Thanks @mvanholsteijn . |
@mvanholsteijn Thank you for the patch! If you haven't done so yet, be sure to grab your Contributor T-shirt :) |
Summary
Changes the hmac-auth request validation logic to pass if:
Digest
and no bodyDigest
for an empty body and no body.Digest
for the body and a body.This is to make sure that we can put 'digest' in the enforce_headers for all requests.
Full changelog
Issues resolved
Fix #3345
Fix #3346