huskies: merge 1173 story Identity-aware fleet checks: cryptographic node identity in upgrade and health probes

This commit is contained in:
Huskies Agent
2026-07-16 13:26:03 +00:00
parent 489c415fd9
commit 0ac68afa4c
14 changed files with 894 additions and 30 deletions
+26
View File
@@ -94,6 +94,32 @@ pub fn write_bot_config(config_dir: &Path, content: &str) -> Result<(), String>
std::fs::write(&path, content).map_err(|e| format!("cannot write bot.toml: {e}"))
}
// ── Identity probe I/O ───────────────────────────────────────────────────────
/// `GET {sled_url}/identity?nonce=<nonce>` and parse the JSON body.
///
/// Returns `None` when the sled is unreachable or the response body doesn't
/// parse as [`super::identity::IdentityProbeResponse`] — callers treat that
/// the same as an unverifiable identity (distinct from a legacy sled, which
/// responds but omits the `signature` field).
pub async fn probe_identity(
client: &Client,
sled_url: &str,
nonce: &str,
) -> Option<super::identity::IdentityProbeResponse> {
// `nonce` is always a hex string (see `node_identity::generate_challenge`),
// so no percent-encoding is needed for safe inclusion in the query string.
let url = format!("{}/identity?nonce={nonce}", sled_url.trim_end_matches('/'));
client
.get(&url)
.send()
.await
.ok()?
.json::<super::identity::IdentityProbeResponse>()
.await
.ok()
}
// ── MCP proxy I/O ───────────────────────────────────────────────────────────
/// Proxy a raw MCP request body to the given project URL.