Skip to content
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

Fix signature containing boolean values #397

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

0x4a616e
Copy link

@0x4a616e 0x4a616e commented Aug 28, 2024

True in python was converted to "True" in signature calculation. JSON serialisation however converted it to "true", which resulted in invalid signatures being calculated.

Brief Summary of Changes

Signature calculation correctly handles boolean values.

What does this PR address?

  • GitHub issue (Add reference - #XX)
  • Refactoring
  • New feature
  • Bug fix
  • Adds more tests

Are tests included?

  • Yes
  • No

Reviewer, please note:

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I ran the full test suite before pushing the changes and all the tests pass.

True in python was converted to "True" in signature calculation. JSON serialisation however converted it to "true", which resulted in invalid signatures being calculated.
@const-cloudinary
Copy link
Contributor

@0x4a616e , thank you for the pull request!

This is an internal (although marked as public) function.

The function to use is:

def sign_request(params, options):

Inside it performs parameters cleanup and normalization:

params = cleanup_params(params)

def cleanup_params(params):

(please note that boolean parameters in Upload API are converted to integers (1/0).

If you still prefer to keep your fix, please add a unit test somewhere here:

def test_api_sign_request_sha256(self):

And after that we can merge it.

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.

2 participants