-
Notifications
You must be signed in to change notification settings - Fork 358
[JENKINS-74983] Add support for authenticated Webhooks registered in Bitbucket #1044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
...n/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/BitbucketSCMSourcePushHookReceiver.java
Outdated
Show resolved
Hide resolved
...n/java/com/cloudbees/jenkins/plugins/bitbucket/hooks/BitbucketSCMSourcePushHookReceiver.java
Outdated
Show resolved
Hide resolved
c44b39e
to
cf2c3e1
Compare
...a/com/cloudbees/jenkins/plugins/bitbucket/endpoints/AbstractBitbucketEndpointDescriptor.java
Fixed
Show resolved
Hide resolved
...a/com/cloudbees/jenkins/plugins/bitbucket/endpoints/AbstractBitbucketEndpointDescriptor.java
Fixed
Show fixed
Hide fixed
...va/com/cloudbees/jenkins/plugins/bitbucket/hooks/BitbucketSCMSourcePushHookReceiverTest.java
Fixed
Show fixed
Hide fixed
...a/com/cloudbees/jenkins/plugins/bitbucket/endpoints/AbstractBitbucketEndpointDescriptor.java
Fixed
Show fixed
Hide fixed
...a/com/cloudbees/jenkins/plugins/bitbucket/endpoints/AbstractBitbucketEndpointDescriptor.java
Fixed
Show fixed
Hide fixed
903a287
to
55f31de
Compare
@KalleOlaviNiemitalo any idea where I can find the API Documentation to register a webhook secret for the "Jenkins and Azure DevOps Post Webhooks for Bitbucket"? |
55f31de
to
5d6e547
Compare
@@ -83,4 +85,12 @@ | |||
this.uuid = uuid; | |||
} | |||
|
|||
public String getSecret() { |
Check notice
Code scanning / CodeQL
Missing Override annotation Note
BitbucketWebHook.getSecret
...t/java/com/cloudbees/jenkins/plugins/bitbucket/client/BitbucketIntegrationClientFactory.java
Fixed
Show fixed
Hide fixed
I don't know whether "Jenkins and Azure DevOps Post Webhooks for Bitbucket" supports HMAC signatures in webhook requests. https://help.moveworkforward.com/BPW/how-to-choose-an-authentication-type lists only Basic, Bearer, and Kerberos authentication. https://help.moveworkforward.com/BPW/how-to-create-a-new-webhook and https://help.moveworkforward.com/BPW/how-to-manage-configurations-using-post-webhooks-f don't seem to mention a setting for the HMAC key. |
03bf7ba
to
166de2d
Compare
…Bitbucket Verify in the webhooks processor when the signature is present is matches the configured Add configuration in the global settings to setup HMAC credentials. The secret is not customisable by single project for the following reasons: * events should contains a duplicate of the payload to be verified only in BitbucketSCMSource.retrieve method. * that means spend a lot of resources just to ignore the payload. Multiple fake requests, would overload Jenkins that have to process events to lookup the right project. * could not response to Bitbucket that the payload is invalid because events are managed async. * each event could serve multiple projects that potentially could be configured with a different secret.
166de2d
to
ceaf5e0
Compare
Add signature check in the webhooks processor.
Since development teams are not responsible for security, otherwise one project might enforce security and another might not, the admin should constantly check that all projects have the correct configuration.
For this reason it must be enabled for all or none. Another consideration is that the webhook is configured globally. Users can disable it for a specific project and manage it manually, but this means that if disabled, the global secret key must still be used.
The secret is not customisable by single project for the following reasons: