0

I have crafted a curl which looks something like this. It successfully creates a webhook in BitBucket Server, however, it does not set the 'secret' value, and because of this when the webhook is triggered it fails with a 'missing signature in header'.

If I manually set the secret value, it will then work.

bitbucket image I have looked through Bitbucket Server documentation for 'Create webhook' and do not see anything related.

Link for reference: https://developer.atlassian.com/server/bitbucket/rest/v804/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-webhooks-post

  url --request POST \
  --url 'https://git.example.org/rest/api/latest/projects/DP/repos/demo/webhooks' \
  --header 'Authorization: Bearer xxx' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "events": [
    "repo:refs_changed"
  ],
  "active": true,
  "statistics": {},
  "configuration": {},
  "url": "http://example.org/push",
  "name": "Argo Events"
}'
Asher
  • 348
  • 1
  • 3
  • 19

1 Answers1

0

After opening web tools and manually creating the webhook in the BitBucket website, we inspected the network tab and found that it was stored in the configuration object. Example curl below.

  curl --request POST \
  --url 'https://example.org/webhooks' \
  --header 'Authorization: Bearer xxx' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "events": [
    "repo:refs_changed"
  ],
  "active": true,
  "statistics": {},
  "configuration": {"createdBy": "bitbucket","secret": "password"},
  "url": "http://example.org/push",
  "name": "Argo Events"
}'
Asher
  • 348
  • 1
  • 3
  • 19