Files
gateway/.earthlyignore
e1a9e6aa83 feat: migrate audit log format to v2 with enhanced actor metadata (#74)
* feat: migrate audit log format to v2 with enhanced actor metadata

BREAKING CHANGE: Audit log format has been upgraded from v1 to v2

Changes:
- Add Actor object with identity, organization_id, stack_id, and ip_address
- Extract organization_id and stack_id from STACK env var (format: "ORG-STACK")
- Extract IP address with fallback chain: X-Forwarded-For > X-Real-IP > RemoteAddr
- Extract trace_id from OpenTelemetry context
- Restructure payload: move request/response into HTTP object
- Add utility functions: parseStackEnv(), extractIPAddress(), extractTraceID()

The new format provides better traceability and context for audit events:
- Actor information centralized in dedicated object
- OpenTelemetry integration for distributed tracing
- Client IP tracking for security analysis
- Organization and stack identification from environment

Modified files:
- internal/audit/messages/audit.go: New types, utility functions, updated payload structure
- pkg/plugins/audit.go: Pass context and request to NewAuditMessagePayload()

* fix: pre-commit

* feat: Upgrade to go-libs/v3

* feat: Enhance audit plugin with authentication metadata and JWT verification

* fix: update go-jose dependency to v4.0.5 and adjust indirect requirement to v3.0.4

* fix: set HTTP client timeout to 30 seconds in initKeySet function

* chore: make auth optional and add all claims instead of just the subject

---------

Co-authored-by: Geoffrey Ragot <[email protected]>
2025-11-13 15:07:05 +01:00

2 lines
19 B
Plaintext