Repository navigation
Description
Context
We want automated end-to-end smoke tests of the real deployments, including proTES, with a dedicated LS Login client
(client credentials grant; tokens typ at+jwt, client_id = sub = the client ID, no entitlements). Such tests are
valuable, also for security: they show that a deployment refuses what it should, not only that it runs.
Low priority, not on the critical path.
Current behaviour
pro_tes/app.py:68calls FOCA'srequire_no_service_clients(app.app)aftercreate_app(); it raises at startup if
security.auth.service_clientsorsecurity.auth.on_behalf_of_headeris set (foca/security/auth.py:313).- Rationale in
pro_tes/security.py(check_task_ownership): tasks are owned by the users of the access tokens only. - So no client token can call proTES at all, not even for its own tasks.
The refusal protects the token forwarding: proTES forwards the caller's token to the TES backends. Forwarding its own
token is itself a workaround until full token exchange (RFC 8693), so the hard refusal protects nothing that goes to
production in that form.
Proposal
Replace the hard refusal with an opt-in service client role:
- Off by default: without the new setting, startup behaves as today (service clients refused).
- When enabled for listed clients (FOCA's
security.auth.service_clients, client acting as itself;
on_behalf_of_headerstays refused):- tasks created with the client's token are owned by the client (its
sub), and it sees and cancels only those; - its tasks are routed only to backends marked as operated by us (a new per-backend flag in
custom.tes.backends,
name in the PR); startup fails if the role is on but no backend has the flag, and a request whose task can't be
routed to such a backend is refused; - proTES forwards the client's own token to those backends (they must accept it: TESK per-client audiences,
Poiesis service clients).
- tasks created with the client's token are owned by the client (its
- No admin role for service clients; the group-to-role mapping doesn't apply to them.
- If a narrower FOCA helper (e.g. refusing only
on_behalf_of_header) is cleaner than a proTES-only check, a small
FOCA change is fine.
Acceptance criteria
- Default config: startup still refuses service clients (existing test unchanged).
- Role on: a listed client can create, list, get and cancel its own tasks; other owners' tasks stay invisible to it
and its tasks to them. - Its tasks go only to flagged backends; with no flagged backend, startup fails;
on_behalf_of_headeris refused. - The forwarded token is the client's own; no token is stored or logged.
Tests
Unit tests for the startup checks and the routing restriction; API tests for ownership with a client token;
integration test against a mock TES backend that records the forwarded Authorization header.
Docs
Authentication/deployment docs: what the role allows, the backend flag, why it is opt-in, and that token exchange
(RFC 8693) will replace token forwarding.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity