Support webhook secret for Git Experience webhooks
U
Umber Unicorn
Summary
Git Experience webhooks have no option for a webhook secret. The webhook that Harness registers in GitHub for Git Experience is created without a secret, and there is no field to set one in the UI, the API or the Terraform resource
harness_platform_gitx_webhook
. Webhook triggers already support a secret, and Harness sets it on the GitHub webhook it creates for the trigger. Git Experience webhooks should support the same.Background
We expect every webhook that Git Experience registers in GitHub to have a secret set. We manage Harness with Terraform and register a Git Experience webhook with
harness_platform_gitx_webhook
for each repository that holds Harness entities.Harness creates the webhook in GitHub, but without a secret. The secret has to be added
manually
in GitHub for each repository after Harness creates the webhook, which adds a manual step to onboarding every new repository.We would like this to work the same way as triggers. A trigger takes a secret reference (
encryptedWebhookSecretIdentifier
), and Harness sets that secret on the GitHub webhook it creates for the trigger. Git Experience webhooks should offer the same.Requested feature
- Add an optional secret reference to Git Experience webhooks, in the UI, the API and harness_platform_gitx_webhook, likeencryptedWebhookSecretIdentifieron triggers.
- When Harness registers the Git Experience webhook in GitHub, it sets that secret on the webhook.
- Harness verifies the signature of incoming Git Experience events and rejects events that don't match.
For example, in Terraform:
resource "harness_platform_gitx_webhook" "my_repo" {
identifier = "my_repo"
name = "my-repo"
org_id = "my_org"
repo_name = "my-repo"
connector_ref = "my_github_connector"
folder_paths = [".harness/orgs/my_org/projects/.."]
webhook_secret = "org.my_webhook_secret" # new, optional: reference to a Harness secret
}
Benefits
- Git Experience webhooks are secured the same way as trigger webhooks.
- Onboarding a repository needs no manual step in GitHub: the Terraform that registers the webhook also sets its secret.