Skip to content

feat(admin): security audit logging and outbound webhooks event system - #29

Merged
AmanKrSahu merged 3 commits into
mainfrom
dev
Sep 4, 2026
Merged

AmanKrSahu merged 3 commits into
mainfrom
dev

Conversation

@AmanKrSahu

Copy link
Copy Markdown
Owner

Executive Summary

This release branch merges verified Security Audit Logging (Task 2.23 / FR-2) and the Webhooks & Outbound Event System (Task 3.1 / FR-3) from the dev branch into main. The release establishes immutable audit trails across all critical authentication, session, and administrative lifecycles, and provides an enterprise-ready outbound webhook engine with cryptographic HMAC-SHA256 signature verification, SSRF protection, 24-hour dual-secret rotation grace windows, and automated exponential backoff retries.

All changes have undergone automated end-to-end integration testing, code formatting, static analysis, and type checking in simulated production environments. Merging this PR elevates AuthKit's enterprise readiness, compliance posture, and external platform integrability.


Feature & Capabilities Scorecard

Feature Area Task ID Priority Capability Details
Security Audit Logging FR-2 (2.23) P1 Centralized, asynchronous audit logging across 100% of mutation flows (Auth, MFA, OIDC, Sessions, Admin). Structured JSON metadata with automatic sensitive field sanitization.
Admin Audit Query API FR-2 (2.23) P1 High-throughput GET /api/v1/admin/audit-logs endpoint featuring cursor-based pagination and multi-dimensional filtering (userId, action, status, startDate, endDate).
Shared Event Catalog FR-3 (3.1) P1 Standardized domain event taxonomy covering 24 distinct event types with versioned envelopes (evt_<id>, type, version, timestamp, data) and wildcard * subscription matching.
Outbound Webhooks Delivery FR-3 (3.1) P1 Reliable HTTP dispatching with HMAC-SHA256 signature headers (X-Webhook-Signature: t=...,v1=...), configurable timeouts (5s), and response body truncation (10 KB max).
SSRF Guard & URL Safety FR-3 (3.1) P1 Active DNS resolution and IP validation blocking private IPv4/IPv6 ranges (RFC 1918, RFC 3927, Loopback, Link-Local) and cloud metadata endpoints prior to HTTP dispatch.
Dual-Secret Rotation FR-3 (3.1) P1 Zero-downtime secret rotation providing a 24-hour grace window where webhooks emit both v1 (current secret) and v1_old (previous secret) signatures.
Backoff Retries & Circuit Breaker FR-3 (3.1) P1 Exponential retry schedules (10s, 1m, 5m, 15m), Retry-After header parsing, automatic subscription disabling after 10 consecutive failures, and background queue worker recovery.
Admin Webhooks Management FR-3 (3.1) P1 Complete REST suite under /api/v1/admin/webhooks for subscription CRUD, secret rotation, live ping/test deliveries, and detailed delivery attempt audits.

Database & Schema Migration

1. New Prisma Models & Indexes

Merging this release introduces three new database models:

  • AuditLog: Stores immutable event records with composite indexes on userId, action, createdAt, and ipAddress.
  • WebhookSubscription: Manages endpoint URLs, active event subscriptions, failure counters, and signing secrets (secret, previousSecret, previousSecretExpiresAt).
  • WebhookDelivery: Tracks every webhook dispatch attempt, HTTP response status codes, latencies, error codes, and sanitized payload/response records.

2. Migration Execution

Run the following migration command during the production deployment pipeline:

pnpm prisma migrate deploy

Documentation & API Artifacts Synchronization

  • README.md: Updated feature capabilities and architecture descriptions to reflect audit logging and outbound webhook integrations.
  • docs/api_endpoints.md: Expanded Section 7 (Admin) with comprehensive references for 7.4 Security Audit Logs (/admin/audit-logs) and 7.5 Webhooks (/admin/webhooks).
  • Postman Collection (docs/api-specs/AuthKit.postman_collection.json): Added the Webhooks & Outbound Events request suite inside 08. Admin Controls & Role Management with automated test assertions.
  • OpenAPI Specification (docs/api-specs/openapi.json): Exported complete OpenAPI 3.0 schemas, parameters, and response structures categorized under Admin - Audit Logs and Admin - Webhooks.
  • Roadmap Tracker (docs/audit/2026-07-20/task.md): Updated Task 2.23 and Task 3.1 statuses to Done.

QA & Sign-Off Verification

  • Automated Test Suite: 20/20 test suites passed (93/93 tests passing) spanning unit, integration, SSRF security, and end-to-end live receiver tests.
  • TypeScript Compilation: Compiled with 0 errors via pnpm type-check (tsc --noEmit).
  • Code Quality & Style: Passed cleanly via pnpm lint (eslint) and pnpm format:check (prettier).
  • Bundle Build: Verified successful production bundling via pnpm build (tsup + OpenAPI generation).

@AmanKrSahu
AmanKrSahu merged commit 2a423ba into main Sep 4, 2026
3 checks passed
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.

1 participant