From ad5b8c30590433e2810a97df41e231f7d4c8a703 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 29 Jan 2024 14:45:32 -0500 Subject: [PATCH] fix: verify aud --- .../public_http_server/handlers/relay_webhook/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/services/public_http_server/handlers/relay_webhook/mod.rs b/src/services/public_http_server/handlers/relay_webhook/mod.rs index 5b7aa865..e461912f 100644 --- a/src/services/public_http_server/handlers/relay_webhook/mod.rs +++ b/src/services/public_http_server/handlers/relay_webhook/mod.rs @@ -27,7 +27,7 @@ use { }, }, serde_json::json, - std::{sync::Arc, time::Instant}, + std::{collections::HashSet, sync::Arc, time::Instant}, thiserror::Error, tracing::{error, info, instrument, warn}, }; @@ -95,11 +95,9 @@ pub async fn handler( let claims = WatchEventClaims::try_from_str(&payload.event_auth) .map_err(|e| Error::ClientError(ClientError::ParseWatchEvent(e)))?; - // TODO verify audience - // let aud = HashSet::new(); - // claims - // .verify_basic(&aud, None) - // .map_err(|e| Error::ClientError(ClientError::VerifyWatchEvent(e)))?; + claims + .verify_basic(&HashSet::from([state.config.notify_url.to_string()]), None) + .map_err(|e| Error::ClientError(ClientError::VerifyWatchEvent(e)))?; // TODO verify issuer // if claims.basic.iss != state.config.relay_identity {