Documentation
¶
Index ¶
- Variables
- func AddOrganizationAndProjectIDQuery(ctx context.Context, selector labels.Selector, organizationQuery []string, ...) (labels.Selector, error)
- func AddOrganizationIDQuery(ctx context.Context, selector labels.Selector, query []string) (labels.Selector, error)
- func AddQuery(selector labels.Selector, label string, vals []string) (labels.Selector, error)
- func AllowGlobalScope(ctx context.Context, endpoint string, operation openapi.AclOperation) error
- func AllowOrganizationScope(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) errordeprecated
- func AllowOrganizationScopeID(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) error
- func AllowOrganizationScopeReader(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) error
- func AllowProjectScope(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) errordeprecated
- func AllowProjectScopeCreate(ctx context.Context, client openapi.ClientWithResponsesInterface, ...) errordeprecated
- func AllowProjectScopeCreateID(ctx context.Context, client openapi.ClientWithResponsesInterface, ...) error
- func AllowProjectScopeCreateReader(ctx context.Context, client openapi.ClientWithResponsesInterface, ...) error
- func AllowProjectScopeID(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) error
- func AllowProjectScopeReader(ctx context.Context, endpoint string, operation openapi.AclOperation, ...) error
- func AllowRole(ctx context.Context, role *unikornv1.Role, organizationID ids.OrganizationID) error
- func FromContext(ctx context.Context) *openapi.Acl
- func HasNoMatches(err error) bool
- func NewContext(ctx context.Context, acl *openapi.Acl) context.Context
- func OrganizationIDs(ctx context.Context) []string
- type Options
- type PlatformAdministratorSubject
- type PlatformAdministratorSubjectsValue
- type RBAC
Constants ¶
This section is empty.
Variables ¶
var ( ErrResourceReference = goerrors.New("resource reference error") ErrNoAuthz = goerrors.New("no authorization data in userinfo") ErrWrongOrganizationCount = goerrors.New("expected exactly one organization ID") ErrNotInOrganization = goerrors.New("subject not a member of organization") ErrInvalidPrincipalType = goerrors.New("invalid impersonated principal type") ErrBareAdminSubject = goerrors.New("bare platform-administrator-subjects entry with non-UNI issuer trusted; migrate to issuer::subject") )
var (
ErrNoMatches = goerrors.New("selector would select nothing")
)
Functions ¶
func AddOrganizationAndProjectIDQuery ¶ added in v1.11.0
func AddOrganizationAndProjectIDQuery(ctx context.Context, selector labels.Selector, organizationQuery []string, projectQuery []string) (labels.Selector, error)
AddOrganizationAndProjectIDQuery gets all organizationIDs the user can access (or has requested explicit and has access to).
func AddOrganizationIDQuery ¶ added in v1.11.0
func AddOrganizationIDQuery(ctx context.Context, selector labels.Selector, query []string) (labels.Selector, error)
AddOrganizationIDQuery adds an organizational query selector that limits resources to be listed to those available in the ACL and optionally constrained to those in the request query using a boolean intersection.
func AllowGlobalScope ¶ added in v0.2.20
AllowGlobalScope tries to allow the requested operation at the global scope.
func AllowOrganizationScope
deprecated
added in
v0.2.20
func AllowOrganizationScope(ctx context.Context, endpoint string, operation openapi.AclOperation, organizationID string) error
AllowOrganizationScope tries to allow the requested operation at the global scope, then the organization scope.
Deprecated: prefer the typed AllowOrganizationScopeID (for path-parameter IDs) or AllowOrganizationScopeReader (for a resource implementing ids.OrganizationScopeReader). This string overload is retained for backwards compatibility with callers that still deal in plain strings (e.g. IDs from API response bodies or pre-typed-ID repositories) and will be removed once those callers have migrated.
func AllowOrganizationScopeID ¶ added in v1.17.5
func AllowOrganizationScopeID(ctx context.Context, endpoint string, operation openapi.AclOperation, organizationID ids.OrganizationID) error
AllowOrganizationScopeID is the typed variant of AllowOrganizationScope. Use this when the caller holds an ids.OrganizationID; the string overload is retained for callers in other repos that already deal in plain strings.
func AllowOrganizationScopeReader ¶ added in v1.17.7
func AllowOrganizationScopeReader(ctx context.Context, endpoint string, operation openapi.AclOperation, scope ids.OrganizationScopeReader) error
AllowOrganizationScopeReader is the variant of AllowOrganizationScope for callers that hold a resource implementing ids.OrganizationScopeReader (e.g. a region CRD). It recovers the organization ID from the resource. API handlers holding a path-parameter ID should use AllowOrganizationScopeID instead.
func AllowProjectScope
deprecated
added in
v0.2.20
func AllowProjectScope(ctx context.Context, endpoint string, operation openapi.AclOperation, organizationID, projectID string) error
AllowProjectScope tries to allow the requested operation at the global scope, then the organization scope, and finally at the project scope.
Deprecated: prefer the typed AllowProjectScopeID (for path-parameter IDs) or AllowProjectScopeReader (for a resource implementing ids.ProjectScopeReader). This string overload is retained for backwards compatibility with callers that still deal in plain strings (e.g. IDs from API response bodies or pre-typed-ID repositories) and will be removed once those callers have migrated.
func AllowProjectScopeCreate
deprecated
added in
v1.16.0
func AllowProjectScopeCreate(ctx context.Context, client openapi.ClientWithResponsesInterface, endpoint string, operation openapi.AclOperation, organizationID, projectID string) error
AllowProjectScopeCreate is like AllowProjectScope but intended for v2 create operations where the project ID is supplied in the request body rather than the URL path. When access is granted via an organization-scoped ACL the project ID is untrusted user input, so this function additionally verifies the project exists via the identity API before returning nil. Global-scope callers (platform administrators) are exempt from this check and their supplied project ID is trusted directly.
Deprecated: prefer the typed AllowProjectScopeCreateID (for path-parameter IDs) or AllowProjectScopeCreateReader (for a resource implementing ids.ProjectScopeReader). This string overload is retained for backwards compatibility with callers that pre-date the typed ID types and will be removed once those callers have migrated; the typed variants delegate here after converting to strings.
func AllowProjectScopeCreateID ¶ added in v1.17.5
func AllowProjectScopeCreateID(ctx context.Context, client openapi.ClientWithResponsesInterface, endpoint string, operation openapi.AclOperation, organizationID ids.OrganizationID, projectID ids.ProjectID) error
AllowProjectScopeCreateID is the typed variant of AllowProjectScopeCreate.
func AllowProjectScopeCreateReader ¶ added in v1.17.7
func AllowProjectScopeCreateReader(ctx context.Context, client openapi.ClientWithResponsesInterface, endpoint string, operation openapi.AclOperation, scope ids.ProjectScopeReader) error
AllowProjectScopeCreateReader is the variant of AllowProjectScopeCreate for callers that hold a resource implementing ids.ProjectScopeReader. It recovers the organization and project IDs from the resource.
func AllowProjectScopeID ¶ added in v1.17.5
func AllowProjectScopeID(ctx context.Context, endpoint string, operation openapi.AclOperation, organizationID ids.OrganizationID, projectID ids.ProjectID) error
AllowProjectScopeID is the typed variant of AllowProjectScope.
func AllowProjectScopeReader ¶ added in v1.17.7
func AllowProjectScopeReader(ctx context.Context, endpoint string, operation openapi.AclOperation, scope ids.ProjectScopeReader) error
AllowProjectScopeReader is the variant of AllowProjectScope for callers that hold a resource implementing ids.ProjectScopeReader (e.g. a region CRD). It recovers the organization and project IDs from the resource. API handlers holding path-parameter IDs should use AllowProjectScopeID instead.
func AllowRole ¶ added in v0.2.21
AllowRole determines whether your ACL contains the same or higher privileges than the role, which is then used to determine role visibility and limit privilege escalation.
Each scope block of the target role is checked against the caller's authority at the matching scope, with the usual downward flow (global satisfies organization and project, organization satisfies project):
- global endpoints must be held at global scope;
- organization endpoints must be held at global or organization scope;
- project endpoints must be held at global or organization scope, or at project scope in any project the caller can access (see allowGrantProjectScope).
The project case is why granting is subset-preserving rather than escalation-prone: a caller may only ever grant a role whose permissions they already hold at the grant's scope or broader.
func HasNoMatches ¶ added in v1.12.0
HasNoMatches is a short cut when nothing would be matched e.g. the user has no matching organization ID for the provided selector, and a list handler can just return an empty array directly.
func NewContext ¶ added in v0.2.20
func OrganizationIDs ¶ added in v1.11.0
OrganizationIDs returns a list of all organization IDs from the ACL for the purposes of limiting list type API operations.
Types ¶
type Options ¶ added in v0.2.54
type Options struct {
PlatformAdministratorRoleIDs []string
PlatformAdministratorSubjects []PlatformAdministratorSubject
SystemAccountRoleIDs map[string]string
}
func (*Options) Validate ¶ added in v1.18.0
Validate reports whether the admin list still needs migrating: any bare (UNI-sentinel) entry while a non-UNI issuer is trusted. Advisory only — the caller logs the result rather than refusing to start; bare entries can never match a CRD-declared issuer, so the runtime issuer-match in processUserAccountACL remains the security control.
type PlatformAdministratorSubject ¶ added in v1.18.0
PlatformAdministratorSubject binds an admin subject to the issuer that must have authenticated it, closing the cross-issuer confused deputy.
type PlatformAdministratorSubjectsValue ¶ added in v1.18.0
type PlatformAdministratorSubjectsValue []PlatformAdministratorSubject
PlatformAdministratorSubjectsValue parses repeated or comma-joined issuer::subject flags. A bare value (no "::") defaults the issuer to the UNI sentinel for backward compatibility with single-issuer deployments.
func (*PlatformAdministratorSubjectsValue) Set ¶ added in v1.18.0
func (v *PlatformAdministratorSubjectsValue) Set(value string) error
func (*PlatformAdministratorSubjectsValue) String ¶ added in v1.18.0
func (v *PlatformAdministratorSubjectsValue) String() string
func (*PlatformAdministratorSubjectsValue) Type ¶ added in v1.18.0
func (*PlatformAdministratorSubjectsValue) Type() string
type RBAC ¶
type RBAC struct {
// contains filtered or unexported fields
}
RBAC contains all the scoping rules for services across the platform.