DataWarehouse Authorization and Permission
TL;DR
- There are 3 visibility (
Policy) levels:public,internal,retrigger; - Objects (
IssueandKCIDBCheckout+ children) visibility is defined by thePolicythey are created with; - Admins grant permissions to Users using DW Groups; preferably through LDAP group links;
- DW Groups required to triage internal objects:
Triagers,policy_public_write,policy_internal_read,policy_internal_write. - CKI team members can be assigned to the DW Group
CKI Team, or be enabled as a superuser. - Rover/LDAP group membership is what grants DW groups: being a member of the Rover group is required, being only an owner of the group is not enough.
DataWarehouse uses Django Auth Module with Users, Groups and Permissions that limit operations. On top of that, we have object-level permission, combining Groups with our custom PolicyAuthorizationBackend to distinguish between Public and Internal (Red Hat) data, and also data from retriggered pipelines.
Creating an Account
If you are a Red Hat associate, your account will be created once you have
logged in successfully via OIDC for the first time. Otherwise, accounts are
currently managed by the CKI team, reachable through cki-project@redhat.com,
Red Hat associates can also ping us in the internal Slack channel: #team-kernel-cki.
⚠️
Having an account isn’t the same as having permissions: those come from being a member of the right Rover group(s). See OIDC Group Sync for details.Consuming the API
The API follows the same permission policies from standard website usage, which will be explained below, other than that, see API auth documentation for information regarding out-of-browser authentication.
Permission Groups
Policies
There are 3 levels of visibility, in DataWarehouse: public, internal and retrigger,
each with a DW group associated with read and write permissions.
The policies apply to KCIDBCheckouts and Issues, and are propagated to their children,
i.e. KCIDBBuild, KCIDBTest, KCIDBTestResults, Artifacts, IssueOccurrences,
and IssueRegexes:
-
public:
(read=None,write="policy_public_write")Public data allows read operations (GET requests) without authentication, while write operations (POST, PUT, DELETE requests), e.g. who can submit results, require basic permissions, which are granted to members of the
policy_public_writeDW group. -
internal:
(read="policy_internal_read",write="policy_internal_write")Certain records pertaining to Red Hat data are restricted to internal users with appropriate read and write permissions, which are granted to members of
policy_internal_readandpolicy_internal_write, respectively. -
retrigger:
(read="policy_retrigger_rw",write="policy_retrigger_rw")Users in the
policy_retrigger_rwDW group can access and update objects with this policy. This data has a debug nature, and is submitted by the cki-ci-bot’s pipelines, triggered when testing merge requests. This policy is used only by service-accounts, however superusers have the same privileges.
If you are a DataWarehouse contributor, you might want to know that the implementation is based on Django Rest Framework framework of custom permissions, which we’ve used to define our PolicyAuthorizationPermission and PolicyAuthorizationBackend, then applied it to most models’ default queryset subclassing AuthorizedQuerySet.
Triaging permissions for QE Teams
To enable an user to manipulate issues, their occurrences and regexes,
in addition to the relevant object-level read/write policy groups,
they need to be part of the Triagers DW group, which will grant them permission
to read/write operations on those objects.
🧠
Triagers: Grant permission to add, update and delete issues, occurrences and regexes.policy_public_write: Grant permission to create, update and delete public data.policy_internal_read: Grant permission to list and read public data.policy_internal_write: Grant permission to create, update and delete internal data.
How to be a member of a DW group?
DataWarehouse admins don’t manage DW groups directly, instead they manage admin/LDAP-group-link, where they assign DW groups:
- to service-accounts and external users listed as “extra users” in the LDAP-group-link.
- to users who match an LDAP/Rover query (for Red Hat associates), synced either through LDAP (see LDAP/Rover Group Sync) or through OIDC (see OIDC Group Sync), depending on how the user authenticates.
⚠️
To be matched by an LDAP/Rover query, you need to be an actual member of the Rover group. Being only an owner of the group is not enough: owners aren’t listed as group members by LDAP/Rover, so they won’t be picked up by the sync and won’t get the associated DW groups/permissions. If you own a Rover group and also need the permissions yourself, add yourself as a member too.LDAP/Rover Group Sync
For users authenticating via LDAP, group membership is kept in sync with LDAP/Rover
by matching each LDAPGroupLink.filter_query against the LDAP server. This sync happens
when the query is created or updated, but also in an hourly cronjob
(UpdateLdapGroupMembers). Unlike the OIDC sync described below, this only
adds/removes users from the DW groups tied to synced LDAPGroupLinks, leaving any other
group membership (e.g. manually assigned groups) untouched.
Nowadays, there are a few ways of granting triaging permissions to a user, in order of preference:
- cki-kernel-tests-reviewers group 1: nowadays our preferred, main triaging permission group, handled directly by the kernel Product Owners/Managers.
- Team-based permission: granting triaging permissions to all members of an interested QE team, by creating a LDAP group link for the four permission groups mentioned above.
- Specific permission groups: for narrower cases, individual/existing Rover groups linked to just a subset of the permission groups.
🧠
Since [cki-kernel-tests-reviewers] is a regular Rover group, most Product Owners/Managers already have owner rights over it in Rover and can self-service add/remove members themselves, without needing to ask CKI.Team-based permission
Currently, these teams have a LDAP group link granting Triagers,
policy_public_write, policy_internal_read and policy_internal_write to all of their
members:
- Desktop QE (desktop-qe)
- Kernel Maintainers Core (kernel-maintainers-core)
- Kernel QE (kernel-qe)
- Kernel SE (rhel-sst-se-kernel)
- LNST (lnst)
- Network QE (network-qe)
- RHEL SST Kernel FT (rhel-sst-kernel-ft)
Specific permission groups
There are still some users managed manually through narrower Rover groups, each linked to a subset of the DW groups:
| Rover Group | DW Groups |
|---|---|
| cki-datawarehouse-public-write | public-write |
| cki-datawarehouse-internal-write | internal-write |
| linux-eng-pe | internal-read |
| bugzilla-redhat | internal-read |
Enabling triaging for a new QE Team
To grant permission to a new team, in order of preference:
- Check whether adding them to [cki-kernel-tests-reviewers] (handled by the kernel POs) is enough.
- Otherwise, set up team-based permission:
- Get the LDAP query from their Rover page.
- Add a record of LDAP group link, pointing to the 4 DW Groups:
Triagers,policy_public_write,policy_internal_read,policy_internal_write.
If a team doesn’t have a suitable existing Rover group to be added to, or wants finer-grained control over their own membership, they can also ask CKI ([cki-project@redhat.com]) to link a new, dedicated Rover group for them.
OIDC Group Sync
When FF_OIDC_ENABLED is on, Red Hat associates authenticate through OIDC (Keycloak)
instead of LDAP. In that case, group membership isn’t managed by the LDAP cronjob at all;
instead it’s derived from the OIDC access token on every login and on every OIDC session
refresh/API request, using OIDCAuthBackend:
- Keycloak embeds the user’s Rover/LDAP group CNs (e.g.
kernel-qe) in a claim, by defaultrealm_access.roles, configurable through theOIDC_GROUPS_CLAIMsetting. - Each CN present in that claim is matched against the CN parsed out of every
LDAP group link’s
filter_query, and the corresponding DW groups are assigned to the user. - DW groups forced through
extra_userson aLDAPGroupLinkare also (re-)applied on every sync, since, unlike the LDAP cron sync, the OIDC sync fully replaces the user’s group membership on every login/request rather than merging with it.
⚠️
Keycloak/Rover only reports actual group members in the roles claim used above. If you’ve only been added as an owner of a Rover group (and not also as a member), you will not show up inrealm_access.roles for that group, so you won’t be granted the associated DW
groups/permissions. Make sure you (or the users you’re onboarding) are added as members of
the relevant Rover group, not just owners.
-
NOTE: members of cki-kernel-tests-reviewers will be automated in https://gitlab.com/cki-project/datawarehouse/-/issues/218 ↩︎