diff --git a/internal/service/api/webhook.go b/internal/service/api/webhook.go index 860258ae..344cc384 100644 --- a/internal/service/api/webhook.go +++ b/internal/service/api/webhook.go @@ -39,7 +39,7 @@ import ( func (api *APIService) WebhookRegisterAPI(router *gin.RouterGroup) { router.POST("/hook/:hook/:hash", api.passHookToProcessor) - router.GET("/hook/:hook/:hash", api.runTriggerHook) + router.GET("/hook/:hook/:hash", api.passHookToProcessor) } type JSONPayload struct { @@ -101,6 +101,10 @@ func (api *APIService) passHookToProcessor(c *gin.Context) { case len(nameParts) >= 2 && (nameParts[0] == "trigger" || nameParts[1] == "trigger"): api.runTriggerHook(c) case len(nameParts) >= 2 && nameParts[0] == "integration": + if c.Request.Method != http.MethodPost { + common.AbortWithError(c, perr.MethodNotAllowed()) + return + } api.runIntegrationHook(c) default: common.AbortWithError(c, perr.NotFoundWithMessage(fmt.Sprintf("Not Found %s", webhookUri.Hook))) diff --git a/internal/service/manager/manager.go b/internal/service/manager/manager.go index b91ac8f9..f1f97a32 100644 --- a/internal/service/manager/manager.go +++ b/internal/service/manager/manager.go @@ -529,7 +529,7 @@ func integrationUrlProcessor(integration modconfig.Integration) error { integrationName := fmt.Sprintf("integration.%s", integration.GetHclResourceImpl().FullName) hashString := util.CalculateHash(integrationName, salt) - integrationUrl := fmt.Sprintf("%s/hook/%s/%s", util.GetBaseUrl(), integrationName, hashString) + integrationUrl := fmt.Sprintf("%s/api/latest/hook/%s/%s", util.GetBaseUrl(), integrationName, hashString) integration.SetUrl(integrationUrl) } return nil