Skip to content

feat(server): visibility-aware kb.audit queries #232

@plind-junior

Description

@plind-junior

What you're trying to do

gbrain's audit is per-user visibility-filtered (the "company brain" pattern). Vouch's kb.audit returns every event; once #2 (multi-dim scopes) lands, a reviewer with project-scope-A should not see project-scope-B's audit events. Bake the filter into the audit reader so the visibility model is enforced by the read path, not by the caller.

Suggested shape

  • kb.audit accepts a viewer_scope: ScopeSpec param (passed by the transport's auth layer).
  • audit.read_events filters events whose object_ids reference artifacts outside viewer_scope.
  • Fallback: events with no object_ids (e.g. kb.init) are visible to everyone.

Acceptance

  • A two-project KB with reviewer A in project-A sees no project-B events.
  • A fuzz test asserts no project leak across viewers (mirrors gbrain's "zero leaks" claim).

Out of scope

  • Encrypted audit log entries (visibility is filtering; encryption is a separate ask).
  • Cross-viewer aggregate queries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    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