Migrate JWT/JWK auto-refresh from RPCSessions to curl multi singleton#7989
Migrate JWT/JWK auto-refresh from RPCSessions to curl multi singleton#7989Copilot wants to merge 11 commits into
Conversation
Replace rpcsessions->create_client() HTTP fetches in JwtKeyAutoRefresh with ccf::curl::CurlRequest attached to CurlmLibuvContextSingleton, following the pattern established in #7102 for QuoteEndorsementsClient. Changes: - jwt_key_auto_refresh.h: inherit enable_shared_from_this, add send_curl_get() helper with CURLOPT_CAINFO_BLOB CA bundle support, migrate both metadata and JWKS fetches to curl with task-deferred response callbacks - node_state.h: remove rpcsessions parameter from JwtKeyAutoRefresh constructor call - CHANGELOG.md: add [Unreleased] entry for this change Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
The JWT issuer test server creates TLS certs using generate_cert which
hashes the CN (e.g. sha256("localhost")), so libcurl's hostname
verification fails when connecting to the server because neither the CN
nor any SAN matches the actual hostname.
Add an optional `san` parameter to `generate_cert` that, when provided,
adds a DNS Subject Alternative Name extension to the certificate. Update
JwtIssuer._generate_auth_data to pass the hostname as the SAN so that
libcurl can successfully verify the server certificate.
Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
|
@copilot look at the test failures to improve your change. |
…etrics Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Fixed three CI failures in commit
|
Use HTTPS-only curl requests with bounded timeouts for JWT/JWK auto-refresh, and add coverage for connection and TLS refresh failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Normalize the parsed jwks_uri scheme before enforcing HTTPS-only refreshes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Migrates JWT/JWK auto-refresh outbound HTTP fetches away from the legacy
RPCSessions::create_client()path and ontoccf::curl::CurlRequestattached toCurlmLibuvContextSingleton, following the curl multi singleton direction introduced in #7102.Core changes
src/node/jwt_key_auto_refresh.hRPCSessionsdependency fromJwtKeyAutoRefresh.send_refresh_jwt_keys_error(), so refresh failure metrics include network-level fetch failures.src/node/node_state.hJwtKeyAutoRefreshwithout passingrpcsessions.Metadata and JWKS hardening
issuerconstraints inside the metadata parse error path, so malformed/non-string values are recorded as refresh failures rather than escaping the task.SetJwtPublicSigningKeysrequest.jwks_uribefore handing it to curl:Tests
Adds/updates JWT auto-refresh coverage for:
jwks_urirejectionValidated locally:
scripts/cpp-format-checks.shscripts/python-format-checks.shscripts/python-lint-checks.shcd build && ninja jwt_auth_test js_generic curl_test loggingcd build && ./tests.sh -VV -R 'jwt_auth_test|programmability_and_jwt'cd build && ninja