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"
}'
1
  • 1
    what if you try to pass the secret in configuration? Commented Oct 7, 2022 at 7:46

1 Answer 1

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"
}'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.