Turn on role-based access control in Self-Hosted Base, choose who gets which role, and keep the in-cluster task port private.

Authorization

Self-Hosted Base can enforce role-based access control. It is off by default: every request is allowed, whoever sends it. Turn it on when more than one person uses Self-Hosted Base, after you put an authenticating proxy in front of it.

authz:
  enabled: true
  adminUsers: [<subject>]   # as your proxy reports them
  defaultRole: viewer       # admin, contributor, viewer or none
helm upgrade selfhosted-base unionai/selfhosted-base -n union -f values.yaml

How roles are assigned

  • Every user listed in adminUsers is an admin. Self-Hosted Base applies the list when it starts, so adding a user and upgrading makes them an admin, also if they have signed in before.
  • Every other user gets defaultRole the first time they make a request. Changing defaultRole later applies to users Self-Hosted Base hasn’t seen yet.
  • With defaultRole: none, users nobody granted a role can’t do anything, using apps included: the apps gateway answers them 403 Forbidden. Grant one by adding the user to adminUsers, for example.
  • A request without identity headers is refused with 401 Unauthenticated.
Role Can
admin Everything, including creating projects.
contributor Launch, abort, and follow runs, and read and write their data, in every project.
viewer Read runs, actions, logs, and data.

Users are identified by the subject your proxy reports, which isn’t always their email. To find a user’s subject, have them open https://<Self-Hosted Base host>/me in the browser while signed in:

{"subject": "00u1a2b3c4d5", "email": "[email protected]", "name": "Alice", ...}

Tasks

Tasks call back to Self-Hosted Base to start and follow the tasks they call (their child actions). They do this on an in-cluster port, 8082, where every request acts as a built-in application with role authz.tasksRole (default contributor). No credentials are placed in task pods.

Whatever can reach port 8082 gets that role, so keep it private with a network policy.

Network policy

With authz.enabled, the chart also creates a NetworkPolicy that:

  • lets only pods in Self-Hosted Base’s namespace reach the task ports (8082 and 15606);
  • lets only your proxy reach the API port (80), when you name it in networkPolicy.proxyFrom.
networkPolicy:
  proxyFrom:
    - namespaceSelector:
        matchLabels:
          kubernetes.io/metadata.name: auth
      podSelector:
        matchLabels:
          app.kubernetes.io/name: oauth2-proxy

A NetworkPolicy only takes effect if your cluster’s network plugin enforces it, as Calico, Cilium, and the AWS VPC CNI with network policy enabled do. Without that, any pod in the cluster can reach port 8082 and act with authz.tasksRole.

Set networkPolicy.enabled: false only if you enforce the same rules another way; the chart prints a warning when you do.

Gotchas

Symptom Cause and fix
Every request returns 401 after turning authorization on Requests reach Self-Hosted Base without identity headers. Check that they go through the proxy, and that identity.subjectHeaders names the header your proxy sets.
A user listed in adminUsers isn’t an admin The entry doesn’t match their subject. Compare it with subject from /me.
Tasks a task calls fail with PermissionDenied authz.tasksRole is viewer. Tasks need contributor to start the tasks they call.