Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

HMAC Signature mismatch

cm devops May 7, 2024

Hi,

I'm using this script to validate the webhook signatures.
https://confluence.atlassian.com/bbkb/bitbucket-cloud-python-sample-code-to-verify-webhook-signature-1346243949.html-1346243949.html 

When there is a colon : in the commit message (i.e., Test Commit : #1), script returns a mismatch in signature. Any suggestions to overcome this scenario?

1 answer

3 votes
Suhas Sundararaju
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 8, 2024

Hi @cm devops 

The issue arises because the script removes whitespaces after the colon, causing the problem. To address this, I've modified the script to convert the payload data back to a single-line JSON string with separators ',' and ':', and to pretty print the original payload with payload_data, indent=2). This adjustment should resolve the issue.

Furthermore, I want to highlight that there may be a discrepancy in how Bitbucket Cloud calculates HMAC signature compared to how the script calculates it. You may need to modify the script accordingly. The ultimate goal is to convert JSON to a single line while removing whitespaces.

You can find the modified script at the following link: https://confluence.atlassian.com/display/BBKB/Bitbucket+Cloud+-+Python+sample+code+to+verify+webhook+signature

I hope this helps.

cm devops May 9, 2024

Thanks @Suhas Sundararaju

It works!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events