Repository navigation
Open
Labels
area/api-machineryarea/cliarea/securitySecurity related issue/prSecurity related issue/prkind/cleanupSmall fixes that are not bugs, for example a typo in a code commentSmall fixes that are not bugs, for example a typo in a code comment
Description
Summary & Root Cause
The global policy is modeled as a singleton that cannot be deleted, but nothing creates it. The initial migration makes an empty table, and only an explicit CreateGlobalAccessPolicy inserts the row. On a fresh install where access comes only from --authz-bootstrap-owners:
get --globalgetsNotFound, prints a plain-text notice on stderr and exits 0, even with-o yaml.update --globaleither fails client-side (nouid/version, which the user cannot obtain becauseget -o yamlprinted nothing), or fails server-side withNotFound.- Both hints name commands without
--global. The second hint would create an atespace policy, or fail flag validation, instead of the global one.
Affected Code Locations
cmd/ateapi/internal/store/atepg/migrations/000001_initial.sql:204-210:global_access_policyis a singleton table (id boolean PRIMARY KEY DEFAULT true CHECK (id)). The migration inserts no row.cmd/ateapi/internal/store/atepg/access_policy.go:29-59:CreateGlobalAccessPolicyis the onlyINSERT INTO global_access_policy(line 44).cmd/ateapi/internal/store/atepg/access_policy.go:61-65:GetGlobalAccessPolicyselectsWHERE id = true.cmd/ateapi/internal/store/atepg/access_policy.go:67-110:UpdateGlobalAccessPolicydoesSELECT ... FOR UPDATE(lines 78-83) and returnsErrNotFoundwhen no row exists.cmd/ateapi/internal/controlapi/access_policy.go:56-61: maps that error toNotFound("Global AccessPolicy not found").cmd/kubectl-ate/internal/cmd/access_policy.go:217-223: onNotFound,getwrites"%s has no access policy"to stderr and returns nil (RC 0), regardless of-o yaml.cmd/kubectl-ate/internal/cmd/access_policy.go:341-344:updaterefuses a manifest withoutmetadata.uid/metadata.versionand points at"get access-policy -o yaml", with no--global.cmd/kubectl-ate/internal/cmd/access_policy.go:256-260: onNotFound,updatesayscreate it with "kubectl ate create access-policy", again without--global.docs/authorization.md:254-266: the example commands are atespace-only (-a team-a). Line 266 says "The global policy can't be deleted". Nothing says the global policy must be created once first.
Detailed Reproduction Guide
- On a freshly installed cluster where no
create access-policy --globalhas ever run:
kubectl ate get access-policy --global -o yaml
kubectl ate update access-policy --global -f global-pol-nouid.yaml
kubectl ate update access-policy --global -f global-pol-uid.yamlThe two manifests:
# global-pol-nouid.yaml
metadata:
name: default
bindings:
- role: viewer
members:
- user:carol@example.com# global-pol-uid.yaml
metadata:
name: default
uid: 00000000-0000-0000-0000-000000000001
version: "1"
bindings:
- role: viewer
members:
- user:carol@example.comExpected vs. Actual Behavior
- Expected: One of the following:
- An empty global
AccessPolicyrow is seeded at database init or server startup, soget --global -o yamlprints YAML withuid/versionandupdate --globalworks out of the box. get --global -o yamlexits non-zero or prints an empty YAML document, and every hint includes--global, for examplecreate it with "kubectl ate create access-policy --global".
- An empty global
- Actual:
get access-policy --global -o yamlprintsglobal has no access policy(RC=0) instead of YAML.update --globalwithoutuidfails withlacks the metadata.uid and metadata.version preconditions that "get access-policy -o yaml" prints.update --globalwith auidfails withglobal has no access policy to update; create it with "kubectl ate create access-policy". The hint omits--global.
Observed Output & Logs
$ kubectl ate get access-policy --global -o yaml
global has no access policy
RC=0
$ kubectl ate update access-policy --global -f global-pol-nouid.yaml
Error: manifest for the global access policy lacks the metadata.uid and metadata.version preconditions that "get access-policy -o yaml" prints
RC=1
$ kubectl ate update access-policy --global -f global-pol-uid.yaml
Error: global has no access policy to update; create it with "kubectl ate create access-policy"
RC=1$ kubectl ate get access-policy --global
global has no access policy
RC=0
$ kubectl ate get access-policy --global -o yaml
global has no access policy
RC=0
$ kubectl ate update access-policy --global -f global-pol-nouid.yaml
Error: manifest for the global access policy lacks the metadata.uid and metadata.version preconditions that "get access-policy -o yaml" prints
RC=1
$ kubectl ate update access-policy --global -f global-pol-uid.yaml
Error: global has no access policy to update; create it with "kubectl ate create access-policy"
RC=1Metadata
Metadata
Assignees
Labels
area/api-machineryarea/cliarea/securitySecurity related issue/prSecurity related issue/prkind/cleanupSmall fixes that are not bugs, for example a typo in a code commentSmall fixes that are not bugs, for example a typo in a code comment
Activity
SHRUTI6991 commentedon Oct 27, 2026
This is a feature not a bug, we are not supposed to not seed global access policy. I will tag this as a cleanup to clarify in docs.