Skip to content

feat(authz): make Cedar group entity type name configurable via ConfigOptions #5072

Description

@jhrozek

The Cedar authorizer hardcodes `EntityTypeTHVGroup = "THVGroup"` in `pkg/authz/authorizers/cedar/entity.go`. This constant is used at request time to construct `Client.Parents` UIDs from JWT group/role claims:

```go
parentUIDs = append(parentUIDs, cedar.NewEntityUID(EntityTypeTHVGroup, cedar.String(g)))
```

This makes the entity type name for the JWT-derived principal hierarchy impossible to change without a breaking change to existing deployments.

Proposed change

Add a `GroupEntityType` field to `ConfigOptions` in `pkg/authz/authorizers/cedar/core.go`:

```go
// GroupEntityType is the Cedar entity type name used for Client parent UIDs
// synthesised from JWT group/role claims. Defaults to "THVGroup" when empty.
GroupEntityType string `json:"group_entity_type,omitempty" yaml:"group_entity_type,omitempty"`
```

`EntityFactory.CreateEntitiesForRequest` reads `opts.GroupEntityType` and falls back to `"THVGroup"` when empty. No behaviour change for existing deployments.

Note: namespaced names (e.g. `Platform::Group`) are not supported until `parseCedarEntityID` is fixed to handle Cedar's `::` namespace syntax — that is a separate issue. This change enables flat name changes only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

authorizationenhancementNew feature or requestgoPull requests that update go code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions