Skip to content

Commit

Permalink
fix(cli): argocd CLI RBAC validation doesn't work on actions (argopro…
Browse files Browse the repository at this point in the history
…j#13911) (argoproj#14578) (argoproj#14582)

* argoproj#11602 fix : Object options menu truncated when selected in ApplicationListView.

* argoproj#11602 fix : Object options menu truncated when selected in ApplicationListView.

* changes for argocd_rbac

---------

Signed-off-by: schakradari <[email protected]>
Signed-off-by: schakrad <[email protected]>
Co-authored-by: schakrad <[email protected]>
Co-authored-by: Michael Crenshaw <[email protected]>
Signed-off-by: schakrad <[email protected]>
  • Loading branch information
3 people committed Jul 24, 2023
1 parent b5b5195 commit 4e0a678
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/argocd/commands/admin/settings_rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"os"
"strings"

"github.com/ghodss/yaml"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -373,6 +374,9 @@ func resolveRBACResourceName(name string) string {

// isValidRBACAction checks whether a given action is a valid RBAC action
func isValidRBACAction(action string) bool {
if strings.HasPrefix(action, rbacpolicy.ActionAction+"/") {
return true
}
_, ok := validRBACActions[action]
return ok
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/argocd/commands/admin/settings_rbac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ func Test_isValidRBACAction(t *testing.T) {
})
}

func Test_isValidRBACAction_ActionAction(t *testing.T) {
ok := isValidRBACAction("action/apps/Deployment/restart")
assert.True(t, ok)
}

func Test_isValidRBACResource(t *testing.T) {
for k := range validRBACResources {
t.Run(k, func(t *testing.T) {
Expand Down

0 comments on commit 4e0a678

Please sign in to comment.