Skip to content

Plugin Principal differs from access control identity #519

Closed

Description

@uniqueg

Found in the pre-release review of v0.18.0 (finding 4, medium).

Problem

  • Principal.groups (foca/plugins/adapter.py, current_principal) comes only from get_current_groups(). It leaves out roles that is_permitted() and is_admin() use: the role a service client gets through access_control.client_mapping, and roles from global g rules.
  • Principal.subject is the bare client subject for service tokens (not client:<id>), and it ignores the user named in on_behalf_of_header, although the ownership helpers attribute resources to that user.
  • The docs say plugin roles "are access control roles" and that subject is the identity "as stored with resources".

Scenario

  • client_mapping: {portal: admin} and a plugin or preset with roles: [admin]: access control treats portal as admin, but the engine refuses its choice with a generic 400 (fails closed).
  • A plugin keying quotas or provenance on Principal.subject sees portal for every user the portal acts for; with a single issuer that value shares a namespace with user subjects.

Fix

  • Derive Principal.groups from the same source as access control (client_mapping, g rules).
  • Add a subject type (or use client:<id>) for service tokens.
  • Expose the on-behalf-of user.
  • Add an unmocked test; keep docs/plugins.md and docs/configuration/plugins.md consistent (proTES relies on these semantics).

Activity

  1. added this to the v0.18.0 milestone on Oct 26, 2026
  2. added
    priority: medium
    status: triage
    type: auth
    type: bug
    type: security
    workload: hours
    on Oct 26, 2026
  3. added
    status: in progress
    and removed
    status: triage
    on Oct 26, 2026
  4. removed
    status: in progress
    on Oct 26, 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: mediumtype: authtype: bugtype: securityworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions