Skip to content

🐛 Bug Report: Appwrite should skip signature validation if_APP_VCS_GITHUB_WEBHOOK_SECRET is empty #6112

Closed

Description

@stnguyen90

👟 Reproduction steps

  1. Set up Git Integration but leave the _APP_VCS_GITHUB_WEBHOOK_SECRET env var empty in Appwrite and the Webhook secret blank in github
  2. Update your linked repository to trigger a webhook event

👍 Expected behavior

The webhook works to trigger appwrite

👎 Actual Behavior

Error:

appwrite  | [Error] Timestamp: 2023-09-01T17:29:41+00:00
appwrite  | [Error] Method: POST
appwrite  | [Error] URL: /v1/vcs/github/events
appwrite  | [Error] Type: Appwrite\Extend\Exception
appwrite  | [Error] Message: Invalid webhook signature.
appwrite  | [Error] File: /usr/src/code/app/controllers/api/vcs.php
appwrite  | [Error] Line: 801

It seems when you leave it blank, the x-hub-signature-256 header from GitHub is blank, so, this line:

$valid = $github->validateWebhookEvent($payload, $signature, $signatureKey);

ends up being:

$valid = $github->validateWebhookEvent($payload, '', '');

which means this line:

    public function validateWebhookEvent(string $payload, string $signature, string $signatureKey): bool
    {
        return $signature === ('sha256=' . hash_hmac('sha256', $payload, $signatureKey));
    }

returns false.

🎲 Appwrite version

Version 1.4.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Activity

  1. added
    bug
    on Sep 1, 2023
  2. added this to the 1.4.2 milestone on Sep 1, 2023
  3. added
    product / functions
    on Sep 1, 2023
  4. changed the title [-]🐛 Bug Report: _APP_VCS_GITHUB_WEBHOOK_SECRET is required[/-] [+]🐛 Bug Report: Appwrite should skip signature validation if_APP_VCS_GITHUB_WEBHOOK_SECRET is empty[/+] on Sep 1, 2023
  5. moved this to In Progress in 1.4 releaseon Sep 1, 2023
  6. modified the milestones: 1.4.2, 1.4.3 on Sep 2, 2023
  7. moved this from In Progress to Code Review in 1.4 releaseon Sep 6, 2023
  8. moved this from Code Review to Done in 1.4 releaseon Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugproduct / functions

Type

No type

Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions