Skip to content

Commit

Permalink
fix: not need send application if it is not under enabled namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
pasha-codefresh committed Jul 12, 2023
1 parent 103a419 commit b0480cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/application/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ import (
"github.com/argoproj/argo-cd/v2/util/db"
"github.com/argoproj/argo-cd/v2/util/env"
"github.com/argoproj/argo-cd/v2/util/git"
"github.com/argoproj/argo-cd/v2/util/glob"
ioutil "github.com/argoproj/argo-cd/v2/util/io"
"github.com/argoproj/argo-cd/v2/util/lua"
"github.com/argoproj/argo-cd/v2/util/manifeststream"
Expand Down Expand Up @@ -225,7 +224,7 @@ func (s *Server) List(ctx context.Context, q *application.ApplicationQuery) (*ap
for _, a := range filteredApps {
// Skip any application that is neither in the control plane's namespace
// nor in the list of enabled namespaces.
if a.Namespace != s.ns && !glob.MatchStringInList(s.enabledNamespaces, a.Namespace, false) {
if s.isNamespaceEnabled(a.Namespace) {
continue
}
if s.enf.Enforce(ctx.Value("claims"), rbacpolicy.ResourceApplications, rbacpolicy.ActionGet, a.RBACName(s.ns)) {
Expand Down Expand Up @@ -1024,6 +1023,10 @@ func (s *Server) Watch(q *application.ApplicationQuery, ws application.Applicati
return
}

if s.isNamespaceEnabled(a.Namespace) {
return
}

if !s.enf.Enforce(claims, rbacpolicy.ResourceApplications, rbacpolicy.ActionGet, a.RBACName(s.ns)) {
// do not emit apps user does not have accessing
return
Expand Down

0 comments on commit b0480cb

Please sign in to comment.