From c3d1199173842d1063aff2c1eb8a6689673ba883 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 30 Jan 2025 11:51:13 +0100 Subject: [PATCH] webhooks: fix filter for internal auth --- webhooks/config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webhooks/config.go b/webhooks/config.go index f5490abb032e597eb57069c681d134e46a023fd1..af0f7d7334cd662e3de2f7ac2992ba9d38b586f9 100644 --- a/webhooks/config.go +++ b/webhooks/config.go @@ -72,7 +72,12 @@ func FilterWebhooks(ctx context.Context) (sq.Sqlizer, error) { if err != nil { return nil, err } - if ac.ClientID != nil { + if ac.AuthMethod == auth.AUTH_INTERNAL { + return sq.And{ + sq.Expr(`user_id = ?`, user.UserID), + sq.Expr(`auth_method = 'INTERNAL'`), + }, nil + } else if ac.ClientID != nil { // XXX: Should we maybe return all webhooks configured by client ID? return sq.And{ sq.Expr(`NOW() at time zone 'utc' < expires`),