Skip to content

Modify _get_digest to use request.get_data(). #23

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ahawad
Copy link

@ahawad ahawad commented Jan 20, 2020

Describe your changes
This is a follow on to commit 8d3ad24:

  • request.data is empty when the content type of the payload is application/x-www-form-urlencoded, because the payload is parsed by Flask into request.form.

  • request.get_data() contains the contents of the request body that Flask cached. This works for application/json as well, because GitHub computes the signature over the request body in both cases.

Testing performed
I have tested this manually by issuing Github Webhooks to a local development server.

* request.data is empty when the request type is application/x-www-form-urlencoded
* request.get_data contains the raw request bytes, cached by flask, and
  that works for both application/json and application/x-www-form-urlencoded

Signed-Off-By: Ahmed Awad <[email protected]>
@anoadragon453
Copy link

Am I correct in thinking that this would fix webhook secrets for application/x-www-form-urlencoded? If so, yes please!

@jensenhwa
Copy link

@alexchamberlain Verification of secrets with application/x-www-form-urlencoded is broken without this change. Hope it can be merged in soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants