Repository navigation
Honor assert_hostname in the asyncio client - #2795
Yohan-Senadheera wants to merge 1 commit into
Conversation
assert_hostname=False turned off hostname checks in the sync client but had no effect in the asyncio client. Set check_hostname on the SSL context from it when verify_ssl is on. Signed-off-by: Yohan Senadheera <yohansenadheera@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Yohan-Senadheera The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@Yohan-Senadheera could you make the change in the upstream openapi-generator? instead of in the generator post-processing: kubernetes-client/gen#314 |
|
@yliaog Done, opened it upstream: OpenAPITools/openapi-generator#25796. It covers the asyncio template (and the httpx one, which had the same gap). Once it's in a generator release and the client is regenerated, I'll close this PR and kubernetes-client/gen#314, unless you'd prefer to keep them open until then. |
|
sounds good, thanks. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
assert_hostname=Falseturns off hostname checks in the sync client, but has no effect in the asyncio client:rest.pynever reads it. This setsssl_context.check_hostnamefrom it whenverify_sslis on. Withverify_ssloff it is left alone, so certificate verification is not switched back on.rest.pyis generated, so the same change is made in the generator post-processing: kubernetes-client/gen#314Tested with an HTTPS server whose certificate is issued for another hostname, trusted through
ssl_ca_cert:assert_hostname=Falsestill fails withCERTIFICATE_VERIFY_FAILED(hostname mismatch)assert_hostname=Falsereturns 200, and the default still rejects the mismatchThe new unit test fails on master and passes here. All
kubernetes/aio/test/test_generated_api.pytests pass.Which issue(s) this PR fixes:
None filed.
Does this PR introduce a user-facing change?