From 4147c691e6948e6feea297408f0be46397457297 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Thu, 31 Aug 2023 17:17:41 -0700 Subject: [PATCH 1/3] fix: [CODE-760]: intenral mapping --- internal/api/controller/webhook/common.go | 8 ++++---- internal/store/database/webhook.go | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/api/controller/webhook/common.go b/internal/api/controller/webhook/common.go index 87a79273f..2c144864f 100644 --- a/internal/api/controller/webhook/common.go +++ b/internal/api/controller/webhook/common.go @@ -39,10 +39,10 @@ func checkURL(rawURL string, allowLoopback bool, allowPrivateNetwork bool) error // basic validation for loopback / private network addresses (only sanitary to give user an early error) // IMPORTANT: during webook execution loopback / private network addresses are blocked (handles DNS resolution) - - if host == "localhost" { - return check.NewValidationError("localhost is not allowed.") - } + // + //if host == "localhost" { + // return check.NewValidationError("localhost is not allowed.") + //} if ip := net.ParseIP(host); ip != nil { if !allowLoopback && ip.IsLoopback() { diff --git a/internal/store/database/webhook.go b/internal/store/database/webhook.go index f05e1c230..a50a7677d 100644 --- a/internal/store/database/webhook.go +++ b/internal/store/database/webhook.go @@ -357,6 +357,7 @@ func mapToWebhook(hook *webhook) (*types.Webhook, error) { Insecure: hook.Insecure, Triggers: triggersFromString(hook.Triggers), LatestExecutionResult: (*enum.WebhookExecutionResult)(hook.LatestExecutionResult.Ptr()), + Internal: hook.Internal, } switch { @@ -390,6 +391,7 @@ func mapToInternalWebhook(hook *types.Webhook) (*webhook, error) { Insecure: hook.Insecure, Triggers: triggersToString(hook.Triggers), LatestExecutionResult: null.StringFromPtr((*string)(hook.LatestExecutionResult)), + Internal: hook.Internal, } switch hook.ParentType { From 16d44f9ba4b4cba2339534d0fa12a8f34ae523f1 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Thu, 31 Aug 2023 17:18:08 -0700 Subject: [PATCH 2/3] fix: [CODE-760]: intenral mapping --- internal/api/controller/webhook/common.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/api/controller/webhook/common.go b/internal/api/controller/webhook/common.go index 2c144864f..459fc5d84 100644 --- a/internal/api/controller/webhook/common.go +++ b/internal/api/controller/webhook/common.go @@ -40,9 +40,9 @@ func checkURL(rawURL string, allowLoopback bool, allowPrivateNetwork bool) error // basic validation for loopback / private network addresses (only sanitary to give user an early error) // IMPORTANT: during webook execution loopback / private network addresses are blocked (handles DNS resolution) // - //if host == "localhost" { - // return check.NewValidationError("localhost is not allowed.") - //} + if host == "localhost" { + return check.NewValidationError("localhost is not allowed.") + } if ip := net.ParseIP(host); ip != nil { if !allowLoopback && ip.IsLoopback() { From e9aaf4991c244d8fa596f5ad42c799040a6a7ed5 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Thu, 31 Aug 2023 17:18:24 -0700 Subject: [PATCH 3/3] fix: [CODE-760]: intenral mapping --- internal/api/controller/webhook/common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/controller/webhook/common.go b/internal/api/controller/webhook/common.go index 459fc5d84..87a79273f 100644 --- a/internal/api/controller/webhook/common.go +++ b/internal/api/controller/webhook/common.go @@ -39,7 +39,7 @@ func checkURL(rawURL string, allowLoopback bool, allowPrivateNetwork bool) error // basic validation for loopback / private network addresses (only sanitary to give user an early error) // IMPORTANT: during webook execution loopback / private network addresses are blocked (handles DNS resolution) - // + if host == "localhost" { return check.NewValidationError("localhost is not allowed.") }