From 2e0ad7fc093a550da69b17cd5cf4894e0d0355b9 Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Thu, 19 Nov 2026 22:48:45 -0500 Subject: [PATCH 1/8] acceptance: read the probe key from a file An issuer that binds each key to one identity needs a new key per run, minted with its NIP-FI assertion before the probe starts. The probe now takes --private-key-file (BUZZ_PRIVATE_KEY_FILE), and the chart passes acceptance.privateKeyFile to it. The key file shares the assertion file's bounded read: a regular, non-empty file, capped in size, and never a blocking FIFO open. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- crates/buzz-test-client/src/acceptance/mod.rs | 68 +++++++++++-------- crates/buzz-test-client/src/bin/acceptance.rs | 23 ++++++- .../buzz-test-client/tests/e2e_acceptance.rs | 68 +++++++++++++++++-- deploy/charts/buzz/README.md | 18 +++-- deploy/charts/buzz/templates/_validate.tpl | 7 +- .../buzz/templates/acceptance-cronjob.yaml | 3 + deploy/charts/buzz/tests/acceptance_test.yaml | 36 ++++++++++ deploy/charts/buzz/values.schema.json | 1 + deploy/charts/buzz/values.yaml | 4 ++ 9 files changed, 183 insertions(+), 45 deletions(-) diff --git a/crates/buzz-test-client/src/acceptance/mod.rs b/crates/buzz-test-client/src/acceptance/mod.rs index a9913434ea6..c4e4227a8f0 100644 --- a/crates/buzz-test-client/src/acceptance/mod.rs +++ b/crates/buzz-test-client/src/acceptance/mod.rs @@ -16,7 +16,7 @@ pub mod metrics; use std::future::Future; use std::io::Read; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::time::{Duration, Instant}; use anyhow::{anyhow, bail, Context}; @@ -633,35 +633,7 @@ async fn wait_for_eose( fn upgrade_headers(cfg: &Config) -> anyhow::Result { let mut headers = HeaderMap::new(); if let Some(path) = &cfg.assertion_file { - let invalid = || { - anyhow!( - "assertion file {} must be a regular file of at most {MAX_ASSERTION_BYTES} bytes", - path.display() - ) - }; - let read = || -> std::io::Result> { - // Check before opening: opening a FIFO blocks until a writer - // appears, and no async timeout can interrupt that. - if !std::fs::metadata(path)?.is_file() { - return Ok(None); - } - let file = std::fs::File::open(path)?; - if !file.metadata()?.is_file() { - return Ok(None); - } - // Cap the read on the open file: it may grow after the check. - let mut assertion = String::new(); - file.take(MAX_ASSERTION_BYTES + 1) - .read_to_string(&mut assertion)?; - Ok((assertion.len() as u64 <= MAX_ASSERTION_BYTES).then_some(assertion)) - }; - let assertion = read() - .with_context(|| format!("read assertion file {}", path.display()))? - .ok_or_else(invalid)?; - let assertion = assertion.trim(); - if assertion.is_empty() { - bail!("assertion file {} is empty", path.display()); - } + let assertion = read_secret_file(path, "assertion file", MAX_ASSERTION_BYTES)?; let mut value = HeaderValue::from_str(&format!("Bearer {assertion}")) .map_err(|_| anyhow!("assertion file {} is not a header value", path.display()))?; value.set_sensitive(true); @@ -670,6 +642,42 @@ fn upgrade_headers(cfg: &Config) -> anyhow::Result { Ok(headers) } +/// Reads a small secret another process writes, such as a key or an +/// assertion, and returns it without surrounding whitespace. +/// +/// The file must be a regular, non-empty file of at most `max_bytes`. +/// A FIFO or directory fails at once rather than blocking the run. +pub fn read_secret_file(path: &Path, what: &str, max_bytes: u64) -> anyhow::Result { + let read = || -> std::io::Result> { + // Check before opening: opening a FIFO blocks until a writer + // appears, and no async timeout can interrupt that. + if !std::fs::metadata(path)?.is_file() { + return Ok(None); + } + let file = std::fs::File::open(path)?; + if !file.metadata()?.is_file() { + return Ok(None); + } + // Cap the read on the open file: it may grow after the check. + let mut text = String::new(); + file.take(max_bytes + 1).read_to_string(&mut text)?; + Ok((text.len() as u64 <= max_bytes).then_some(text)) + }; + let text = read() + .with_context(|| format!("read {what} {}", path.display()))? + .ok_or_else(|| { + anyhow!( + "{what} {} must be a regular file of at most {max_bytes} bytes", + path.display() + ) + })?; + let text = text.trim(); + if text.is_empty() { + bail!("{what} {} is empty", path.display()); + } + Ok(text.to_owned()) +} + /// The relay's HTTP base for `ws_url`: `wss` becomes `https`, `ws` `http`. fn http_url(ws_url: &str) -> anyhow::Result { let mut url = url::Url::parse(ws_url).with_context(|| format!("parse {ws_url}"))?; diff --git a/crates/buzz-test-client/src/bin/acceptance.rs b/crates/buzz-test-client/src/bin/acceptance.rs index ae374751dc8..2f0f5e27dc8 100644 --- a/crates/buzz-test-client/src/bin/acceptance.rs +++ b/crates/buzz-test-client/src/bin/acceptance.rs @@ -4,7 +4,8 @@ //! check failed, and 2 when the probe itself could not run or report. //! //! Usage: -//! buzz-acceptance --relay-url wss://relay.example [--assertion-file ] +//! buzz-acceptance --relay-url wss://relay.example +//! [--private-key | --private-key-file ] [--assertion-file ] //! [--statsd-addr 127.0.0.1:8125] [--tag env:staging]... use std::net::SocketAddr; @@ -16,6 +17,9 @@ use buzz_test_client::acceptance::{self, metrics, Config}; use clap::Parser; use nostr::Keys; +/// The largest key file the probe reads. An nsec is 63 bytes. +const MAX_KEY_FILE_BYTES: u64 = 1024; + /// The longest resolving the metrics address or sending the metrics may take. const METRICS_TIMEOUT: Duration = Duration::from_secs(5); @@ -32,6 +36,10 @@ struct Cli { /// probe uses a new key, which works only on a relay that admits any key. #[arg(long, env = "BUZZ_PRIVATE_KEY", hide_env_values = true)] private_key: Option, + /// File holding the secret key (hex or nsec), for a key another process + /// writes, such as one minted with its NIP-FI assertion before the run. + #[arg(long, env = "BUZZ_PRIVATE_KEY_FILE", conflicts_with = "private_key")] + private_key_file: Option, /// File holding a NIP-FI assertion for the key, read before every /// connection. Keep it fresh from another process. #[arg(long, env = "BUZZ_ACCEPTANCE_ASSERTION_FILE")] @@ -84,8 +92,17 @@ fn main() -> ExitCode { /// Runs the probe, prints its report and sends its metrics. Returns whether /// every check passed. async fn probe(cli: Cli) -> anyhow::Result { - let keys = match &cli.private_key { - Some(key) => Keys::parse(key).map_err(|e| anyhow::anyhow!("private key: {e}"))?, + let key = match (&cli.private_key, &cli.private_key_file) { + (Some(key), _) => Some(key.clone()), + (None, Some(path)) => Some(acceptance::read_secret_file( + path, + "private key file", + MAX_KEY_FILE_BYTES, + )?), + (None, None) => None, + }; + let keys = match key { + Some(key) => Keys::parse(&key).map_err(|e| anyhow::anyhow!("private key: {e}"))?, None => Keys::generate(), }; let statsd = match &cli.statsd_addr { diff --git a/crates/buzz-test-client/tests/e2e_acceptance.rs b/crates/buzz-test-client/tests/e2e_acceptance.rs index 41b04d2a48c..830387ed583 100644 --- a/crates/buzz-test-client/tests/e2e_acceptance.rs +++ b/crates/buzz-test-client/tests/e2e_acceptance.rs @@ -152,8 +152,68 @@ fn the_binary_exits_1_and_reports_when_a_check_fails() { #[test] #[ignore] fn the_binary_exits_2_when_it_cannot_run() { - let (output, lines) = probe(&["--relay-url", &relay_url(), "--private-key", "not-a-key"]); - assert_eq!(output.status.code(), Some(2)); - assert!(output.stdout.is_empty()); - assert!(lines.is_empty(), "{lines:?}"); + let dir = std::env::temp_dir().join(format!("acceptance-key-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).unwrap(); + let bad_key_file = dir.join("bad-key"); + std::fs::write(&bad_key_file, "not-a-key\n").unwrap(); + let bad_key_file = bad_key_file.to_str().unwrap(); + let missing_key_file = dir.join("missing"); + let missing_key_file = missing_key_file.to_str().unwrap(); + let relay = relay_url(); + + // Each case must stop before the run: no report, no metrics. + let cases: [(&[&str], &str); 4] = [ + (&["--private-key", "not-a-key"], "private key:"), + // The key file is read and parsed, not ignored for a new key. + (&["--private-key-file", bad_key_file], "private key:"), + ( + &["--private-key-file", missing_key_file], + "read private key file", + ), + ( + &[ + "--private-key", + "not-a-key", + "--private-key-file", + bad_key_file, + ], + "cannot be used with", + ), + ]; + for (extra, error) in cases { + let mut args = vec!["--relay-url", relay.as_str()]; + args.extend_from_slice(extra); + let (output, lines) = probe(&args); + let stderr = String::from_utf8_lossy(&output.stderr); + assert_eq!(output.status.code(), Some(2), "{extra:?}: {stderr}"); + assert!(stderr.contains(error), "{extra:?}: {stderr}"); + assert!(output.stdout.is_empty(), "{extra:?}"); + assert!(lines.is_empty(), "{extra:?}: {lines:?}"); + } + std::fs::remove_dir_all(dir).unwrap(); +} + +#[test] +#[ignore] +fn the_binary_passes_with_a_key_from_a_file() { + let dir = std::env::temp_dir().join(format!("acceptance-key-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).unwrap(); + let key_file = dir.join("key"); + let keys = Keys::generate(); + std::fs::write( + &key_file, + format!("{}\n", keys.secret_key().to_secret_hex()), + ) + .unwrap(); + + let (output, _) = probe(&[ + "--relay-url", + &relay_url(), + "--private-key-file", + key_file.to_str().unwrap(), + ]); + let report = report(&output); + assert_eq!(output.status.code(), Some(0), "{report}"); + assert_eq!(report["passed"], true); + std::fs::remove_dir_all(dir).unwrap(); } diff --git a/deploy/charts/buzz/README.md b/deploy/charts/buzz/README.md index 3f20f9b7263..592eb17204e 100644 --- a/deploy/charts/buzz/README.md +++ b/deploy/charts/buzz/README.md @@ -528,10 +528,11 @@ image predates the probe. - The probe connects to `acceptance.relayUrl`, or to `relayUrl` when that is empty. Each run creates one private channel with a 1 h TTL and deletes it. - `acceptance.privateKeySecret.name` names a Secret with the probe's key - (hex or nsec). It is required: the chart fails to render without it. A new - key per run would fail on a members-only relay, and an open relay would - join each new key to every auto-join channel. On a members-only relay, make - the key a relay member first. + (hex or nsec), or `acceptance.privateKeyFile` names a file an init + container writes. Set exactly one: the chart fails to render with neither. + Without a key the probe would sign with a new key each run, which a + members-only relay refuses and an open relay joins to every auto-join + channel. On a members-only relay, make the key a relay member first. - `acceptance.statsdAddr` sends DogStatsD metrics under `acceptance.metricPrefix` (`.runs`, `.run.seconds`, `.check.runs`, `.check.seconds`, `.stage.seconds`). @@ -562,8 +563,13 @@ key. Minting one is deployment-specific, so the chart takes it as a file: an init container writes it to a shared volume and `acceptance.assertionFile` points the probe at it. The probe re-reads the file before every connection. The assertion must name the probe's key, so the init container needs the same -key Secret. Keep the Pod's `runAsUser` in the init container, so the probe can -read files the minter writes with mode 0600. +key. Keep the Pod's `runAsUser` in the init container, so the probe can read +files the minter writes with mode 0600. When the issuer binds each key to one +identity, the init container can also write a new key for each run to +`acceptance.privateKeyFile`. A new key per run needs an agent assertion +(`nip-fi-agent+jwt` whose `nostr_owner_pubkey` is a relay member): a +members-only relay refuses a new person key, and an open relay joins it to +every auto-join channel. ```yaml image: diff --git a/deploy/charts/buzz/templates/_validate.tpl b/deploy/charts/buzz/templates/_validate.tpl index 99e00ea4a39..3dd00265f1c 100644 --- a/deploy/charts/buzz/templates/_validate.tpl +++ b/deploy/charts/buzz/templates/_validate.tpl @@ -35,8 +35,11 @@ surface at template time regardless of which manifest helm renders first. {{- if not (or .Values.image.tag .Values.image.digest) -}} {{- fail "acceptance.enabled requires image.tag or image.digest: the probe binary is not in the chart's default appVersion image." -}} {{- end -}} - {{- if not .Values.acceptance.privateKeySecret.name -}} - {{- fail "acceptance.enabled requires acceptance.privateKeySecret.name: without a key the probe signs with a new key each run, which a members-only relay refuses and an open relay joins to every auto-join channel." -}} + {{- if and .Values.acceptance.privateKeySecret.name .Values.acceptance.privateKeyFile -}} + {{- fail "acceptance: set privateKeySecret.name or privateKeyFile, not both." -}} + {{- end -}} + {{- if not (or .Values.acceptance.privateKeySecret.name .Values.acceptance.privateKeyFile) -}} + {{- fail "acceptance.enabled requires acceptance.privateKeySecret.name or acceptance.privateKeyFile: without a key the probe signs with a new key each run, which a members-only relay refuses and an open relay joins to every auto-join channel." -}} {{- end -}} {{- $seen := dict -}} {{- range .Values.acceptance.tags -}} diff --git a/deploy/charts/buzz/templates/acceptance-cronjob.yaml b/deploy/charts/buzz/templates/acceptance-cronjob.yaml index af788e96de0..950c64b41a8 100644 --- a/deploy/charts/buzz/templates/acceptance-cronjob.yaml +++ b/deploy/charts/buzz/templates/acceptance-cronjob.yaml @@ -80,6 +80,9 @@ spec: {{- with $a.statsdAddr }} - { name: BUZZ_ACCEPTANCE_STATSD_ADDR, value: {{ . | quote }} } {{- end }} + {{- with $a.privateKeyFile }} + - { name: BUZZ_PRIVATE_KEY_FILE, value: {{ . | quote }} } + {{- end }} {{- with $a.assertionFile }} - { name: BUZZ_ACCEPTANCE_ASSERTION_FILE, value: {{ . | quote }} } {{- end }} diff --git a/deploy/charts/buzz/tests/acceptance_test.yaml b/deploy/charts/buzz/tests/acceptance_test.yaml index f8ea12aa32f..156d6e17f1a 100644 --- a/deploy/charts/buzz/tests/acceptance_test.yaml +++ b/deploy/charts/buzz/tests/acceptance_test.yaml @@ -85,6 +85,11 @@ tests: content: name: BUZZ_ACCEPTANCE_ASSERTION_FILE any: true + - notContains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: BUZZ_PRIVATE_KEY_FILE + any: true # The probe needs no Kubernetes or cloud access: no relay service # account, no token. - notExists: @@ -265,6 +270,37 @@ tests: - failedTemplate: errorPattern: "acceptance.enabled requires image.tag or image.digest" + - it: reads a key an init container writes + set: + image.tag: "1.2.3" + acceptance: + enabled: true + privateKeyFile: /var/run/assertion/key + assertionFile: /var/run/assertion/token + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: BUZZ_PRIVATE_KEY_FILE + value: /var/run/assertion/key + - notContains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: BUZZ_PRIVATE_KEY + any: true + + - it: rejects both a key Secret and a key file + set: + image.tag: "1.2.3" + acceptance: + enabled: true + privateKeySecret: + name: buzz-acceptance-key + privateKeyFile: /var/run/assertion/key + asserts: + - failedTemplate: + errorPattern: "set privateKeySecret.name or privateKeyFile, not both" + - it: rejects a tag without a key set: image.tag: "1.2.3" diff --git a/deploy/charts/buzz/values.schema.json b/deploy/charts/buzz/values.schema.json index 5f9917f0f32..3cd423ed9c2 100644 --- a/deploy/charts/buzz/values.schema.json +++ b/deploy/charts/buzz/values.schema.json @@ -236,6 +236,7 @@ "key": { "type": "string", "minLength": 1 } } }, + "privateKeyFile": { "type": "string" }, "assertionFile": { "type": "string" }, "statsdAddr": { "type": "string" }, "metricPrefix": { "type": "string", "minLength": 1 }, diff --git a/deploy/charts/buzz/values.yaml b/deploy/charts/buzz/values.yaml index f475a6aeeea..51374ef300b 100644 --- a/deploy/charts/buzz/values.yaml +++ b/deploy/charts/buzz/values.yaml @@ -420,6 +420,10 @@ acceptance: privateKeySecret: name: "" key: BUZZ_PRIVATE_KEY + # Key file path in the probe container, for a key an init container writes + # with its assertion (for example one new identity per run). Use this or + # privateKeySecret, not both. + privateKeyFile: "" # NIP-FI assertion path in the probe container. Pair with extraInitContainers, # extraVolumes and extraVolumeMounts to mint it before the run. assertionFile: "" From a3c1cdb86f92004080dfea18fa03fc5394f4a153 Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Thu, 19 Nov 2026 22:56:03 -0500 Subject: [PATCH 2/8] acceptance: report the probe's pubkey; pin the key file end to end The JSON report now names the public key the run authenticated as. The key-file test passes the path through BUZZ_PRIVATE_KEY_FILE, as the chart does, and checks that the run used that key, so a probe that ignored the file fails it. The test launcher no longer inherits the probe's settings from the caller's environment. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- .../src/acceptance/metrics.rs | 1 + crates/buzz-test-client/src/acceptance/mod.rs | 3 +++ .../buzz-test-client/tests/e2e_acceptance.rs | 25 +++++++++++++------ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/crates/buzz-test-client/src/acceptance/metrics.rs b/crates/buzz-test-client/src/acceptance/metrics.rs index 7eebc6967c4..14476c13ac9 100644 --- a/crates/buzz-test-client/src/acceptance/metrics.rs +++ b/crates/buzz-test-client/src/acceptance/metrics.rs @@ -121,6 +121,7 @@ mod tests { fn report() -> Report { Report { relay_url: "wss://relay.example".into(), + pubkey: "00".repeat(32), relay_version: Some("1.2.3".into()), passed: false, seconds: 1.5, diff --git a/crates/buzz-test-client/src/acceptance/mod.rs b/crates/buzz-test-client/src/acceptance/mod.rs index c4e4227a8f0..7a2bc66e47e 100644 --- a/crates/buzz-test-client/src/acceptance/mod.rs +++ b/crates/buzz-test-client/src/acceptance/mod.rs @@ -71,6 +71,8 @@ pub struct Config { pub struct Report { /// The relay the run checked. pub relay_url: String, + /// The public key (hex) the run authenticated and signed as. + pub pubkey: String, /// The relay's NIP-11 `version`, when it reported one. pub relay_version: Option, /// True when no check failed. @@ -234,6 +236,7 @@ pub async fn run(cfg: &Config) -> Report { Report { relay_url: cfg.relay_url.clone(), + pubkey: cfg.keys.public_key().to_hex(), relay_version, passed: checks.iter().all(|c| c.result != Outcome::Failure), seconds: started.elapsed().as_secs_f64(), diff --git a/crates/buzz-test-client/tests/e2e_acceptance.rs b/crates/buzz-test-client/tests/e2e_acceptance.rs index 830387ed583..25ca22196d5 100644 --- a/crates/buzz-test-client/tests/e2e_acceptance.rs +++ b/crates/buzz-test-client/tests/e2e_acceptance.rs @@ -43,6 +43,12 @@ async fn every_acceptance_check_passes_against_a_live_relay() { /// Runs the binary with `args`, metrics sent to a local listener. Returns /// its output and every datagram that arrived. fn probe(args: &[&str]) -> (Output, Vec) { + probe_with_env(args, &[]) +} + +/// [`probe`] with extra environment variables. The child inherits none of the +/// probe's own settings from the test's environment. +fn probe_with_env(args: &[&str], envs: &[(&str, &str)]) -> (Output, Vec) { let agent = UdpSocket::bind("127.0.0.1:0").unwrap(); agent .set_read_timeout(Some(Duration::from_millis(500))) @@ -52,7 +58,11 @@ fn probe(args: &[&str]) -> (Output, Vec) { .args(args) .args(["--statsd-addr", &addr, "--tag", "env:test"]) .env_remove("BUZZ_PRIVATE_KEY") + .env_remove("BUZZ_PRIVATE_KEY_FILE") + .env_remove("BUZZ_ACCEPTANCE_ASSERTION_FILE") + .env_remove("BUZZ_ACCEPTANCE_STATSD_ADDR") .env_remove("BUZZ_RELAY_URL") + .envs(envs.iter().copied()) .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() @@ -195,7 +205,7 @@ fn the_binary_exits_2_when_it_cannot_run() { #[test] #[ignore] -fn the_binary_passes_with_a_key_from_a_file() { +fn the_binary_authenticates_with_the_key_from_its_key_file() { let dir = std::env::temp_dir().join(format!("acceptance-key-{}", uuid::Uuid::new_v4())); std::fs::create_dir_all(&dir).unwrap(); let key_file = dir.join("key"); @@ -206,14 +216,15 @@ fn the_binary_passes_with_a_key_from_a_file() { ) .unwrap(); - let (output, _) = probe(&[ - "--relay-url", - &relay_url(), - "--private-key-file", - key_file.to_str().unwrap(), - ]); + // The chart passes the path through the environment, so this does too. + let (output, _) = probe_with_env( + &["--relay-url", &relay_url()], + &[("BUZZ_PRIVATE_KEY_FILE", key_file.to_str().unwrap())], + ); let report = report(&output); assert_eq!(output.status.code(), Some(0), "{report}"); assert_eq!(report["passed"], true); + // A probe that ignored the file would run as a new key. + assert_eq!(report["pubkey"], keys.public_key().to_hex(), "{report}"); std::fs::remove_dir_all(dir).unwrap(); } From bf31b8bba3ee8b9fef97dbde02954bfe2135e655 Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Fri, 20 Nov 2026 13:54:07 -0500 Subject: [PATCH 3/8] deploy: accept a key file as the probe key; bump the chart to 0.1.13 - The chart requires exactly one key source: privateKeySecret.name or privateKeyFile. - README and values: a new key per run needs an agent assertion whose owner is a relay member. A members-only relay refuses a new person key, and an open relay joins it to every auto-join channel. - The --private-key help says a new key is used only with no key file. - Chart 0.1.13 publishes the acceptance CronJob from #9771 and the key file from this PR. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- crates/buzz-test-client/src/bin/acceptance.rs | 5 +++-- deploy/charts/buzz/Chart.yaml | 6 +++--- deploy/charts/buzz/values.yaml | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/crates/buzz-test-client/src/bin/acceptance.rs b/crates/buzz-test-client/src/bin/acceptance.rs index 2f0f5e27dc8..8128778b197 100644 --- a/crates/buzz-test-client/src/bin/acceptance.rs +++ b/crates/buzz-test-client/src/bin/acceptance.rs @@ -32,8 +32,9 @@ struct Cli { /// The relay's WebSocket URL. #[arg(long, env = "BUZZ_RELAY_URL")] relay_url: String, - /// Secret key (hex or nsec) to authenticate and sign as. Without one the - /// probe uses a new key, which works only on a relay that admits any key. + /// Secret key (hex or nsec) to authenticate and sign as. Without this or + /// a key file the probe uses a new key, which works only on a relay that + /// admits any key. #[arg(long, env = "BUZZ_PRIVATE_KEY", hide_env_values = true)] private_key: Option, /// File holding the secret key (hex or nsec), for a key another process diff --git a/deploy/charts/buzz/Chart.yaml b/deploy/charts/buzz/Chart.yaml index a3c0f98dd76..a676e87621f 100644 --- a/deploy/charts/buzz/Chart.yaml +++ b/deploy/charts/buzz/Chart.yaml @@ -7,7 +7,7 @@ description: | PostgreSQL and Redis. Configurable for single-node evaluation (subcharts on) and HA production (external services, existingSecret). type: application -version: 0.1.12 +version: 0.1.13 appVersion: "0.3.0" home: https://github.com/block/buzz sources: @@ -23,8 +23,8 @@ maintainers: url: https://github.com/block annotations: artifacthub.io/changes: | - - kind: changed - description: Default the relay image to release 0.3.0. + - kind: added + description: Optional acceptance probe CronJob (acceptance.enabled) that runs buzz-acceptance from the relay image, with its key from a Secret or a file. artifacthub.io/license: Apache-2.0 # Optional eval-only subcharts. Production deploys disable both and point diff --git a/deploy/charts/buzz/values.yaml b/deploy/charts/buzz/values.yaml index 51374ef300b..40da6029a1f 100644 --- a/deploy/charts/buzz/values.yaml +++ b/deploy/charts/buzz/values.yaml @@ -415,14 +415,15 @@ acceptance: # above 13 × stageTimeoutSeconds + 30 s plus pull and init time: a run killed # at the deadline sends no metrics. stageTimeoutSeconds: 10 - # Secret holding the probe's key (hex or nsec). Required when enabled. On a - # members-only relay the key must be a relay member. + # Secret holding the probe's key (hex or nsec). Set this or privateKeyFile + # (exactly one) when enabled. On a members-only relay the key must be a + # relay member. privateKeySecret: name: "" key: BUZZ_PRIVATE_KEY # Key file path in the probe container, for a key an init container writes - # with its assertion (for example one new identity per run). Use this or - # privateKeySecret, not both. + # with its assertion (for example one new identity per run, which needs an + # agent assertion; see README). Set this or privateKeySecret, not both. privateKeyFile: "" # NIP-FI assertion path in the probe container. Pair with extraInitContainers, # extraVolumes and extraVolumeMounts to mint it before the run. From c35da38346be9719c34e883aaa20fa8ab554111b Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Fri, 20 Nov 2026 15:16:49 -0500 Subject: [PATCH 4/8] acceptance: fail access_control when the relay accepts another key's write The fake relay gets an accept_mismatched setting. A new test expects access_control to fail at pubkey_mismatch_rejected when the relay accepts a write signed by a key other than the authenticated one, so a pubkey_mismatch_rejected stage that always returns Ok now fails a test. Test patch from McKeon's review of #9767. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- .../src/acceptance/fake_relay.rs | 5 +++- crates/buzz-test-client/src/acceptance/mod.rs | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/crates/buzz-test-client/src/acceptance/fake_relay.rs b/crates/buzz-test-client/src/acceptance/fake_relay.rs index d42e00353e3..13a051be943 100644 --- a/crates/buzz-test-client/src/acceptance/fake_relay.rs +++ b/crates/buzz-test-client/src/acceptance/fake_relay.rs @@ -33,6 +33,8 @@ pub struct Script { pub close_after: HashSet, /// The answer to a write without AUTH. pub unauthenticated: Unauthenticated, + /// Accept a write signed by a key other than the authenticated one. + pub accept_mismatched: bool, /// Serve events of these kinds, stored and live, with altered content /// under their original id and signature. pub corrupt: HashSet, @@ -45,6 +47,7 @@ impl Default for Script { no_ack: HashSet::new(), close_after: HashSet::new(), unauthenticated: Unauthenticated::Reason(format!("{AUTH_REQUIRED} not authenticated")), + accept_mismatched: false, corrupt: HashSet::new(), } } @@ -163,7 +166,7 @@ async fn serve(tcp: tokio::net::TcpStream, shared: Arc) { } continue; }; - if event.pubkey != pubkey { + if event.pubkey != pubkey && !shared.script.accept_mismatched { send(&out, json!(["OK", id, false, PUBKEY_MISMATCH])); continue; } diff --git a/crates/buzz-test-client/src/acceptance/mod.rs b/crates/buzz-test-client/src/acceptance/mod.rs index 7a2bc66e47e..31079e8213e 100644 --- a/crates/buzz-test-client/src/acceptance/mod.rs +++ b/crates/buzz-test-client/src/acceptance/mod.rs @@ -975,6 +975,33 @@ mod tests { } } + /// A relay that accepts a write signed by another key is not enforcing + /// the NIP-42 binding: `access_control` fails at `pubkey_mismatch_rejected`. + #[tokio::test] + async fn access_control_fails_when_the_relay_accepts_another_keys_write() { + let relay = fake_relay::start(fake_relay::Script { + accept_mismatched: true, + ..Default::default() + }) + .await; + let report = run(&config(relay.url.clone())).await; + let access = check(&report, "access_control"); + assert_eq!( + (access.result, access.failed_stage), + (Outcome::Failure, Some("pubkey_mismatch_rejected")), + "{access:?}" + ); + assert!( + access + .error + .as_deref() + .unwrap() + .contains("relay accepted the event"), + "{access:?}" + ); + assert_eq!(check(&report, "cleanup").result, Outcome::Success); + } + /// The create's OK never comes, but the relay stored it: the run fails /// at `channel_create`, skips what needed the channel, and still deletes /// that exact channel. From 9a415414f163f5b72e8c01da72ede81a81bd3b7c Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Fri, 20 Nov 2026 15:33:32 -0500 Subject: [PATCH 5/8] acceptance: dial the relay at a connect address A probe inside the relay's network may not be able to reach the relay's public host. The probe and the chart can now name a plaintext host:port to dial instead: - buzz-acceptance --connect-addr (BUZZ_ACCEPTANCE_CONNECT_ADDR) dials that address for every WebSocket connection and for the NIP-11 fetch. The relay URL still sets the Host header, the NIP-42 relay tag and the NIP-11 Host, so the relay serves the same community. - The chart sets it from acceptance.connectAddr. Empty, the default, keeps dialing the URL. - NostrWsConnection::connect_to_addr takes upgrade headers, so the probe's NIP-FI assertion header goes on this path too. Loadgen passes none. - The fake relay records each upgrade's Host and each AUTH relay tag. New tests pin both and the NIP-11 request's address and Host. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- .../src/acceptance/fake_relay.rs | 31 ++++- crates/buzz-test-client/src/acceptance/mod.rs | 127 ++++++++++++++---- crates/buzz-test-client/src/bin/acceptance.rs | 7 + crates/buzz-test-client/src/loadgen/net.rs | 5 +- .../buzz-test-client/tests/e2e_acceptance.rs | 1 + crates/buzz-ws-client/src/connection.rs | 25 ++-- deploy/charts/buzz/README.md | 5 + .../buzz/templates/acceptance-cronjob.yaml | 3 + deploy/charts/buzz/tests/acceptance_test.yaml | 11 ++ deploy/charts/buzz/values.schema.json | 1 + deploy/charts/buzz/values.yaml | 4 + 11 files changed, 180 insertions(+), 40 deletions(-) diff --git a/crates/buzz-test-client/src/acceptance/fake_relay.rs b/crates/buzz-test-client/src/acceptance/fake_relay.rs index 13a051be943..c675ada9780 100644 --- a/crates/buzz-test-client/src/acceptance/fake_relay.rs +++ b/crates/buzz-test-client/src/acceptance/fake_relay.rs @@ -11,6 +11,7 @@ use nostr::{Event, PublicKey}; use serde_json::{json, Value}; use tokio::net::TcpListener; use tokio::sync::mpsc; +use tokio_tungstenite::tungstenite::handshake::server::{Request, Response}; use tokio_tungstenite::tungstenite::Message; use super::{AUTH_REQUIRED, PUBKEY_MISMATCH}; @@ -72,6 +73,10 @@ struct Shared { events: Mutex>, /// Live subscriptions: subscription id and the connection to send to. live: Mutex>, + /// The `Host` header of every WebSocket upgrade, in order. + hosts: Mutex>, + /// The `relay` tag of every AUTH event, in order. + auth_relays: Mutex>, } /// A running scripted relay. @@ -86,6 +91,16 @@ impl FakeRelay { pub fn events(&self) -> Vec { self.shared.events.lock().unwrap().clone() } + + /// The `Host` header of every WebSocket upgrade so far, in order. + pub fn hosts(&self) -> Vec { + self.shared.hosts.lock().unwrap().clone() + } + + /// The `relay` tag of every AUTH event so far, in order. + pub fn auth_relays(&self) -> Vec { + self.shared.auth_relays.lock().unwrap().clone() + } } /// Starts a relay that follows `script` on a free local port. @@ -96,6 +111,8 @@ pub async fn start(script: Script) -> FakeRelay { script, events: Mutex::new(Vec::new()), live: Mutex::new(Vec::new()), + hosts: Mutex::new(Vec::new()), + auth_relays: Mutex::new(Vec::new()), }); let accept = shared.clone(); tokio::spawn(async move { @@ -106,9 +123,18 @@ pub async fn start(script: Script) -> FakeRelay { FakeRelay { url, shared } } +// The handshake callback's `Result` is fixed by tungstenite. +#[allow(clippy::result_large_err)] async fn serve(tcp: tokio::net::TcpStream, shared: Arc) { // A plain HTTP request (the NIP-11 fetch) fails the upgrade; that is fine. - let Ok(ws) = tokio_tungstenite::accept_async(tcp).await else { + let upgrade = + tokio_tungstenite::accept_hdr_async(tcp, |request: &Request, response: Response| { + let host = request.headers().get("host").and_then(|h| h.to_str().ok()); + let host = host.unwrap_or_default().to_owned(); + shared.hosts.lock().unwrap().push(host); + Ok(response) + }); + let Ok(ws) = upgrade.await else { return; }; let (mut sink, mut stream) = ws.split(); @@ -134,6 +160,9 @@ async fn serve(tcp: tokio::net::TcpStream, shared: Arc) { match msg.first().and_then(Value::as_str) { Some("AUTH") => { let event: Event = serde_json::from_value(msg[1].clone()).unwrap(); + let relay = event.tags.iter().find(|t| t.kind().to_string() == "relay"); + let relay = relay.and_then(|t| t.content()).unwrap_or_default(); + shared.auth_relays.lock().unwrap().push(relay.to_owned()); authed = Some(event.pubkey); send(&out, json!(["OK", event.id.to_hex(), true, ""])); } diff --git a/crates/buzz-test-client/src/acceptance/mod.rs b/crates/buzz-test-client/src/acceptance/mod.rs index 31079e8213e..2e549dec7de 100644 --- a/crates/buzz-test-client/src/acceptance/mod.rs +++ b/crates/buzz-test-client/src/acceptance/mod.rs @@ -57,6 +57,10 @@ pub const CHECKS: [&str; 8] = [ pub struct Config { /// The relay's WebSocket URL (`wss://…` or `ws://…`). pub relay_url: String, + /// A plaintext `host:port` to dial instead of the URL's host, such as the + /// relay's in-cluster service. `relay_url` still names the relay: it + /// supplies the `Host` header, the NIP-42 relay tag and the community. + pub connect_addr: Option, /// The identity the probe authenticates and signs as. pub keys: Keys, /// A file holding a NIP-FI assertion for `keys`. It is read again before @@ -278,9 +282,7 @@ async fn relay_info(cfg: &Config) -> (CheckReport, Option) { let mut check = Check::new("relay_info", cfg.stage_timeout); let result = check .stage("nip11", async { - let url = http_url(&cfg.relay_url)?; - let response = reqwest::Client::new() - .get(url) + let response = nip11_request(cfg)? .header("Accept", "application/nostr+json") .send() .await? @@ -301,14 +303,7 @@ async fn relay_info(cfg: &Config) -> (CheckReport, Option) { async fn connect_auth(cfg: &Config) -> (CheckReport, Option) { let mut check = Check::new("connect_auth", cfg.stage_timeout); let result = async { - let mut conn = check - .stage("ws_connect", async { - Ok( - NostrWsConnection::connect_with_headers(&cfg.relay_url, upgrade_headers(cfg)?) - .await?, - ) - }) - .await?; + let mut conn = check.stage("ws_connect", open(cfg)).await?; check .stage("nip42_auth", async { Ok(conn.authenticate(&cfg.keys, None).await?) @@ -384,13 +379,9 @@ async fn fanout(cfg: &Config, conn: &mut NostrWsConnection, channel: &str) -> Ch let result = async { let mut listener = check .stage("connect_second", async { - Ok(NostrWsConnection::connect_authenticated_with_headers( - &cfg.relay_url, - &cfg.keys, - None, - upgrade_headers(cfg)?, - ) - .await?) + let mut conn = open(cfg).await?; + conn.authenticate(&cfg.keys, None).await?; + Ok(conn) }) .await?; let result = fanout_on(&mut check, cfg, conn, &mut listener, channel).await; @@ -534,9 +525,7 @@ async fn access_control(cfg: &Config, conn: &mut NostrWsConnection, channel: &st check .stage("unauthenticated_rejected", async { let event = message(&cfg.keys, channel, "acceptance unauthenticated")?; - let mut anon = - NostrWsConnection::connect_with_headers(&cfg.relay_url, upgrade_headers(cfg)?) - .await?; + let mut anon = open(cfg).await?; let outcome = anon.send_event(event).await; let _ = anon.disconnect().await; denied(outcome, AUTH_REQUIRED) @@ -560,13 +549,9 @@ async fn cleanup(cfg: &Config, channel: &str) -> CheckReport { let result = async { let mut conn = check .stage("connect", async { - Ok(NostrWsConnection::connect_authenticated_with_headers( - &cfg.relay_url, - &cfg.keys, - None, - upgrade_headers(cfg)?, - ) - .await?) + let mut conn = open(cfg).await?; + conn.authenticate(&cfg.keys, None).await?; + Ok(conn) }) .await?; let result = check @@ -681,6 +666,31 @@ pub fn read_secret_file(path: &Path, what: &str, max_bytes: u64) -> anyhow::Resu Ok(text.to_owned()) } +/// Opens a connection to the relay without authenticating, at +/// `cfg.connect_addr` when one is set. +async fn open(cfg: &Config) -> anyhow::Result { + let headers = upgrade_headers(cfg)?; + Ok(match &cfg.connect_addr { + Some(addr) => NostrWsConnection::connect_to_addr(&cfg.relay_url, addr, headers).await?, + None => NostrWsConnection::connect_with_headers(&cfg.relay_url, headers).await?, + }) +} + +/// The NIP-11 request for the relay. With `cfg.connect_addr` it goes to that +/// address over plain HTTP, with the relay URL's host as the `Host` header, +/// so the relay serves the same community's document. +fn nip11_request(cfg: &Config) -> anyhow::Result { + let url = http_url(&cfg.relay_url)?; + let client = reqwest::Client::new(); + let Some(addr) = &cfg.connect_addr else { + return Ok(client.get(url)); + }; + let host = &url[url::Position::BeforeHost..url::Position::AfterPort]; + Ok(client + .get(format!("http://{addr}{}", url.path())) + .header(reqwest::header::HOST, host)) +} + /// The relay's HTTP base for `ws_url`: `wss` becomes `https`, `ws` `http`. fn http_url(ws_url: &str) -> anyhow::Result { let mut url = url::Url::parse(ws_url).with_context(|| format!("parse {ws_url}"))?; @@ -725,6 +735,7 @@ mod tests { fn config(relay_url: String) -> Config { Config { relay_url, + connect_addr: None, keys: Keys::generate(), assertion_file: None, stage_timeout: Duration::from_secs(2), @@ -830,6 +841,66 @@ mod tests { std::fs::remove_dir_all(dir).unwrap(); } + /// With a connect address the probe dials it, but every upgrade and + /// AUTH still names the relay URL, so the relay serves that community. + #[tokio::test] + async fn connect_addr_dials_the_address_and_keeps_the_relay_url() { + let relay = fake_relay::start(fake_relay::Script::default()).await; + let mut cfg = config("wss://relay.invalid".into()); + cfg.connect_addr = Some(relay.url.trim_start_matches("ws://").to_owned()); + let report = run(&cfg).await; + + assert_all_pass_but_relay_info(&report); + let hosts = relay.hosts(); + assert!(!hosts.is_empty()); + assert!(hosts.iter().all(|h| h == "relay.invalid"), "{hosts:?}"); + let relays = relay.auth_relays(); + assert!(!relays.is_empty()); + assert!( + relays.iter().all(|r| r == "wss://relay.invalid"), + "{relays:?}" + ); + } + + /// With a connect address the NIP-11 fetch goes to it over plain HTTP, + /// with the relay URL's host and port as the `Host` header. + #[tokio::test] + async fn nip11_goes_to_the_connect_addr_with_the_relay_host() { + use tokio::io::{AsyncReadExt, AsyncWriteExt}; + + let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); + let addr = listener.local_addr().unwrap().to_string(); + let server = tokio::spawn(async move { + let (mut tcp, _) = listener.accept().await.unwrap(); + let mut request = Vec::new(); + while !request.ends_with(b"\r\n\r\n") { + let mut byte = [0]; + tcp.read_exact(&mut byte).await.unwrap(); + request.push(byte[0]); + } + let body = r#"{"supported_nips":[1,11],"version":"1.2.3"}"#; + let response = format!( + "HTTP/1.1 200 OK\r\ncontent-type: application/nostr+json\r\n\ + content-length: {}\r\nconnection: close\r\n\r\n{body}", + body.len() + ); + tcp.write_all(response.as_bytes()).await.unwrap(); + String::from_utf8(request).unwrap().to_ascii_lowercase() + }); + let mut cfg = config("wss://relay.invalid:8443".into()); + cfg.connect_addr = Some(addr); + let (report, version) = relay_info(&cfg).await; + + assert_eq!(report.result, Outcome::Success, "{report:?}"); + assert_eq!(version.as_deref(), Some("1.2.3")); + let request = server.await.unwrap(); + assert!(request.starts_with("get / http/1.1\r\n"), "{request}"); + assert!( + request.contains("\r\nhost: relay.invalid:8443\r\n"), + "{request}" + ); + } + #[test] fn http_url_maps_websocket_schemes() { assert_eq!( diff --git a/crates/buzz-test-client/src/bin/acceptance.rs b/crates/buzz-test-client/src/bin/acceptance.rs index 8128778b197..07714e16c5f 100644 --- a/crates/buzz-test-client/src/bin/acceptance.rs +++ b/crates/buzz-test-client/src/bin/acceptance.rs @@ -5,6 +5,7 @@ //! //! Usage: //! buzz-acceptance --relay-url wss://relay.example +//! [--connect-addr relay.internal:80] //! [--private-key | --private-key-file ] [--assertion-file ] //! [--statsd-addr 127.0.0.1:8125] [--tag env:staging]... @@ -32,6 +33,11 @@ struct Cli { /// The relay's WebSocket URL. #[arg(long, env = "BUZZ_RELAY_URL")] relay_url: String, + /// Plaintext `host:port` to dial instead of the relay URL's host, such as + /// the relay's in-cluster service. The URL still sets the `Host` header + /// and the NIP-42 relay tag. + #[arg(long, env = "BUZZ_ACCEPTANCE_CONNECT_ADDR")] + connect_addr: Option, /// Secret key (hex or nsec) to authenticate and sign as. Without this or /// a key file the probe uses a new key, which works only on a relay that /// admits any key. @@ -112,6 +118,7 @@ async fn probe(cli: Cli) -> anyhow::Result { }; let cfg = Config { relay_url: cli.relay_url, + connect_addr: cli.connect_addr, keys, assertion_file: cli.assertion_file, stage_timeout: Duration::from_secs(cli.stage_timeout_secs), diff --git a/crates/buzz-test-client/src/loadgen/net.rs b/crates/buzz-test-client/src/loadgen/net.rs index f8971ffc8c7..bfc63bb212f 100644 --- a/crates/buzz-test-client/src/loadgen/net.rs +++ b/crates/buzz-test-client/src/loadgen/net.rs @@ -4,7 +4,7 @@ use std::collections::HashSet; use std::net::SocketAddr; use std::time::Duration; -use buzz_ws_client::NostrWsConnection; +use buzz_ws_client::{HeaderMap, NostrWsConnection}; use nostr::{Event, JsonUtil, Keys, Tag}; use super::identity; @@ -59,7 +59,8 @@ impl Net { let attempt = async { let mut conn = match (&self.connect_addr, &community.host) { (Some(addr), Some(_)) => { - NostrWsConnection::connect_to_addr(&community.ws_url, addr).await? + NostrWsConnection::connect_to_addr(&community.ws_url, addr, HeaderMap::new()) + .await? } _ => NostrWsConnection::connect(&community.ws_url).await?, }; diff --git a/crates/buzz-test-client/tests/e2e_acceptance.rs b/crates/buzz-test-client/tests/e2e_acceptance.rs index 25ca22196d5..c2767f41207 100644 --- a/crates/buzz-test-client/tests/e2e_acceptance.rs +++ b/crates/buzz-test-client/tests/e2e_acceptance.rs @@ -24,6 +24,7 @@ fn relay_url() -> String { async fn every_acceptance_check_passes_against_a_live_relay() { let report = acceptance::run(&Config { relay_url: relay_url(), + connect_addr: None, keys: Keys::generate(), assertion_file: None, stage_timeout: Duration::from_secs(10), diff --git a/crates/buzz-ws-client/src/connection.rs b/crates/buzz-ws-client/src/connection.rs index 918f971f101..ac3034a0884 100644 --- a/crates/buzz-ws-client/src/connection.rs +++ b/crates/buzz-ws-client/src/connection.rs @@ -120,18 +120,22 @@ impl NostrWsConnection { Ok(Self::from_stream(ws, url)) } - /// [`Self::connect`], but opens a plaintext TCP connection to `addr` - /// (`host:port`) instead of resolving the URL's host. + /// [`Self::connect_with_headers`], but opens a plaintext TCP connection to + /// `addr` (`host:port`) instead of resolving the URL's host. /// /// The URL still supplies the `Host` header and NIP-42 relay tag, even when /// it is `wss://`, so a client inside the relay's cluster can reach a /// community through the relay's plaintext service address and still /// authenticate for the community's public URL. - pub async fn connect_to_addr(url: &str, addr: &str) -> Result { + pub async fn connect_to_addr( + url: &str, + addr: &str, + headers: HeaderMap, + ) -> Result { let parsed = url .parse::() .map_err(|e| WsClientError::Url(e.to_string()))?; - let request = upgrade_request(&parsed, HeaderMap::new())?; + let request = upgrade_request(&parsed, headers)?; let tcp = tokio::net::TcpStream::connect(addr) .await .map_err(|e| WsClientError::WebSocket(e.into()))?; @@ -497,7 +501,7 @@ mod tests { }); let url = format!("ws://{addr}"); let _conn = if via_addr { - NostrWsConnection::connect_to_addr(&url, &addr).await + NostrWsConnection::connect_to_addr(&url, &addr, headers).await } else { NostrWsConnection::connect_with_headers(&url, headers).await } @@ -517,10 +521,13 @@ mod tests { async fn caller_user_agent_replaces_default() { let mut headers = HeaderMap::new(); headers.insert(USER_AGENT, HeaderValue::from_static("example/1.0")); - assert_eq!( - upgrade_user_agent(headers, false).await, - Some(HeaderValue::from_static("example/1.0")) - ); + for via_addr in [false, true] { + assert_eq!( + upgrade_user_agent(headers.clone(), via_addr).await, + Some(HeaderValue::from_static("example/1.0")), + "via_addr={via_addr}" + ); + } } /// A relay that answers NIP-42 AUTH by closing with `code`, as the relay diff --git a/deploy/charts/buzz/README.md b/deploy/charts/buzz/README.md index 592eb17204e..ee957d5acd6 100644 --- a/deploy/charts/buzz/README.md +++ b/deploy/charts/buzz/README.md @@ -527,6 +527,11 @@ image predates the probe. - The probe connects to `acceptance.relayUrl`, or to `relayUrl` when that is empty. Each run creates one private channel with a 1 h TTL and deletes it. +- `acceptance.connectAddr` is a plaintext `host:port` the probe dials instead + of the URL's host, for a probe that runs where the public host is not + reachable, such as inside the relay's cluster. The URL still sets the `Host` + header, the NIP-42 relay tag and the NIP-11 request's `Host`, so the relay + serves the same community. - `acceptance.privateKeySecret.name` names a Secret with the probe's key (hex or nsec), or `acceptance.privateKeyFile` names a file an init container writes. Set exactly one: the chart fails to render with neither. diff --git a/deploy/charts/buzz/templates/acceptance-cronjob.yaml b/deploy/charts/buzz/templates/acceptance-cronjob.yaml index 950c64b41a8..5b4e2e72ea6 100644 --- a/deploy/charts/buzz/templates/acceptance-cronjob.yaml +++ b/deploy/charts/buzz/templates/acceptance-cronjob.yaml @@ -77,6 +77,9 @@ spec: fieldRef: fieldPath: status.hostIP - { name: BUZZ_RELAY_URL, value: {{ default .Values.relayUrl $a.relayUrl | quote }} } + {{- with $a.connectAddr }} + - { name: BUZZ_ACCEPTANCE_CONNECT_ADDR, value: {{ . | quote }} } + {{- end }} {{- with $a.statsdAddr }} - { name: BUZZ_ACCEPTANCE_STATSD_ADDR, value: {{ . | quote }} } {{- end }} diff --git a/deploy/charts/buzz/tests/acceptance_test.yaml b/deploy/charts/buzz/tests/acceptance_test.yaml index 156d6e17f1a..f105d15811f 100644 --- a/deploy/charts/buzz/tests/acceptance_test.yaml +++ b/deploy/charts/buzz/tests/acceptance_test.yaml @@ -72,6 +72,11 @@ tests: content: name: BUZZ_ACCEPTANCE_STATSD_ADDR any: true + - notContains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: BUZZ_ACCEPTANCE_CONNECT_ADDR + any: true - contains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: @@ -111,6 +116,7 @@ tests: acceptance: enabled: true relayUrl: wss://probe.example.com + connectAddr: relay.internal:80 schedule: "*/10 * * * *" activeDeadlineSeconds: 120 stageTimeoutSeconds: 5 @@ -183,6 +189,11 @@ tests: content: name: BUZZ_RELAY_URL value: wss://probe.example.com + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: BUZZ_ACCEPTANCE_CONNECT_ADDR + value: relay.internal:80 - contains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: diff --git a/deploy/charts/buzz/values.schema.json b/deploy/charts/buzz/values.schema.json index 3cd423ed9c2..0f6d11a48c2 100644 --- a/deploy/charts/buzz/values.schema.json +++ b/deploy/charts/buzz/values.schema.json @@ -227,6 +227,7 @@ "successfulJobsHistoryLimit": { "type": "integer", "minimum": 0 }, "failedJobsHistoryLimit": { "type": "integer", "minimum": 0 }, "relayUrl": { "type": "string" }, + "connectAddr": { "type": "string" }, "stageTimeoutSeconds": { "type": "integer", "minimum": 1 }, "privateKeySecret": { "type": "object", diff --git a/deploy/charts/buzz/values.yaml b/deploy/charts/buzz/values.yaml index 40da6029a1f..3680e40d78b 100644 --- a/deploy/charts/buzz/values.yaml +++ b/deploy/charts/buzz/values.yaml @@ -411,6 +411,10 @@ acceptance: successfulJobsHistoryLimit: 1 failedJobsHistoryLimit: 3 relayUrl: "" # empty → relayUrl + # Plaintext host:port to dial instead of the relay URL's host, such as the + # relay's in-cluster service. The URL still sets the Host header and the + # NIP-42 relay tag. Empty → dial the URL. + connectAddr: "" # A run has 13 serial stage timeouts of this length. Keep activeDeadlineSeconds # above 13 × stageTimeoutSeconds + 30 s plus pull and init time: a run killed # at the deadline sends no metrics. From c692173c4dd195a42bad1824fc0f916de4e74279 Mon Sep 17 00:00:00 2001 From: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> Date: Fri, 20 Nov 2026 15:41:53 -0500 Subject: [PATCH 6/8] acceptance: pin the connect-address NIP-11 request to that address Review fixes (Legolas on #9830): - With a connect address, the NIP-11 request uses no proxy and follows no redirect, like the WebSocket connections. Either could reach another deployment and report its version. A non-2xx answer fails the check. - The request keeps the relay URL's query as well as its path. - The connect-address run test sets an assertion file and checks that every upgrade carries its bearer header, so dropping the headers on that path fails a test. The fake relay records each upgrade's headers. - New test: a redirect at the connect address fails nip11 with no version. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Elrond <28d6302a099e5225b02c4155ac4236e4912603df2ab08dbfc2f4fef08ce598c8@buzz.block.builderlab.xyz> --- .../src/acceptance/fake_relay.rs | 18 ++-- crates/buzz-test-client/src/acceptance/mod.rs | 95 +++++++++++++++---- 2 files changed, 86 insertions(+), 27 deletions(-) diff --git a/crates/buzz-test-client/src/acceptance/fake_relay.rs b/crates/buzz-test-client/src/acceptance/fake_relay.rs index c675ada9780..480341b0659 100644 --- a/crates/buzz-test-client/src/acceptance/fake_relay.rs +++ b/crates/buzz-test-client/src/acceptance/fake_relay.rs @@ -12,6 +12,7 @@ use serde_json::{json, Value}; use tokio::net::TcpListener; use tokio::sync::mpsc; use tokio_tungstenite::tungstenite::handshake::server::{Request, Response}; +use tokio_tungstenite::tungstenite::http::HeaderMap; use tokio_tungstenite::tungstenite::Message; use super::{AUTH_REQUIRED, PUBKEY_MISMATCH}; @@ -73,8 +74,8 @@ struct Shared { events: Mutex>, /// Live subscriptions: subscription id and the connection to send to. live: Mutex>, - /// The `Host` header of every WebSocket upgrade, in order. - hosts: Mutex>, + /// The headers of every WebSocket upgrade, in order. + upgrades: Mutex>, /// The `relay` tag of every AUTH event, in order. auth_relays: Mutex>, } @@ -92,9 +93,9 @@ impl FakeRelay { self.shared.events.lock().unwrap().clone() } - /// The `Host` header of every WebSocket upgrade so far, in order. - pub fn hosts(&self) -> Vec { - self.shared.hosts.lock().unwrap().clone() + /// The headers of every WebSocket upgrade so far, in order. + pub fn upgrades(&self) -> Vec { + self.shared.upgrades.lock().unwrap().clone() } /// The `relay` tag of every AUTH event so far, in order. @@ -111,7 +112,7 @@ pub async fn start(script: Script) -> FakeRelay { script, events: Mutex::new(Vec::new()), live: Mutex::new(Vec::new()), - hosts: Mutex::new(Vec::new()), + upgrades: Mutex::new(Vec::new()), auth_relays: Mutex::new(Vec::new()), }); let accept = shared.clone(); @@ -129,9 +130,8 @@ async fn serve(tcp: tokio::net::TcpStream, shared: Arc) { // A plain HTTP request (the NIP-11 fetch) fails the upgrade; that is fine. let upgrade = tokio_tungstenite::accept_hdr_async(tcp, |request: &Request, response: Response| { - let host = request.headers().get("host").and_then(|h| h.to_str().ok()); - let host = host.unwrap_or_default().to_owned(); - shared.hosts.lock().unwrap().push(host); + let headers = request.headers().clone(); + shared.upgrades.lock().unwrap().push(headers); Ok(response) }); let Ok(ws) = upgrade.await else { diff --git a/crates/buzz-test-client/src/acceptance/mod.rs b/crates/buzz-test-client/src/acceptance/mod.rs index 2e549dec7de..c5316f3b6b8 100644 --- a/crates/buzz-test-client/src/acceptance/mod.rs +++ b/crates/buzz-test-client/src/acceptance/mod.rs @@ -285,8 +285,10 @@ async fn relay_info(cfg: &Config) -> (CheckReport, Option) { let response = nip11_request(cfg)? .header("Accept", "application/nostr+json") .send() - .await? - .error_for_status()?; + .await?; + if !response.status().is_success() { + bail!("NIP-11 request answered {}", response.status()); + } let info: serde_json::Value = response.json().await?; if !info["supported_nips"].is_array() { bail!("not a NIP-11 document: no supported_nips"); @@ -678,16 +680,22 @@ async fn open(cfg: &Config) -> anyhow::Result { /// The NIP-11 request for the relay. With `cfg.connect_addr` it goes to that /// address over plain HTTP, with the relay URL's host as the `Host` header, -/// so the relay serves the same community's document. +/// so the relay serves the same community's document. Like the WebSocket +/// connections, it then uses no proxy and follows no redirect: either could +/// reach another deployment and report its version. fn nip11_request(cfg: &Config) -> anyhow::Result { let url = http_url(&cfg.relay_url)?; - let client = reqwest::Client::new(); let Some(addr) = &cfg.connect_addr else { - return Ok(client.get(url)); + return Ok(reqwest::Client::new().get(url)); }; + let client = reqwest::Client::builder() + .no_proxy() + .redirect(reqwest::redirect::Policy::none()) + .build()?; let host = &url[url::Position::BeforeHost..url::Position::AfterPort]; + let target = &url[url::Position::BeforePath..url::Position::AfterQuery]; Ok(client - .get(format!("http://{addr}{}", url.path())) + .get(format!("http://{addr}{target}")) .header(reqwest::header::HOST, host)) } @@ -845,15 +853,27 @@ mod tests { /// AUTH still names the relay URL, so the relay serves that community. #[tokio::test] async fn connect_addr_dials_the_address_and_keeps_the_relay_url() { + let dir = std::env::temp_dir().join(format!("acceptance-{}", uuid::Uuid::new_v4())); + std::fs::create_dir_all(&dir).unwrap(); + let assertion = dir.join("assertion"); + std::fs::write(&assertion, "header.payload.signature").unwrap(); let relay = fake_relay::start(fake_relay::Script::default()).await; let mut cfg = config("wss://relay.invalid".into()); cfg.connect_addr = Some(relay.url.trim_start_matches("ws://").to_owned()); + cfg.assertion_file = Some(assertion); let report = run(&cfg).await; + std::fs::remove_dir_all(dir).unwrap(); assert_all_pass_but_relay_info(&report); - let hosts = relay.hosts(); - assert!(!hosts.is_empty()); - assert!(hosts.iter().all(|h| h == "relay.invalid"), "{hosts:?}"); + let upgrades = relay.upgrades(); + assert!(!upgrades.is_empty()); + for headers in &upgrades { + assert_eq!(headers["host"], "relay.invalid", "{headers:?}"); + assert_eq!( + headers["nostr-federated-identity"], "Bearer header.payload.signature", + "{headers:?}" + ); + } let relays = relay.auth_relays(); assert!(!relays.is_empty()); assert!( @@ -862,10 +882,12 @@ mod tests { ); } - /// With a connect address the NIP-11 fetch goes to it over plain HTTP, - /// with the relay URL's host and port as the `Host` header. - #[tokio::test] - async fn nip11_goes_to_the_connect_addr_with_the_relay_host() { + /// Serves one HTTP request with `head` (status line and headers) and + /// `body`. Returns the address and the request it received, lowercased. + async fn one_http_response( + head: &'static str, + body: &'static str, + ) -> (String, tokio::task::JoinHandle) { use tokio::io::{AsyncReadExt, AsyncWriteExt}; let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap(); @@ -878,29 +900,66 @@ mod tests { tcp.read_exact(&mut byte).await.unwrap(); request.push(byte[0]); } - let body = r#"{"supported_nips":[1,11],"version":"1.2.3"}"#; let response = format!( - "HTTP/1.1 200 OK\r\ncontent-type: application/nostr+json\r\n\ - content-length: {}\r\nconnection: close\r\n\r\n{body}", + "{head}\r\ncontent-length: {}\r\nconnection: close\r\n\r\n{body}", body.len() ); tcp.write_all(response.as_bytes()).await.unwrap(); String::from_utf8(request).unwrap().to_ascii_lowercase() }); - let mut cfg = config("wss://relay.invalid:8443".into()); + (addr, server) + } + + /// With a connect address the NIP-11 fetch goes to it over plain HTTP, + /// with the relay URL's path and query, and its host and port as the + /// `Host` header. + #[tokio::test] + async fn nip11_goes_to_the_connect_addr_with_the_relay_host() { + let (addr, server) = one_http_response( + "HTTP/1.1 200 OK\r\ncontent-type: application/nostr+json", + r#"{"supported_nips":[1,11],"version":"1.2.3"}"#, + ) + .await; + let mut cfg = config("wss://relay.invalid:8443/relay?route=probe".into()); cfg.connect_addr = Some(addr); let (report, version) = relay_info(&cfg).await; assert_eq!(report.result, Outcome::Success, "{report:?}"); assert_eq!(version.as_deref(), Some("1.2.3")); let request = server.await.unwrap(); - assert!(request.starts_with("get / http/1.1\r\n"), "{request}"); + assert!( + request.starts_with("get /relay?route=probe http/1.1\r\n"), + "{request}" + ); assert!( request.contains("\r\nhost: relay.invalid:8443\r\n"), "{request}" ); } + /// With a connect address the NIP-11 fetch follows no redirect: one to + /// another host fails the check and reports no version. + #[tokio::test] + async fn nip11_at_the_connect_addr_does_not_follow_a_redirect() { + let (addr, server) = one_http_response( + "HTTP/1.1 301 Moved Permanently\r\nlocation: http://127.0.0.1:9/", + "", + ) + .await; + let mut cfg = config("wss://relay.invalid".into()); + cfg.connect_addr = Some(addr); + let (report, version) = relay_info(&cfg).await; + + assert_eq!(report.result, Outcome::Failure, "{report:?}"); + assert_eq!(report.failed_stage, Some("nip11")); + assert!( + report.error.as_deref().unwrap().contains("301"), + "{report:?}" + ); + assert_eq!(version, None); + server.await.unwrap(); + } + #[test] fn http_url_maps_websocket_schemes() { assert_eq!( From ff6dc6817422c9e552957888019ddf48eba7f612 Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Fri, 20 Nov 2026 16:11:30 -0500 Subject: [PATCH 7/8] acceptance: pass the chart's connect address as a flag The chart now passes acceptance.connectAddr as --connect-addr instead of an env var. A relay image whose probe predates the option rejects the unknown flag and the run fails, instead of checking the public URL and reporting success. The README states the image requirement. The binary tests clear BUZZ_ACCEPTANCE_CONNECT_ADDR so a developer shell cannot redirect them. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Luke Tornquist --- crates/buzz-test-client/tests/e2e_acceptance.rs | 1 + deploy/charts/buzz/README.md | 4 +++- deploy/charts/buzz/templates/acceptance-cronjob.yaml | 9 ++++++--- deploy/charts/buzz/tests/acceptance_test.yaml | 6 ++++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/buzz-test-client/tests/e2e_acceptance.rs b/crates/buzz-test-client/tests/e2e_acceptance.rs index c2767f41207..119ce8f03de 100644 --- a/crates/buzz-test-client/tests/e2e_acceptance.rs +++ b/crates/buzz-test-client/tests/e2e_acceptance.rs @@ -62,6 +62,7 @@ fn probe_with_env(args: &[&str], envs: &[(&str, &str)]) -> (Output, Vec) .env_remove("BUZZ_PRIVATE_KEY_FILE") .env_remove("BUZZ_ACCEPTANCE_ASSERTION_FILE") .env_remove("BUZZ_ACCEPTANCE_STATSD_ADDR") + .env_remove("BUZZ_ACCEPTANCE_CONNECT_ADDR") .env_remove("BUZZ_RELAY_URL") .envs(envs.iter().copied()) .stdout(Stdio::piped()) diff --git a/deploy/charts/buzz/README.md b/deploy/charts/buzz/README.md index ee957d5acd6..4c7876acd7e 100644 --- a/deploy/charts/buzz/README.md +++ b/deploy/charts/buzz/README.md @@ -531,7 +531,9 @@ image predates the probe. of the URL's host, for a probe that runs where the public host is not reachable, such as inside the relay's cluster. The URL still sets the `Host` header, the NIP-42 relay tag and the NIP-11 request's `Host`, so the relay - serves the same community. + serves the same community. The chart passes it as `--connect-addr`, so the + relay image's probe must have that flag. An older probe exits with an error + instead of checking the public URL. - `acceptance.privateKeySecret.name` names a Secret with the probe's key (hex or nsec), or `acceptance.privateKeyFile` names a file an init container writes. Set exactly one: the chart fails to render with neither. diff --git a/deploy/charts/buzz/templates/acceptance-cronjob.yaml b/deploy/charts/buzz/templates/acceptance-cronjob.yaml index 5b4e2e72ea6..eca42587e2a 100644 --- a/deploy/charts/buzz/templates/acceptance-cronjob.yaml +++ b/deploy/charts/buzz/templates/acceptance-cronjob.yaml @@ -66,6 +66,12 @@ spec: - {{ $a.metricPrefix | quote }} - --tag - {{ printf "probe_revision:%s" (include "buzz.imageRevision" .) | quote }} + {{- with $a.connectAddr }} + # A flag, not an env var: a probe older than this option + # rejects the unknown flag instead of dialing the public URL. + - --connect-addr + - {{ . | quote }} + {{- end }} {{- range $a.tags }} - --tag - {{ . | quote }} @@ -77,9 +83,6 @@ spec: fieldRef: fieldPath: status.hostIP - { name: BUZZ_RELAY_URL, value: {{ default .Values.relayUrl $a.relayUrl | quote }} } - {{- with $a.connectAddr }} - - { name: BUZZ_ACCEPTANCE_CONNECT_ADDR, value: {{ . | quote }} } - {{- end }} {{- with $a.statsdAddr }} - { name: BUZZ_ACCEPTANCE_STATSD_ADDR, value: {{ . | quote }} } {{- end }} diff --git a/deploy/charts/buzz/tests/acceptance_test.yaml b/deploy/charts/buzz/tests/acceptance_test.yaml index f105d15811f..60d591adb07 100644 --- a/deploy/charts/buzz/tests/acceptance_test.yaml +++ b/deploy/charts/buzz/tests/acceptance_test.yaml @@ -172,6 +172,8 @@ tests: - example.acceptance - --tag - probe_revision:sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef + - --connect-addr + - relay.internal:80 - --tag - env:staging - --tag @@ -189,11 +191,11 @@ tests: content: name: BUZZ_RELAY_URL value: wss://probe.example.com - - contains: + - notContains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: name: BUZZ_ACCEPTANCE_CONNECT_ADDR - value: relay.internal:80 + any: true - contains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: From 1d4cb16f705de508e93be567731baaa9e82da223 Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Fri, 20 Nov 2026 16:54:16 -0500 Subject: [PATCH 8/8] acceptance: pass the chart's key file as a flag The chart now passes acceptance.privateKeyFile as --private-key-file instead of BUZZ_PRIVATE_KEY_FILE. A probe that predates the option rejects the unknown flag, instead of ignoring the variable and running with a new random key. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Luke Tornquist --- deploy/charts/buzz/README.md | 4 +++- .../charts/buzz/templates/acceptance-cronjob.yaml | 11 ++++++----- deploy/charts/buzz/tests/acceptance_test.yaml | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/deploy/charts/buzz/README.md b/deploy/charts/buzz/README.md index 4c7876acd7e..6f38fb6eba2 100644 --- a/deploy/charts/buzz/README.md +++ b/deploy/charts/buzz/README.md @@ -539,7 +539,9 @@ image predates the probe. container writes. Set exactly one: the chart fails to render with neither. Without a key the probe would sign with a new key each run, which a members-only relay refuses and an open relay joins to every auto-join - channel. On a members-only relay, make the key a relay member first. + channel. On a members-only relay, make the key a relay member first. The + chart passes `privateKeyFile` as `--private-key-file`, so a probe without + that flag exits with an error instead of running with a new key. - `acceptance.statsdAddr` sends DogStatsD metrics under `acceptance.metricPrefix` (`.runs`, `.run.seconds`, `.check.runs`, `.check.seconds`, `.stage.seconds`). diff --git a/deploy/charts/buzz/templates/acceptance-cronjob.yaml b/deploy/charts/buzz/templates/acceptance-cronjob.yaml index eca42587e2a..8864e3f3a5e 100644 --- a/deploy/charts/buzz/templates/acceptance-cronjob.yaml +++ b/deploy/charts/buzz/templates/acceptance-cronjob.yaml @@ -66,12 +66,16 @@ spec: - {{ $a.metricPrefix | quote }} - --tag - {{ printf "probe_revision:%s" (include "buzz.imageRevision" .) | quote }} + # Newer options are flags, not env vars: a probe older than an + # option rejects the unknown flag instead of ignoring it. {{- with $a.connectAddr }} - # A flag, not an env var: a probe older than this option - # rejects the unknown flag instead of dialing the public URL. - --connect-addr - {{ . | quote }} {{- end }} + {{- with $a.privateKeyFile }} + - --private-key-file + - {{ . | quote }} + {{- end }} {{- range $a.tags }} - --tag - {{ . | quote }} @@ -86,9 +90,6 @@ spec: {{- with $a.statsdAddr }} - { name: BUZZ_ACCEPTANCE_STATSD_ADDR, value: {{ . | quote }} } {{- end }} - {{- with $a.privateKeyFile }} - - { name: BUZZ_PRIVATE_KEY_FILE, value: {{ . | quote }} } - {{- end }} {{- with $a.assertionFile }} - { name: BUZZ_ACCEPTANCE_ASSERTION_FILE, value: {{ . | quote }} } {{- end }} diff --git a/deploy/charts/buzz/tests/acceptance_test.yaml b/deploy/charts/buzz/tests/acceptance_test.yaml index 60d591adb07..73e364587bb 100644 --- a/deploy/charts/buzz/tests/acceptance_test.yaml +++ b/deploy/charts/buzz/tests/acceptance_test.yaml @@ -291,11 +291,22 @@ tests: privateKeyFile: /var/run/assertion/key assertionFile: /var/run/assertion/token asserts: - - contains: + - equal: + path: spec.jobTemplate.spec.template.spec.containers[0].args + value: + - --stage-timeout-secs + - "10" + - --metric-prefix + - buzz.acceptance + - --tag + - probe_revision:1.2.3 + - --private-key-file + - /var/run/assertion/key + - notContains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: name: BUZZ_PRIVATE_KEY_FILE - value: /var/run/assertion/key + any: true - notContains: path: spec.jobTemplate.spec.template.spec.containers[0].env content: