Secure /v1/definitions on the workflow gateway (OIDC / API_KEY + Kubernetes auth)

Open
#84 0 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@ricardozanini is already working on this.

Since Nov 2, 2026.

Assessment

This issue has not been assessed yet.

Description

area/gateway enhancement

Summary

GET /v1/definitions and GET /v1/definitions/{namespace}/{name}/{version} on the workflow gateway are unauthenticated. They serve LogicFlowDefinition data the gateway reads with its own broadly-privileged ServiceAccount (an informer cache across every watched namespace). Any anonymous caller borrows that elevated access and can enumerate every workflow definition in every namespace — including embedded logic, endpoints, and secret references. This is a confused-deputy / privilege-escalation issue.

In scope: /v1/definitions (list + fetch) only.
Out of scope: /v1/runtime/* and /v1/instances/* — those are forwarded to backends that already enforce the quarkus-flow security model; the gateway just passes auth headers through.

Full design: adr/002-workflow-gateway-definitions-authz.md (branch feat/gateway-definitions-authz).

Decision

Two authorization paths in front of /v1/definitions, both filtering results to the namespaces the caller is entitled to.

1. Kubernetes-native (real RBAC, no drift)
  • Authenticate via TokenReview.
  • Filter with SelfSubjectAccessReview (caller's own token): return a namespace only if the user may list/get logicflowdefinitions there.
  • No impersonation, no extra gateway-SA RBAC, no extra user RBAC.
  • Companion fix: add aggregate-to-view|edit|admin labels to the shipped logicflowdefinition_{viewer,editor,admin}_role.yaml so namespace view/edit/admin inherits LFD read and the SSAR check isn't operationally brittle.
2. Quarkus-flow (mirror the runner verbatim)

Single-mode (NONE/API_KEY/OIDC), extends existing RuntimeSecuritySpec.

  • Roles: flow-admin (all namespaces), flow-invoker (restricted; blank scope → 403).
  • OIDC JWT: top-level roles claim (flow-admin/flow-invoker) + namespace claim (string / array / CSV / *). Not groups/realm_access/scope.
  • API_KEY: Authorization: Bearer <key>; roles + namespaces per key (omitted → *).
  • 401 invalid creds, 403 wrong namespace; /v1/openapi* stays open.
  • Accepted risk: OIDC namespace claim is a parallel authz source that can drift from real RBAC (why consoles use the k8s path).
3. Deterministic routing (route ≠ trust)

Local unverified decode selects one validator; that authority then verifies before trusting. When OIDC is configured:

  1. Opaque bearer → kube (TokenReview). (OpenShift console)
  2. JWT with kube markers (kubernetes.io / SA issuer) → kube. (SA token)
  3. JWT roles contains flow-* → OIDC server (verify, then trust claims).
  4. Otherwise → kube (TokenReview). (external-OIDC kube users land here)

Acceptance criteria

  • Unauthenticated /v1/definitions requests are rejected (401).
  • k8s path returns only namespaces the caller can list/get logicflowdefinitions (SSAR-verified).
  • OIDC path honors the verbatim roles + namespace contract; interchangeable with runner tokens.
  • API_KEY path honors per-key roles + namespaces via Authorization: Bearer.
  • Routing is deterministic per the 4-step table; forged roles claims fail signature verification.
  • Shipped LFD ClusterRoles carry aggregation labels.
  • /v1/openapi* remains unauthenticated.
  • /v1/runtime/* and /v1/instances/* behavior unchanged.

Notes / open implementation choices

  • Extend api/v1 security types (API-key namespace scoping, OIDC claim-name config, gateway security spec).
  • Optional: short-lived per-(identity, namespace) SSAR decision cache.
Dominant language
Go
Stars
3
Forks
3
Avg merge
1d 12m
Merged PRs (30d)
18

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kubesmarts/logic-operator

All issues in kubesmarts/logic-operator

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.