diff --git a/crates/quark/src/impl/generic/channels/webhook.rs b/crates/quark/src/impl/generic/channels/webhook.rs index 940c91c5..acc170b9 100644 --- a/crates/quark/src/impl/generic/channels/webhook.rs +++ b/crates/quark/src/impl/generic/channels/webhook.rs @@ -10,7 +10,11 @@ impl Webhook { pub async fn create(&self, db: &Database) -> Result<()> { db.insert_webhook(self).await?; - EventV1::WebhookCreate(self.clone()) + // Avoid leaking the token to people who receive the event + let mut webhook = self.clone(); + webhook.token = None; + + EventV1::WebhookCreate(webhook) .p(self.channel.clone()).await; Ok(()) @@ -28,7 +32,7 @@ impl Webhook { pub async fn update( &mut self, db: &Database, - partial: PartialWebhook, + mut partial: PartialWebhook, remove: Vec ) -> Result<()> { for field in &remove { @@ -39,6 +43,8 @@ impl Webhook { db.update_webook(&self.id, &partial, &remove).await?; + partial.token = None; // Avoid leaking the token to people who receive the event + EventV1::WebhookUpdate { id: self.id.clone(), data: partial,