Repository navigation
fix: check the hostname of each OpenStack endpoint's certificate - #31
Conversation
OpenStack::Client makes every user agent with
ssl_opts => { verify_hostname => 0 }, and no argument changes it. So
each request, and the X-Auth-Token in it, went to whichever server
answered for the endpoint.
OpenStack::Client does let a caller name the class it calls new on, as
package_ua. OpenStack::MetaAPI::UserAgent is an LWP::UserAgent that
removes verify_hostname from the ssl_opts it is given, so LWP decides as
it does for any user agent: the check is on unless
PERL_LWP_SSL_VERIFY_HOSTNAME is 0. new() gives it to
OpenStack::Client::Auth unless the caller names another package_ua.
A caller that builds its own auth object is not changed, and the POD of
the class says what to pass.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
|
Koan-Bot
left a comment
There was a problem hiding this comment.
Warning
Important issues found.
- New SYNOPSIS fails the dzil-generated xt/author/synopsis.t (strict vars)
The SYNOPSIS of OpenStack::MetaAPI::UserAgent used $endpoint and %auth_args without a declaration, and declared $api twice. The xt/author/synopsis.t that [Test::Synopsis] makes compiles it under strict, so dzil test and dzil release failed. A =for test_synopsis block now declares the variables. LWP also turns the hostname check off when HTTPS_CA_FILE or HTTPS_CA_DIR is set and PERL_LWP_SSL_VERIFY_HOSTNAME is not. The POD and the Changes entry now say so, and t/useragent.t tests it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
PR Review — fix: check the hostname of each OpenStack endpoint's certificateRestores TLS hostname verification by routing OpenStack::Client's
✅ Resolved since last review (1)Previously-flagged issues verified fixed
🟢 Suggestions
1. The one link the guarantee depends on — Auth propagating `package_ua` — is the only one not tested
|
Koan-Bot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
Thanks @teodesian this is now released as |
OpenStack::Client makes each of its user agents with
ssl_opts => { verify_hostname => 0 }, and no argument changes that. So every request from OpenStack::MetaAPI, and theX-Auth-Tokenin it, goes to whichever server answers for the endpoint. The last release of OpenStack::Client is from 2019, and the repository in its metadata no longer exists, so the fix cannot go there.OpenStack::Client does let a caller name the class that it calls
newon, aspackage_ua, andOpenStack::Client::Authpasses that to every client it makes. This PR uses that:OpenStack::MetaAPI::UserAgentis anLWP::UserAgentthat removesverify_hostnamefrom thessl_optsit is given. LWP then decides as it does for any user agent: the check is on, unlessPERL_LWP_SSL_VERIFY_HOSTNAMEis 0.PERL_LWP_SSL_CA_FILEandPERL_LWP_SSL_CA_PATHname a private certificate authority.new()givesOpenStack::Client::Auththat class aspackage_ua, unless the caller names another one.This changes behavior for a cloud with a self-signed certificate. Such a cloud now needs
PERL_LWP_SSL_CA_FILE, orPERL_LWP_SSL_VERIFY_HOSTNAME=0. The Changes entry says so.LWP::UserAgentmoves from a test prerequisite to a runtime prerequisite, indist.ini,Makefile.PLand.github/cpanfile.Testing
prove -l t/passes: 22 files, 271 tests.t/useragent.tis new. It shows that OpenStack::Client alone turns the check off, and that this class turns it on and keeps the otherssl_opts. It shows thatPERL_LWP_SSL_VERIFY_HOSTNAME=0turns the check off again. It also shows thatnew()passes the class toOpenStack::Client::Auth, and that a caller's ownpackage_uawins. The last test fails againstmain'sMetaAPI.pm.AI assistance
Per
AI_POLICY.md: Claude Code wrote this change and its tests, at my request.🤖 Generated with Claude Code