Skip to content

Conversation

@yagohdezg
Copy link

@yagohdezg yagohdezg commented Nov 15, 2025

Description

When we call the str(base64.urlsafe_b64decode(saml_assertion)) we don't decode the bytes of the encoded assertion, we simply produce a representation of said bytes (you can test this by writing str(b"hello") in a python console and you'll see that the output is "b'hello'", which is not the correct output).

Motivation and Context

The current implementation of BrowserAzureCredentials incorrectly decodes the saml assertion. I changed it to use the more appropiate .decode of python bytes, that correctly decodes utf-8 characters.

Testing

I simply changed saml response base64 and the test token and included problematic characters (such as ") to avoid future problems

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • Local run of ./build.sh succeeds
  • Code changes have been run against the repository's pre-commit hooks
  • Commit messages follow Conventional Commit Specification
  • I have read the README document
  • I have added tests to cover my changes
  • I have run all unit tests using pytest test/unit and they are passing.

License

  • By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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.

1 participant