Skip to content

Commit 7a39dab

Browse files
authored
feat: Enable ApplicationFineGrainedRBACInheritance by default (argoproj-labs#1749)
* Enable ApplicationFineGrainedRBACInheritance by default Signed-off-by: nmirasch <neus.miras@gmail.com> * add documentation of default server.rbac.disableApplicationFineGrainedRBACInheritance value Signed-off-by: nmirasch <neus.miras@gmail.com> --------- Signed-off-by: nmirasch <neus.miras@gmail.com>
1 parent c9ff213 commit 7a39dab

File tree

7 files changed

+38
-4
lines changed

7 files changed

+38
-4
lines changed

common/keys.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ const (
193193
// to used for the Redis container.
194194
ArgoCDRedisImageEnvName = "ARGOCD_REDIS_IMAGE"
195195

196+
// ArgoCDServerRBACDisableFineGrainedInheritance is needed to specify if it is not possible to deny
197+
// fine-grained permissions for a sub-resource if the action was explicitly allowed on the application
198+
ArgoCDServerRBACDisableFineGrainedInheritance = "server.rbac.disableApplicationFineGrainedRBACInheritance"
199+
196200
// ArgoCDDeletionFinalizer is a finalizer to implement pre-delete hooks
197201
ArgoCDDeletionFinalizer = "argoproj.io/finalizer"
198202

controllers/argocd/configmap.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,11 @@ func (r *ReconcileArgoCD) reconcileArgoConfigMap(cr *argoproj.ArgoCD) error {
443443
}
444444
}
445445

446+
// Check and set default value for server.rbac.disableApplicationFineGrainedRBACInheritance if not present
447+
if _, exists := cm.Data[common.ArgoCDServerRBACDisableFineGrainedInheritance]; !exists {
448+
cm.Data[common.ArgoCDServerRBACDisableFineGrainedInheritance] = "false"
449+
}
450+
446451
if err := controllerutil.SetControllerReference(cr, cm, r.Scheme); err != nil {
447452
return err
448453
}

controllers/argocd/configmap_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,10 @@ func TestReconcileArgoCD_reconcileArgoConfigMap(t *testing.T) {
233233
"oidc.config": "",
234234
"resource.inclusions": "",
235235
"resource.exclusions": "",
236-
"statusbadge.enabled": "false",
237-
"url": "https://argocd-server",
238-
"users.anonymous.enabled": "false",
236+
"server.rbac.disableApplicationFineGrainedRBACInheritance": "false",
237+
"statusbadge.enabled": "false",
238+
"url": "https://argocd-server",
239+
"users.anonymous.enabled": "false",
239240
}
240241

241242
cmdTests := []struct {

docs/reference/argocd.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,14 @@ spec:
819819
g, system:cluster-admins, role:admin
820820
scopes: '[groups]'
821821
```
822+
### Fine-Grained RBAC for application update and delete sub-resources (v3.0+)
823+
824+
The default behavior of fine-grained policies have changed so they no longer apply to sub-resources. Prior to v3, policies granting update or delete to an application also applied to any of its sub-resources.
825+
826+
Starting with v3, the update or delete actions only apply to the application itself. New policies must be defined to allow the update/* or delete/* actions on an Application's managed resources.
827+
828+
To preserve v2 behavior the config value server.rbac.disableApplicationFineGrainedRBACInheritance is set to false in the Argo CD ConfigMap argocd-cm.
829+
822830

823831
## Redis Options
824832

tests/k8s/1-018_validate_extra_config/01-assert.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ kind: ConfigMap
1414
metadata:
1515
name: argocd-cm
1616
data:
17-
admin.enabled: "true"
17+
admin.enabled: "true"
18+
server.rbac.disableApplicationFineGrainedRBACInheritance: "false"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: argocd-cm
6+
data:
7+
server.rbac.disableApplicationFineGrainedRBACInheritance: "true"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: ArgoCD
3+
metadata:
4+
name: example-argocd
5+
spec:
6+
disableAdmin: true
7+
extraConfig:
8+
"server.rbac.disableApplicationFineGrainedRBACInheritance": "true"

0 commit comments

Comments
 (0)