Skip to content

Commit

Permalink
fix --enable-scm-providers cmd in appset deployment (#1263)
Browse files Browse the repository at this point in the history
Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
  • Loading branch information
svghadi committed Feb 22, 2024
1 parent 22e8c6b commit cf24327
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions controllers/argocd/applicationset.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ func (r *ReconcileArgoCD) getArgoApplicationSetCommand(cr *argoproj.ArgoCD) []st
cmd = append(cmd, "--allowed-scm-providers", fmt.Sprint(strings.Join(cr.Spec.ApplicationSet.SCMProviders, ",")))
}

// appset in any ns doesn't support default SCM providers list.
// The list needs to be explicitly defined by admins when the feature is enabled.
// appset in any ns is enabled and no scmProviders allow list is specified,
// disables scm & PR generators to prevent potential security issues
// https://argo-cd.readthedocs.io/en/stable/operator-manual/applicationset/Appset-Any-Namespace/#scm-providers-secrets-consideration
if len(appsetsSourceNamespaces) > 0 && !(len(cr.Spec.ApplicationSet.SCMProviders) > 0) {
cmd = append(cmd, "--enable-scm-providers", "false")
cmd = append(cmd, "--enable-scm-providers=false")
}

// ApplicationSet command arguments provided by the user
Expand Down
2 changes: 1 addition & 1 deletion controllers/argocd/applicationset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func TestReconcileApplicationSet_Deployments_Command(t *testing.T) {
},
SourceNamespaces: []string{"foo", "bar"},
},
expectedCmd: []string{"--applicationset-namespaces", "foo,bar", "--enable-scm-providers", "false"},
expectedCmd: []string{"--applicationset-namespaces", "foo,bar", "--enable-scm-providers=false"},
},
{
name: "with SCM provider list",
Expand Down

0 comments on commit cf24327

Please sign in to comment.