Skip to content

Backend - Add admin endpoint to list and filter audit events by actor and type #492

@1nonlypiece

Description

@1nonlypiece

Backend - Add admin endpoint to list and filter audit events by actor and type

Description

src/app/api/admin/audit-events/route.ts returns audit events but lacks filtering. Add query support to filter by actor address, event type, and time range using the audit schema in src/lib/backend/auditLog.ts, keeping the endpoint admin-gated.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Filter by actor, type, and time range with validation
  • Keep admin gating via requireAuth.ts
  • Reuse src/lib/backend/pagination.ts
  • Redact sensitive fields in responses

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b feature/audit-events-filtering
  • Implement changes
    • Update src/app/api/admin/audit-events/route.ts
    • Extend src/app/api/admin/audit-events/route.test.ts
    • Update docs/backend-api-reference.md
    • Add filter validation
  • Test and commit
    • Run tests, cover edge cases
    • Include test output and notes

Example commit message

feat: add actor/type/time filtering to audit-events endpoint

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave programapiAPI routes, request/response contractsbackendBackend/API implementationsecuritySecurity hardening, headers, threat modeling

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions