Skip to content

Commit 94682da

Browse files
committed
fix: increase broker JWT TTL to 10 years to prevent ExpiredSignature errors
Long-running validator tasks were failing with 'Unauthorized: ExpiredSignature' after the 1-hour JWT token expired. Increasing TTL to 10 years effectively makes tokens valid for the container's lifetime. Also fixes clippy warnings in docker.rs.
1 parent cc4552c commit 94682da

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

crates/challenge-orchestrator/src/docker.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl DockerClient {
338338
// Priority: user-defined bridge > any bridge > host
339339
let mut best_network: Option<String> = None;
340340

341-
for (name, _settings) in networks {
341+
for name in networks.keys() {
342342
// Skip host and none networks
343343
if name == "host" || name == "none" {
344344
continue;
@@ -919,10 +919,13 @@ impl DockerClient {
919919
let challenge_id = config.name.to_string();
920920
let owner_id = std::env::var("VALIDATOR_HOTKEY").unwrap_or_else(|_| "unknown".to_string());
921921

922-
// Use secure_container_runtime to generate token (3600s = 1 hour TTL)
923-
if let Ok(token) =
924-
secure_container_runtime::generate_token(&challenge_id, &owner_id, &jwt_secret, 3600)
925-
{
922+
// Use secure_container_runtime to generate token (10 years TTL - effectively infinite for container lifetime)
923+
if let Ok(token) = secure_container_runtime::generate_token(
924+
&challenge_id,
925+
&owner_id,
926+
&jwt_secret,
927+
315360000,
928+
) {
926929
env.push(format!("CONTAINER_BROKER_JWT={}", token));
927930
debug!(challenge = %config.name, "Generated broker JWT token");
928931
} else {
@@ -1134,8 +1137,10 @@ impl DockerClient {
11341137
let mut result = CleanupResult::default();
11351138

11361139
// List ALL containers (including stopped)
1137-
let mut options: ListContainersOptions<String> = Default::default();
1138-
options.all = true;
1140+
let options: ListContainersOptions<String> = ListContainersOptions {
1141+
all: true,
1142+
..Default::default()
1143+
};
11391144

11401145
let containers = self
11411146
.docker

0 commit comments

Comments
 (0)