feat(github-app): Phase 1 webhook receiver foundation (#246)#289
Draft
ChrisJr404 wants to merge 3 commits intoPwnKit-Labs:mainfrom
Draft
feat(github-app): Phase 1 webhook receiver foundation (#246)#289ChrisJr404 wants to merge 3 commits intoPwnKit-Labs:mainfrom
ChrisJr404 wants to merge 3 commits intoPwnKit-Labs:mainfrom
Conversation
Lays the in-tree groundwork for the GitHub App distribution path discussed in PwnKit-Labs#246, scoped strictly to the foundation so the architecture can be reviewed before the scan/comment pipeline lands. What's in: - src/github_app/webhook.rs — HMAC-SHA256 signature verification with constant-time comparison via hmac::Mac::verify_slice, plus the EventKind router enum that maps X-GitHub-Event values to the routed kinds (Installation, PullRequest, Ping, Other). 10 unit tests pin the verification contract: known-good vector, modified body, wrong secret, missing/empty/non-hex/short-length digest, trailing-whitespace tolerance, and the kind-routing map. - src/bin/foxguard_github_app.rs — axum HTTP server with /healthz and /webhook endpoints. Verifies signatures, routes by event, returns 202 for known kinds, 401 for verification failures, with actual handler bodies stubbed and clearly TODO-marked. 1 MiB request-body cap layered in front of the handler. - Dockerfile.github-app — multi-stage build that compiles the receiver with the github-app feature, drops to a non-root user, exposes :8080. Refuses to start without FOXGUARD_WEBHOOK_SECRET. - src/github_app/README.md — what's here, what's next, how to run. Build is gated behind a new `github-app` feature flag so the default `cargo build` remains untouched. Optional deps (axum, tokio, hmac, hex, tower-http, tracing) only enter the dependency closure when the feature is enabled, keeping the core scanner crate lean for users who only want the CLI. What's NOT here (deliberately deferred for follow-up review): - JWT-based App→installation auth (jsonwebtoken dep). - pull_request handler: clone, scan, comment with --github-pr. - installation handler + persistent install metadata. - Check Runs API for inline annotations. Verified locally: cargo build → clean cargo build --features github-app --bin foxguard-github-app → clean cargo test --lib → 413 ok cargo test --features github-app --lib → +10 ok
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Draft — opening for architecture review before sinking another round of work into this. Scoped strictly to the Phase-1 foundation called out in #246 so the bones can land cleanly first; the actual scan/comment pipeline is staged as the immediate follow-up.
What's in
Webhook signature verification (`src/github_app/webhook.rs`)
Webhook server (`src/bin/foxguard_github_app.rs`)
Self-hosting (`Dockerfile.github-app`)
Build gating
New `github-app` Cargo feature flag. The optional dep closure (axum, tokio, hmac, hex, tower-http, tracing, tracing-subscriber) only enters the build when the feature is enabled, so the default `cargo build` and the `foxguard-mcp` binary stay untouched. Verified:
```
cargo build → clean
cargo build --features github-app --bin foxguard-github-app → clean
cargo test --lib → 413 existing tests still ok
cargo test --features github-app --lib → 10 new tests added, all green
```
What's NOT in
Deliberately deferred so the architecture above can land in isolation. Each is the next PR:
Open questions for you
Test plan