Skip to content

Commit 5ce8852

Browse files
CopilotachamayouCopilot
authored
Migrate JWT/JWK auto-refresh from RPCSessions to curl multi singleton (#7989)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com> Co-authored-by: Amaury Chamayou <amaury@xargs.fr> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5258236 commit 5ce8852

21 files changed

Lines changed: 592 additions & 312 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [7.0.7]
9+
10+
[7.0.7]: https://github.com/microsoft/CCF/releases/tag/ccf-7.0.7
11+
12+
### Changed
13+
14+
- JWT/JWK auto-refresh outbound HTTP fetches (OpenID metadata and JWKS) now use the curl multi singleton client introduced in #7102, replacing the previous `RPCSessions::create_client()` path. Connection and TLS failures are now counted in refresh failure metrics via `send_refresh_jwt_keys_error()`, improving observability of network-level refresh errors (#7989).
15+
- JWT/JWK auto-refresh now supports configuring the maximum response body size for fetched OpenID metadata and JWKS via the `jwt.key_refresh_max_response_size` node startup config setting (#7989).
16+
817
## [7.0.6]
918

1019
[7.0.6]: https://github.com/microsoft/CCF/releases/tag/ccf-7.0.6

doc/build_apps/auth/jwt.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Now the issuer can be created with auto-refresh enabled:
107107
108108
.. note::
109109

110-
The key refresh interval is set via the ``jwt.key_refresh_interval_s`` configuration entry, where the default is 30 min (1800 seconds).
110+
The key refresh interval is set via the ``jwt.key_refresh_interval`` configuration entry, where the default is 30 min (1800 seconds). The maximum response body size accepted when fetching OpenID metadata and JWKS is set via ``jwt.key_refresh_max_response_size``, where the default is 1 MB.
111111

112112
Removing a token issuer
113113
-----------------------

doc/dev/jwk_refresh_curl_multi_migration_plan.md

Lines changed: 0 additions & 182 deletions
This file was deleted.

doc/host_config_schema/host_config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,11 @@
653653
"type": "string",
654654
"default": "30min",
655655
"description": "Interval at which JWT keys for issuers registered with auto-refresh are automatically refreshed"
656+
},
657+
"key_refresh_max_response_size": {
658+
"type": "string",
659+
"default": "1MB",
660+
"description": "Maximum response body size accepted when fetching OpenID metadata and JWKS for JWT issuer auto-refresh"
656661
}
657662
},
658663
"description": "This section includes configuration for JWT issuers automatic refresh",

include/ccf/node/startup_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ namespace ccf
6565
struct JWT
6666
{
6767
ccf::ds::TimeString key_refresh_interval = {"30min"};
68+
ccf::ds::SizeString key_refresh_max_response_size = {"1MB"};
6869

6970
bool operator==(const JWT&) const = default;
7071
};

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ccf"
7-
version = "7.0.6"
7+
version = "7.0.7"
88
authors = [
99
{ name="CCF Team", email="CCF-Sec@microsoft.com" },
1010
]

samples/constitutions/default/actions.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,10 @@ function checkReconfigurationType(config, new_config) {
505505
const from = config.reconfiguration_type;
506506
const to = new_config.reconfiguration_type;
507507
if (from !== to && to !== undefined) {
508-
if (
509-
!(
510-
(from === undefined || from === "OneTransaction") &&
511-
to === "TwoTransaction"
512-
)
513-
) {
508+
if (!(
509+
(from === undefined || from === "OneTransaction") &&
510+
to === "TwoTransaction"
511+
)) {
514512
throw new Error(
515513
`Cannot change reconfiguration type from ${from} to ${to}.`,
516514
);

samples/minimal_ccf/app/actions.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,10 @@ function checkReconfigurationType(config, new_config) {
485485
const from = config.reconfiguration_type;
486486
const to = new_config.reconfiguration_type;
487487
if (from !== to && to !== undefined) {
488-
if (
489-
!(
490-
(from === undefined || from === "OneTransaction") &&
491-
to === "TwoTransaction"
492-
)
493-
) {
488+
if (!(
489+
(from === undefined || from === "OneTransaction") &&
490+
to === "TwoTransaction"
491+
)) {
494492
throw new Error(
495493
`Cannot change reconfiguration type from ${from} to ${to}.`,
496494
);

src/common/configuration.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ namespace ccf
7373

7474
DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(CCFConfig::JWT);
7575
DECLARE_JSON_REQUIRED_FIELDS(CCFConfig::JWT);
76-
DECLARE_JSON_OPTIONAL_FIELDS(CCFConfig::JWT, key_refresh_interval);
76+
DECLARE_JSON_OPTIONAL_FIELDS(
77+
CCFConfig::JWT, key_refresh_interval, key_refresh_max_response_size);
7778

7879
DECLARE_JSON_TYPE_WITH_OPTIONAL_FIELDS(CCFConfig::Attestation::Environment);
7980
DECLARE_JSON_REQUIRED_FIELDS(CCFConfig::Attestation::Environment);

0 commit comments

Comments
 (0)