You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(auth): implement audit log filtering by client_id (#118)
* chore(conductor): Add new track 'Add Audit Log Filtering by Client'
* feat(auth): add clientID filter to AuditLogRepository and AuditLogUseCase
* feat(auth): implement clientID filter in PostgreSQL and MySQL AuditLog repositories
* feat(database): add index for client_id on audit_logs table
* conductor(checkpoint): Checkpoint end of Phase 1
* conductor(plan): Mark Phase 1 as complete
* feat(auth): implement clientID filter in AuditLogUseCase and metrics decorator
* conductor(checkpoint): Checkpoint end of Phase 2
* conductor(plan): Mark Phase 2 as complete
* feat(auth): implement client_id filter in AuditLogHandler
* conductor(checkpoint): Checkpoint end of Phase 3
* conductor(plan): Mark Phase 3 as complete
* docs(audit): document client_id filter and add integration tests
* conductor(checkpoint): Checkpoint end of Phase 4
* conductor(plan): Mark Phase 4 as complete
* chore(conductor): Mark track 'Add Audit Log Filtering by Client' as complete
* docs(conductor): Synchronize docs for track 'Add Audit Log Filtering by Client'
* chore(conductor): Archive track 'Add Audit Log Filtering by Client'
* feat(auth): implement audit log filtering by client_id
Added the ability to filter audit logs by a specific client ID via the API, including database optimizations and full-stack support.
Key changes:
- API: Added optional client_id query parameter to the audit logs list endpoint.
- Logic: Updated Repository and Use Case layers to support clientID filtering.
- Database: Created migrations to add an index on client_id in the audit_logs table for PostgreSQL and MySQL.
- Observability: Updated the metrics decorator to include the new filter parameter.
- Testing: Added unit tests for all layers and a new integration test case in auth_flow_test.go.
- Documentation: Updated OpenAPI specifications and audit log reference guides.
# Specification: Add Audit Log Filtering by Client
2
+
3
+
## Overview
4
+
Currently, audit logs can be retrieved and filtered by date range. This track adds the ability to filter audit logs by a specific Client ID (UUID) via the API.
5
+
6
+
## Functional Requirements
7
+
-**API Filtering:** The `GET /v1/audit-logs` endpoint must support an optional `client_id` query parameter.
8
+
-**Repository Support:** The `AuditLogRepository` must implement filtering by `client_id` in its `ListCursor` method for both PostgreSQL and MySQL implementations.
9
+
-**UseCase Support:** The `AuditLogUseCase` must pass the `client_id` filter from the handler to the repository.
10
+
-**Validation:** The `client_id` provided in the query parameter must be a valid UUID.
11
+
-**Empty Results:** If no audit logs match the specified `client_id`, the API should return an empty list with a `200 OK` status.
12
+
-**Documentation:**
13
+
- Update `docs/observability/audit-logs.md` to document the new `client_id` filter.
14
+
- Update `docs/openapi.yaml` to include the `client_id` query parameter for the audit logs list endpoint.
15
+
-**Integration Tests:**
16
+
- Update `test/integration/auth_flow_test.go` to include a test case for filtering audit logs by Client ID.
17
+
18
+
## Non-Functional Requirements
19
+
-**Performance:** Ensure that the database query for filtering by `client_id` is performant.
20
+
-**Consistency:** Maintain existing cursor-based pagination and date filtering logic.
21
+
22
+
## Acceptance Criteria
23
+
-[ ]`GET /v1/audit-logs?client_id=<uuid>` returns only logs belonging to that client.
24
+
-[ ] Providing an invalid UUID for `client_id` returns a `400 Bad Request` error.
25
+
-[ ] If `client_id` is omitted, the API continues to return logs for all clients (existing behavior).
26
+
-[ ] Filtering by `client_id` works correctly in combination with `created_at_from` and `created_at_to` filters.
27
+
-[ ] Filtering by `client_id` works correctly with cursor-based pagination (`after_id`).
28
+
-[ ]`docs/observability/audit-logs.md` correctly reflects the new filtering capability.
29
+
-[ ]`docs/openapi.yaml` includes the new `client_id` query parameter.
30
+
-[ ] Integration tests in `test/integration/auth_flow_test.go` pass and verify the new filtering behavior.
31
+
-[ ] PostgreSQL implementation is verified with integration tests.
32
+
-[ ] MySQL implementation is verified with integration tests.
33
+
34
+
## Out of Scope
35
+
- Filtering by Client Name.
36
+
- Adding filtering to the CLI `audit-log list` command.
Copy file name to clipboardExpand all lines: conductor/product.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ To provide a secure, developer-friendly, and lightweight secrets management plat
17
17
-**Tokenization Engine:** Format-preserving tokens for sensitive data types like credit card numbers.
18
18
-**Auth Token Revocation:** Immediate invalidation of authentication tokens (single or client-wide) with full state management.
19
19
-**Client Secret Rotation:** Self-service and administrative rotation of client secrets with automatic auth token revocation.
20
-
-**Audit Logs:** HMAC-signed audit trails capturing every access attempt and policy evaluation.
20
+
-**Audit Logs:** HMAC-signed audit trails capturing every access attempt and policy evaluation, with support for advanced filtering by client and date range.
21
21
-**KMS Integration:** Native support for AWS KMS, Google Cloud KMS, Azure Key Vault, and HashiCorp Vault.
0 commit comments