fix: address webhook review followups#3
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the coven_github_adapter WSGI webhook entrypoint by adding stricter request body handling and improving signature header normalization, aligning with the repo’s role as a thin, always-on forwarder that must safely validate and forward GitHub webhook deliveries.
Changes:
- Add a 10 MB webhook body cap and return
413 Payload Too LargewhenCONTENT_LENGTHindicates an oversized request. - Read request bodies safely when
CONTENT_LENGTHis missing or unparsable (bounded read). - Normalize
X-Hub-Signature-256by trimming surrounding whitespace and add tests for these branches (including missing-secret misconfiguration).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
coven_github_adapter.py |
Adds request-size limiting, bounded body reads for missing/invalid CONTENT_LENGTH, and signature header trimming. |
tests/test_webhook_adapter.py |
Extends test harness to vary CONTENT_LENGTH and adds coverage for the new body/signature/misconfiguration branches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
413 Payload Too Largebefore signature verification.CONTENT_LENGTHis missing or unparsable.X-Hub-Signature-256and cover the unconfigured-secret branch.Why
Copilot left unresolved review threads on #2 for body handling, request-size hardening, signature normalization, and missing misconfiguration coverage. This PR addresses those follow-ups directly.
Verification
python3 -m unittest discover -s tests -vpython3 -m py_compile coven_github_adapter.py tests/test_webhook_adapter.pygit diff --checkscripts/smoke-webhook.sh http://127.0.0.1:8765/webhook smoke-secret