Skip to content

feat: add audit middleware to webhooks server#154

Merged
gfyrag merged 3 commits into
mainfrom
feat/audit-middleware
May 22, 2026
Merged

feat: add audit middleware to webhooks server#154
gfyrag merged 3 commits into
mainfrom
feat/audit-middleware

Conversation

@gfyrag
Copy link
Copy Markdown
Contributor

@gfyrag gfyrag commented May 22, 2026

Summary

  • Wire httpaudit.Middleware from go-libs/v5 into the webhooks HTTP handler to capture and publish audit events
  • Add publish.FXModuleFromFlags to the serve command's fx options to provide a message.Publisher in the DI container
  • Pass the publisher through the fx wiring in module.go and into newServerHandler() in handler.go

These audit commits were lost when the upgrade PR was squash-merged.

Test plan

  • Verify the webhooks server starts correctly with the audit middleware enabled
  • Confirm audit events are published to the audit-events topic when HTTP requests are made
  • Ensure the worker mode still functions correctly (publish module was already wired there)

🤖 Generated with Claude Code

Wire httpaudit.Middleware from go-libs/v5 into the webhooks HTTP handler
to capture and publish audit events via the existing Watermill publisher
infrastructure. This was lost when the upgrade PR was squash-merged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gfyrag gfyrag requested a review from a team as a code owner May 22, 2026 14:15
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

Warning

Rate limit exceeded

@gfyrag has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 51 minutes and 29 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b30176fd-74a0-461d-904f-b904a5788b3f

📥 Commits

Reviewing files that changed from the base of the PR and between e22e7f7 and ab476ad.

⛔ Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (4)
  • cmd/serve.go
  • pkg/server/handler.go
  • pkg/server/module.go
  • pkg/worker/module.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/audit-middleware

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Dav-14
Dav-14 previously approved these changes May 22, 2026
The publisher is already provided by the worker module. Adding it again
in serve.go causes an fx "already provided" conflict.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move publish.FXModuleFromFlags to serve.go so the publisher is available
in both server-only and worker modes. Previously it was only in the
worker module, causing a missing dependency when running without --worker.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@gfyrag gfyrag enabled auto-merge (squash) May 22, 2026 15:05
@gfyrag gfyrag merged commit 5ff3c4c into main May 22, 2026
6 checks passed
@gfyrag gfyrag deleted the feat/audit-middleware branch May 22, 2026 15:42
gfyrag added a commit that referenced this pull request May 22, 2026
* feat: add audit middleware to webhooks server

Wire httpaudit.Middleware from go-libs/v5 into the webhooks HTTP handler
to capture and publish audit events via the existing Watermill publisher
infrastructure. This was lost when the upgrade PR was squash-merged.



* fix: remove duplicate publish module registration

The publisher is already provided by the worker module. Adding it again
in serve.go causes an fx "already provided" conflict.



* fix: move publish module from worker to serve

Move publish.FXModuleFromFlags to serve.go so the publisher is available
in both server-only and worker modes. Previously it was only in the
worker module, causing a missing dependency when running without --worker.



---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants