Commit Graph

18 Commits

Author SHA1 Message Date
Andras Bacsai a2096c6f68 feat(observability): add structured audit log channel for API and webhook events
Introduce a dedicated `audit` log channel (daily rotation, configurable retention via
LOG_AUDIT_DAYS) and a small `auditLog()` / `auditLogWebhookFailure()` helper used to
record state-changing API operations and webhook events.

Instrumented:

- API mutation endpoints (create / update / delete / start / stop / restart) across
  applications, services, databases (incl. backups, env vars, storage), servers,
  projects + environments, scheduled tasks, private keys, GitHub apps, cloud provider
  tokens, Hetzner server provisioning, instance enable/disable.
- Webhook signature verification outcomes for GitHub, GitLab, Bitbucket, Gitea and
  Stripe, plus the Sentinel push endpoint.
- Authentication and authorization outcomes via the global exception handler and
  the `ApiAbility` middleware (unauthenticated, ability-denied, policy-denied).

The helper is wrapped in try/catch so logging failures never affect the request
path. Successful operations log at `info`; suspicious/denied requests log at
`warning`. Operators wanting a failures-only feed can set `LOG_AUDIT_LEVEL=warning`.

Includes a feature test suite covering the helper, the webhook providers and the
new auth/authorization log paths.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 14:50:37 +02:00
Andras Bacsai 158d54712f Remove webhook maintenance mode replay feature
This feature stored incoming webhooks during maintenance mode and replayed them
when maintenance ended. The behavior adds unnecessary complexity without clear
value. Standard approach is to let webhooks fail during maintenance and let
senders retry.

Removes:
- Listener classes that handled maintenance mode events and webhook replay
- Maintenance mode checks from all webhook controllers (Github, Gitea, Gitlab, Bitbucket, Stripe)
- webhooks-during-maintenance filesystem disk configuration
- Feature mention from CHANGELOG

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 13:36:32 +01:00
Andras Bacsai d9ebf3b142 refactor(webhook): remove Webhook model and related logic; add migrations to drop webhooks and kubernetes tables 2025-09-10 19:35:53 +02:00
Andras Bacsai 377758edcd fix stripe webhooks 2024-11-22 14:42:10 +01:00
Andras Bacsai 1faa8be615 fix: cloud + stripe related 2024-11-11 22:18:15 +01:00
Andras Bacsai 4fa533aae8 Refactor webhook event handling logic 2024-11-01 00:07:01 +01:00
Andras Bacsai 5ce2422b90 fix: stripe webhooks
fix: add custome created webhook
2024-10-31 23:26:40 +01:00
Lucas Michot d557a22b91 Remove all ray() calls 2024-10-28 13:51:23 +01:00
Andras Bacsai 38d9999814 refactor: Simplify code for retrieving subscription in Stripe webhook 2024-07-06 13:47:43 +02:00
Andras Bacsai 920305432b feat: Improve internal notification message for early fraud warning webhook 2024-07-05 20:31:19 +02:00
Andras Bacsai 42fb8ab379 feat: early fraud warning webhook 2024-07-05 20:25:53 +02:00
Andras Bacsai 613e980267 fix: cleanup subs in cloud 2024-06-27 12:48:37 +02:00
Andras Bacsai 73692a0c73 fix: remove cloud stripe notifications 2024-06-24 11:52:12 +02:00
Thijmen d86274cc37 Fix styling 2024-06-10 20:43:34 +00:00
Andras Bacsai 2f621279c2 chore: Add null checks for team in Stripe webhook 2024-05-27 14:14:31 +02:00
Andras Bacsai c30185c6ae feat: Handle incomplete expired subscriptions in Stripe webhook 2024-05-27 12:03:48 +02:00
Andras Bacsai 7b4d8a8f05 wip: new pricing 2024-04-12 15:48:56 +02:00
Andras Bacsai 54923b7640 feat: collect webhooks during maintenance 2024-03-01 14:04:29 +01:00