-
-
Notifications
You must be signed in to change notification settings - Fork 862
Asgiref tls extension proposal #2586
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
base: main
Are you sure you want to change the base?
Conversation
ece9cf9 to
78a2f6e
Compare
| self.callback_notify = callback_notify | ||
| self.ssl_keyfile = ssl_keyfile | ||
| self.ssl_certfile = ssl_certfile | ||
| self.ssl_cert_pem: str | None = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you add this? Seems out of scope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added in order to serve read and store the server cert pem one place. This need to be passed to the scope, and the file should not be read on every request.
should this be placed somewhere else?
uvicorn/protocols/utils.py
Outdated
| class TLSInfo(TypedDict, total=False): | ||
| server_cert: str | None | ||
| client_cert_chain: list[str] | ||
| tls_version: str | None | ||
| cipher_suite: str | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to go in the _types module, and be added to the extensions key.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit unsure about how that works. This is my attempt to fix it: 3186a0d
78a2f6e to
db67d7a
Compare
77edfda to
54fc797
Compare
54fc797 to
a3bfb93
Compare
a3bfb93 to
1fc2beb
Compare
Summary
Simplification of #1119 according to the discussion in django/asgiref#466
A proof of concept for a change in the asgi spec for the tls extension where
client_cert_nameis removed because it's not the role of the ASGI web server to parse X.509 certificate. The content of the field is a part of theclient_cert_chain, and should be extracted from there. (as shown in the test in this PR)client_cert_erroris removed as it was impossible to fill with any useful information.tls_versionandcipher_suiteis filled with string returned by ssl.SSLSocket.version() and ssl.SSLSocket.cipher()Checklist