Skip to content

feat: add audit logger with actor #614

Closed

Description

@uniqueg

Problem

The permissions API logs lines such as "Policy rule '%s' added." without the actor, and there is no dedicated logger operators can route. cloud-registry documents this "no actor" gap.

Proposal

  • foca.audit.log(action, target, **fields) writes to logger foca.audit. The actor (subject, client, on_behalf_of) comes from the existing get_current_claims() and get_current_subject(); request_id is added once the request ID issue is done, but this issue doesn't wait for it.
  • Fields go in extra={"audit": {...}}, so a JSON formatter emits an object; text output appends them escaped (no log injection).
  • The permissions API (access_control_server.py) and the resource-role helpers (add_resource_role, remove_resource, ...) use it.
  • Docs: how to route foca.audit; GDPR note that the actor is personal data.

Acceptance criteria

  • Tests for actor extraction (with and without claims), escaping and every call site; 100% coverage.
  • Release notes mention the changed log message texts (not breaking).

Activity

  1. added this to the v0.21.0 milestone on Nov 3, 2026
  2. added
    priority: high
    status: triage
    type: security
    workload: days
    status: in progress
    on Nov 3, 2026
  3. removed
    status: in progress
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: highstatus: triagetype: securityworkload: days

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions