fix: browser_azure_credentials incorrectly decodes saml assertion #269
+6
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Checklist
./build.shsucceedspytest test/unitand they are passing.License