Skip to content

Phase 4 · JWT issuance hardening — per-role claims + move signing off pipelit #191

Description

@theuseless-ai

Context

Phase 1b made agentgateway the sole key holder — pipelit mints a 60s ES256 JWT that the gateway swaps for the real provider key. The post-implementation review flagged two JWT weaknesses to close in Phase 4:

  1. role="admin" for every workflow call. resolve_llm_for_node never derives a role, and platform/services/llm.py defaults role = user_role or "admin" (~line 248), so every workflow-minted JWT claims admin. agentgateway's CEL authorization is now the sole authz layer, and it's being fed a constant → per-role gateway policy is effectively bypassed. (Does not leak keys; it neuters authorization.)

  2. Circular trust — pipelit self-signs and holds the signing key. A compromised pipelit process can mint a token for any user/role. Per the original design (docs/architecture/gateway-mcp-design.md, Phase 4), JWT issuance should move to plit-gw (identity provider) — or a dedicated issuer — so pipelit no longer holds the signing key. Until then, the boundary protects against agent output leaking keys, but not against a compromised pipelit process. Acceptable for single-operator; must be closed before untrusted multi-tenant.

Supersedes #187 (bearer→JWT migration itself shipped in Phase 1b).

Scope

  • Derive a real per-user role (and scoped allowed_credentials) instead of hardcoding admin; author CEL policies that actually discriminate by role.
  • Move JWT issuance out of pipelit (to plit-gw or a dedicated issuer) so pipelit no longer holds the signing key.

Acceptance

  • Workflow JWTs carry the correct per-user role; a non-admin workflow is denied admin-only gateway routes/tools by CEL.
  • pipelit no longer holds the JWT signing key (issuer is a separate trust domain).

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions