Running python with optimizations makes UsernamePasswordMako accept any password for any user
See original GitHub issueOn the current master
branch, the UsernamePasswordMako
class relies on an assert
statement to check the user’s password:
https://github.com/rohe/pysaml2/blob/9cbbd9bd9f6bfa5e9ceace064dd1af4e2ff2f68c/src/saml2/authn.py#L149
The assert
is supposed to raise an exception if the password doesn’t match. This is insecure: running python with optimizations enabled (either via the -O
or -OO
flags, or with the PYTHONOPTIMIZE
environment variable) will remove all such assertions. This means that no exception will be raised on an incorrect password, and the UsernamePasswordMako
will accept any password for any user.
It would be better to have an explicit check that raises an exception to avoid this problem.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:78
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Alec Muffett on Twitter: "Oh, this is glorious: pysaml2 library ...
Running python with optimizations makes UsernamePasswordMako accept any password for any user ·... On the current master branch, ...
Read more >3. Configure Python — Python 3.11.1 documentation
You can use the configure --enable-optimizations option to make this the default target of the make command ( make all or just make...
Read more >I need to securely store a username and password in Python ...
Basically do the following: Use file system permissions (chmod 400) Strong password for owner's account on the system.
Read more >SPID e Webserver Embedded Twisted Python - Forum Italia
Issue: Running python with optimizations makes UsernamePasswordMako accept any password for any user. opened by obi1kenobi on 2017-09-09.
Read more >Assisting Provet Cloud Users With Speech Recognition ...
The biggest learning takeaway for me is all new technology ... 31 Running python with optimizations makes UsernamePasswordMako accept any.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ll go through the code and replace all assert statements with if statements.
In my opinion, it would be better to leave this as a breaking change and signal that through semver. Raising
AssertionError
to indicate authentication failure seems unintuitive at best, and we’re better off without it IMHO.