Skip to content

Cover the password prompt case for SSLContext.load_cert_chain with a test #132102

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
donBarbos opened this issue Apr 4, 2025 · 1 comment
Open
Labels
pending The issue will be closed if no feedback is provided tests Tests in the Lib/test dir topic-SSL

Comments

@donBarbos
Copy link
Contributor

donBarbos commented Apr 4, 2025

@picnixz found a case that is not covered by the tests: when we specify a cert and a password-protected file, but no password. This behavior can be reproduced in the following way (password is somepass):

>>> import ssl
>>> context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
>>> context.load_cert_chain(certfile="./Lib/test/certdata/keycert.passwd.pem")
Enter PEM pass phrase:

Documentation says that in this case the password should be requested interactively

If the password argument is not specified and a password is required, OpenSSL’s built-in password prompting mechanism will be used to interactively prompt the user for a password.

We have great tests (./Lib/test/test_ssl) for the ssl module but unfortunately this case has no tests, so I suggest to add it

@picnixz
Copy link
Member

picnixz commented Apr 5, 2025

Considering #129607 (comment), I'll forward my reply (#129607 (comment)):

[...] if you think it's fine not to cover this, I'm also fine (we test everything but the interactive prompt; but I guess that the interactive prompt is actually populating the context so we don't need to do anything on our side).

So maybe this is not needed. Sorry for making you create this issue.

@picnixz picnixz added the pending The issue will be closed if no feedback is provided label Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending The issue will be closed if no feedback is provided tests Tests in the Lib/test dir topic-SSL
Projects
None yet
Development

No branches or pull requests

2 participants