Skip to content

fix: audit codebase and improve reliability - #7

Merged
0xProgress merged 7 commits into
mainfrom
refactor/audit-and-improvements-2598846512191027867
Sep 16, 2026
Merged

0xProgress merged 7 commits into
mainfrom
refactor/audit-and-improvements-2598846512191027867

Conversation

@0xProgress

Copy link
Copy Markdown
Owner

Summary of Changes

This PR performs an audit-and-improve pass on webhookd following all 10 core invariants:

  1. Safety & Nil Checks:
    • Added defensive nil checks to server.NewHandler, output.NewWriter, and output.NewPrettyWriter to ensure fallback to io.Discard or graceful error handling rather than runtime panics.
    • Added validation in config.Load to ensure Host cannot be empty.
  2. Redundant Code & Constants:
    • Replaced duplicate error string literals in server/handler.go with package-level named constants (errMethodNotAllowed, errUnsupportedMediaType, errPayloadTooLarge, errUnknownProvider, errSigVerificationFailed, errInternal).
  3. Tests & Import Grouping:
    • Standardized import grouping in server/server_test.go (stdlib, blank line, internal).
    • Added unit test cases for nil EventWriter and nil io.Writer handling.
  4. Documentation:
    • Replaced broken links referencing docs/contributing/provider-guide.md in README.md and docs/providers/checklist.md with links to CONTRIBUTING.md.
    • Updated Docker usage in README.md to include --host 0.0.0.0 so container port forwarding functions as intended.
    • Updated SECURITY.md out-of-scope section to remove references to external community modules, reflecting the in-repo provider model.

Invariants Preserved

  • Unmodified go.mod, go.sum, docs/webhookd-core.md, providers/provider.go, and providers/registry.go.
  • All verification checks (go build, go vet, go test -race -count=1) pass clean.
  • Smoke test produces exact JSONL output on stdout and startup banner on stderr.

PR created automatically by Jules for task 2598846512191027867 started by @0xProgress

Audit and improve webhookd core codebase:
- Deduplicate HTTP error response strings in server/handler.go into named constants.
- Add defensive nil guards for server.New, server.NewHandler, output.NewWriter, and output.NewPrettyWriter to prevent request path panics.
- Validate non-empty host in config.Load.
- Fix import grouping in server/server_test.go and add tests for nil writer/output handling.
- Fix broken documentation links to non-existent provider-guide.md in README.md and docs/providers/checklist.md.
- Update Docker run command in README.md to specify --host 0.0.0.0.
- Update SECURITY.md out-of-scope references to align with in-repo provider architecture.

Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits September 16, 2026 22:45
Audit and improve webhookd core codebase:
- Deduplicate HTTP error response strings in server/handler.go into named constants.
- Add defensive nil guards for server.New, server.NewHandler, output.NewWriter, and output.NewPrettyWriter to prevent request path panics.
- Validate non-empty host in config.Load.
- Fix import grouping in server/server_test.go and add tests for nil writer/output handling.
- Fix broken documentation links in README.md and docs/providers/checklist.md.
- Update Docker run command in README.md to specify --host 0.0.0.0.
- Update SECURITY.md out-of-scope references to align with in-repo provider architecture.
- Pin GitHub Actions workflows (.github/workflows/*.yml) to full-length commit SHAs.

Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
Audit and improve webhookd core codebase:
- Deduplicate HTTP error response strings in server/handler.go into named constants.
- Add defensive nil guards for server.New, server.NewHandler, output.NewWriter, and output.NewPrettyWriter to prevent request path panics.
- Validate non-empty host in config.Load.
- Fix import grouping in server/server_test.go and add tests for nil writer/output handling.
- Fix broken documentation links in README.md and docs/providers/checklist.md.
- Update Docker run command in README.md to specify --host 0.0.0.0.
- Update SECURITY.md out-of-scope references to align with in-repo provider architecture.
- Pin GitHub Actions workflows (.github/workflows/*.yml) to full-length commit SHAs.

Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

google-labs-jules Bot and others added 2 commits September 16, 2026 23:06
Audit and improve webhookd core codebase:
- Deduplicate HTTP error response strings in server/handler.go into named constants.
- Add defensive nil guards for server.New, server.NewHandler, output.NewWriter, and output.NewPrettyWriter to prevent request path panics.
- Validate non-empty host in config.Load.
- Fix import grouping in server/server_test.go and add tests for nil writer/output handling.
- Fix broken documentation links in README.md and docs/providers/checklist.md.
- Update Docker run command in README.md to specify --host 0.0.0.0.
- Update SECURITY.md out-of-scope references to align with in-repo provider architecture.
- Pin GitHub Actions workflows (.github/workflows/*.yml) to full-length commit SHAs and add install-mode: goinstall for golangci-lint.

Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
Audit and improve webhookd core codebase:
- Fix .golangci.yml configuration schema by removing unsupported keys (version, linters.default, formatters).
- Pin golangci-lint version to v1.64.8 in CI workflow.
- Deduplicate HTTP error response strings in server/handler.go into named constants.
- Add defensive nil guards for server.New, server.NewHandler, output.NewWriter, and output.NewPrettyWriter to prevent request path panics.
- Validate non-empty host in config.Load.
- Fix import grouping in server/server_test.go and add tests for nil writer/output handling.
- Fix broken documentation links in README.md and docs/providers/checklist.md.
- Update Docker run command in README.md to specify --host 0.0.0.0.
- Update SECURITY.md out-of-scope references to align with in-repo provider architecture.
- Pin GitHub Actions workflows (.github/workflows/*.yml) to full-length commit SHAs.

Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
@0xProgress 0xProgress self-assigned this Sep 16, 2026
@0xProgress 0xProgress changed the title refactor: audit codebase and improve reliability fix: audit codebase and improve reliability Sep 16, 2026
Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 16, 2026 23:36
Co-authored-by: 0xProgress <283969857+0xProgress@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The release workflow uses invalid action pins, and the lint configuration is incompatible with the CI tool version.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR improves webhookd reliability through defensive checks, configuration validation, documentation updates, and pinned CI actions.

Changes:

  • Added nil handling, host validation, error constants, and tests.
  • Updated Docker/provider documentation.
  • Pinned workflow actions and revised lint configuration.
File summaries
File Description
server/server.go Guards webhook route registration.
server/server_test.go Adds nil-writer tests and import updates.
server/handler.go Adds error constants and nil handling.
SECURITY.md Updates scope guidance.
README.md Fixes links and Docker host binding.
output/writer.go Discards nil output safely.
output/pretty.go Discards nil output safely.
main.go Formatting-only change.
docs/providers/checklist.md Updates contribution link.
config/config.go Rejects empty hosts.
cmd/root.go Formatting-only change.
.golangci.yml Revises lint configuration.
.github/workflows/release.yml Pins release actions.
.github/workflows/codeql.yml Pins CodeQL actions.
.github/workflows/ci.yml Pins CI actions.
Review details
  • Files reviewed: 13/16 changed files
  • Comments generated: 5
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
uses: docker/setup-buildx-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3

- uses: docker/login-action@v3
- uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
Comment thread .golangci.yml
Comment on lines 29 to 30
- gofmt
- goimports
Comment thread README.md
docker run --rm -p 8080:8080 \
-e GITHUB_WEBHOOK_SECRET=your_secret \
ghcr.io/0xprogress/webhookd:latest github
ghcr.io/0xprogress/webhookd:latest github --host 0.0.0.0
- [ ] I have read the provider's official webhook documentation
- [ ] I have read [CONTRIBUTING.md §"Adding a Provider"](../../CONTRIBUTING.md#adding-a-provider) end to end
- [ ] I have read [docs/contributing/provider-guide.md](provider-guide.md)
- [ ] I have read [CONTRIBUTING.md §"Adding a Provider"](../../CONTRIBUTING.md#adding-a-provider)
Copilot AI review requested due to automatic review settings September 16, 2026 23:40
@0xProgress
0xProgress merged commit 1a5b1a8 into main Sep 16, 2026
10 of 12 checks passed
@0xProgress
0xProgress deleted the refactor/audit-and-improvements-2598846512191027867 branch September 16, 2026 23:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The lint configuration and release workflow contain CI-blocking configuration and action-reference errors.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (4)

.golangci.yml:30

  • These entries were moved from the top-level formatters.enable block into linters.enable, even though the file still documents gofmt/goimports as formatters above. With the v2 configuration used before this change and version: latest in CI, golangci-lint will reject this configuration (and the deleted top-level version: "2" marker is also required); restore the v2 version marker and put these entries back under formatters.enable.
    - gofmt
    - goimports

.github/workflows/release.yml:36

  • This reuses the SHA pinned for docker/setup-qemu-action above, but action commit SHAs are scoped to their own repositories. The commit is not a valid docker/setup-buildx-action ref, so the release workflow will fail while loading this step; pin setup-buildx-action to its own v3 commit.
        uses: docker/setup-buildx-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3

.github/workflows/release.yml:38

  • This also reuses the setup-qemu commit for a different action repository. docker/login-action cannot resolve that repository-scoped SHA, so the release job will fail before GoReleaser runs; replace it with the login-action v3 commit.
      - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3

docs/providers/checklist.md:21

  • This new checklist item duplicates the preceding line's same CONTRIBUTING.md#adding-a-provider requirement, leaving the companion checklist with the same task twice. Remove the redundant line rather than adding a second copy.
- [ ] I have read [CONTRIBUTING.md §"Adding a Provider"](../../CONTRIBUTING.md#adding-a-provider)
  • Files reviewed: 13/16 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread README.md
docker run --rm -p 8080:8080 \
-e GITHUB_WEBHOOK_SECRET=your_secret \
ghcr.io/0xprogress/webhookd:latest github
ghcr.io/0xprogress/webhookd:latest github --host 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants