Skip to content

fix(backend): mount auditLogsRouter in app.ts, add rate limit bucket, and validate query schema - #694

Open
kosisochukwu1234 wants to merge 1 commit into
codebestia:devfrom
kosisochukwu1234:fix/mount-audit-logs-router-dev
Open

kosisochukwu1234 wants to merge 1 commit into
codebestia:devfrom
kosisochukwu1234:fix/mount-audit-logs-router-dev

Conversation

@kosisochukwu1234

Copy link
Copy Markdown

Description

Resolves an issue where GET /audit-logs was unreachable (returning 404 on the running Express server) because auditLogsRouter was defined in apps/backend/src/routes/auditLogs.ts but never mounted in apps/backend/src/app.ts.

Summary of Changes:

  1. Mount Route: Mounted app.use('/audit-logs', auditLogsRouter) in apps/backend/src/app.ts after the global rate limiter and security router.
  2. Rate Limiting: Added audit_logs bucket (30 / min) to apps/backend/src/config/rateLimits.ts and attached rateLimit('audit_logs') to auditLogsRouter.
  3. Query Parsing: Replaced hand-parsed action, limit, and cursor query parameters with AuditLogsQuerySchema (using Zod) while preserving existing 400 response formats for unknown action filters.
  4. Docs & Tests: Documented the new rate limit bucket in docs/security/rate-limits.md and added a test in apps/backend/src/__tests__/auditLog.test.ts requesting /audit-logs through app to verify reachability.

Closes #648

@kosisochukwu1234 kosisochukwu1234 changed the title fix(backend): mount auditLogsRouter in app.ts, add rate limit bucket,… fix(backend): mount auditLogsRouter in app.ts, add rate limit bucket, and validate query schema Oct 26, 2026
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