Skip to content

feat: opt-in service clients that own their tasks #517

Done

Description

@uniqueg

Why

A workflow engine (Conquest at CERIT) is to send tasks to proTES with its own service token (client credentials grant: client_id = sub = aud = its client ID, typ at+jwt), and proTES relays them to the TES backends with its own per-backend client-credentials tokens, as for all tasks. proTES refuses service clients today: pro_tes/app.py calls FOCA's require_no_service_clients() on startup.

Sibling of #514 (opt-in service client role for production smoke tests): this issue is the core both need (service clients as owners of their tasks, the adapted startup refusal, the audience rule); #514 adds on top what smoke tests need (backend flag, forwarding the client's own token to flagged backends).

Proposal

Opt-in, off by default; nothing changes without service clients.

  • Allow list: FOCA's security.auth.service_clients, each with an explicit issuer and client_id, mapped to the role user (only) in security.access_control.client_mapping.
  • A listed client's own service token may create tasks; the client owns them (client:<client ID>, also in user_id) and lists, reads and cancels its own tasks only; it sees no tasks of others and others don't see its tasks; no admin rights.
  • Tasks are relayed with proTES' own credentials; the client's token is never forwarded.
  • Startup refusal adapted: refuse on_behalf_of_header and clients with on_behalf_of, clients without issuer, clients without the role user or with another role, and proTES' own client (PROTES_CLIENT_ID). Warn if a client's ID is no accepted audience.
  • Audience: identity providers may put only the client's own ID into aud, so deployments add it to security.auth.audience. That ID is accepted for that client's own service tokens only: other tokens whose only accepted audiences are service-client IDs (e.g., users' tokens obtained by the client, also by token exchange, after which the current identity provider keeps the exchanging client in aud) are rejected with 401 on all endpoints.
  • Leaves room for token exchange (feat: exchange user tokens per TES backend #501): an exchanged user token for proTES' audience is a user token and owned by the user; acting for users stays refused.

Acceptance criteria

  • Default config: no change; tokens for a client's own audience are rejected.
  • A listed client creates tasks and lists, reads and cancels its own; users, other clients and admins can't see or cancel them, and the client can't see theirs.
  • The startup checks above, each with a test.
  • Tokens for a service client's audience that aren't its own service tokens are rejected on the TES API, the plugin listing and the permissions API.
  • Unit and API tests with the mock identity provider; the smoke test (fake identity provider and fake TES backend that requires proTES' token) covers a client's task end to end.
  • Docs: access control (new section), configuration, operations, upgrading.

Activity

  1. self-assigned this
    on Nov 25, 2026
  2. added
    priority: high
    status: in progress
    type: auth
    workload: hours
    ecp-wp4: M4.4
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ecp-wp4: M4.4priority: highstatus: in progresstype: authworkload: hours

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions