chore: deprecate ResourceSystem (#17217)

Deprecates `ResourceSystem`. It's a large collection of unrelated things, and violates the principle of least privilege because to get access to low-security stuff like various statistics, you also get access to serious-security stuff like crypto keys.

We should eventually break it up and remove it, but the least we can do for now is not make the problem worse.
This commit is contained in:
Spike Curtis
2025-04-02 19:17:26 +04:00
committed by GitHub
parent ac0cf35591
commit 83d7147e02
3 changed files with 10 additions and 0 deletions
+3
View File
@@ -242,6 +242,9 @@ var (
// - "ActionDelete" :: delete system resources
// - "ActionRead" :: view system resources
// - "ActionUpdate" :: update system resources
// DEPRECATED: New resources should be created for new things, rather than adding them to System, which has become
// an unmanaged collection of things that don't relate to one another. We can't effectively enforce
// least privilege access control when unrelated resources are grouped together.
ResourceSystem = Object{
Type: "system",
}
+6
View File
@@ -33,6 +33,8 @@ type PermissionDefinition struct {
// should represent. The key in the actions map is the verb to use
// in the rbac policy.
Actions map[Action]ActionDefinition
// Comment is additional text to include in the generated object comment.
Comment string
}
type ActionDefinition struct {
@@ -203,6 +205,10 @@ var RBACPermissions = map[string]PermissionDefinition{
ActionUpdate: actDef("update system resources"),
ActionDelete: actDef("delete system resources"),
},
Comment: `
// DEPRECATED: New resources should be created for new things, rather than adding them to System, which has become
// an unmanaged collection of things that don't relate to one another. We can't effectively enforce
// least privilege access control when unrelated resources are grouped together.`,
},
"api_key": {
Actions: map[Action]ActionDefinition{
+1
View File
@@ -16,6 +16,7 @@ var (
{{- range $action, $value := .Actions }}
// - "{{ actionEnum $action }}" :: {{ $value.Description }}
{{- end }}
{{- .Comment }}
Resource{{ $Name }} = Object {
Type: "{{ $element.Type }}",
}