Skip to content

Webhook Signature cannot be verified in AzureFunctions V4 #56

@ankitatdnv

Description

@ankitatdnv

Hi,

I am trying to use this action for invoking a webhook with custom data, but I am not able to verify the Signature sent by the webhook, I have tried both SHA256 and SHA1 signatures.
I am using the latest version 3.0.8

Please find below the code snippet, along with the data:

Action Step:

uses: distributhor/workflow-webhook@v3.0.8
with:
       event_name: 'drift-check'
       webhook_url: ${{ vars.DRIFT_CHECK_WEBHOOK_URL }}
       webhook_secret: 'TestPassword'
       data: '{ "projectId": "1285", "groupId" : "grp_0001", "resourceId" : "5bc530b0-401c-5861-bce8-cccbf0ff25a1", "planOutput" : "2" }'

Payload:

{"event":"drift-check","repository":"dnv-cloud-infra/gssit-azure-webapp-iac","commit":"b739ebcf4625ff7897de579bfe664a905ab6e509","ref":"refs/heads/main","head":null,"workflow":"DriftCheck","requestID":"8ef0834a-326f-4eb5-970d-84510bbf19d6","data":{"projectId":"1285","groupId":"grp_0001","resourceId":"5bc530b0-401c-5861-bce8-cccbf0ff25a1","planOutput":"2"}}

Secret: TestPassword
SHA-256 signature: sha256=77e5604907ed911d5e402e8ef42b5f2ee666f1709ea81cd347d69e28330ba248
SHA1 signature: sha1=a4ad993d459da604fe1d4e4db36a5f789efdb756

Code Snippet:

const body = await request.text();
const hmac = crypto.createHmac('sha1', 'TestPassword');
hmac.update(body);  
const sha1Signature = 'sha1='+hmac.digest('hex');

Generated SHA1: sha1=ff2046bbfc2a4caf3b39d93504772291869dbdf2

Also I have tried to verify the signature using GitHub octokit library, but without any luck.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions