NamespaceManagement revocation checks labels on the wrong namespace

Aperta
#1,559 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Rizwana777 ci sta già lavorando.

Dal 16/11/2026.

  • #1563 di @atishay-kasliwal — aperta

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, kubernetes

Direzione di ricerca

Start in argocd-operator/controllers/argocd/util.go at handleNamespaceManagementDelete and handleNamespaceManagementUpdate, where the cleanup fetches the namespace named by .spec.managedBy instead of the CR's own namespace. Reproduce the deletion case with the fake client first. Done when the target namespace's labels decide whether the old manager's Roles and RoleBindings are revoked, with regression tests for deletion, retargeting, and a preserved valid target-label grant.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind/bug

Deleting or redirecting a NamespaceManagement CR can leave the old ArgoCD instance's cross-namespace permissions in place. The cleanup checks the managing namespace's labels instead of the namespace withdrawing consent.

Reproduction

With ALLOW_NAMESPACE_MANAGEMENT_IN_NAMESPACE_SCOPED_INSTANCES=true:

  1. Create a namespace-scoped ArgoCD instance in manager, with .spec.namespaceManagement: [{name: target, allowManagedBy: true}].
  2. Label namespace manager with argocd.argoproj.io/managed-by: manager. Leave namespace target without a managed-by label.
  3. Create a NamespaceManagement CR in target with .spec.managedBy: manager, and wait for the cross-namespace Roles and RoleBindings to be created.
  4. Delete that NamespaceManagement CR, or change its .spec.managedBy to another namespace.

Actual behavior

The cleanup handlers fetch namespace manager using .spec.managedBy. Its self-referencing managed-by label causes cleanup to be skipped, although target has no overlapping label grant. The old manager's Roles and RoleBindings remain in target, retaining access after consent is withdrawn.

Relevant code: argocd-operator/controllers/argocd/util.go, in handleNamespaceManagementUpdate at line 2026 and handleNamespaceManagementDelete at line 2048.

Expected behavior

Check the labels on the NamespaceManagement CR's own namespace (target). Revoke the old manager's grants unless that target namespace independently authorizes continued access. Add regression tests for deletion and retargeting with a self-labeled manager, plus a case preserving a valid target-namespace label grant.

Confirmed the deletion case at commit 5fb7a030 using an isolated fake-client reproduction after a prior grant; no live-cluster exploit was run.

(Bug text c/o OpenAI Codex v6.1 Sol xhigh)

Lingua principale
Go
Stelle
190
Fork
367
Merge medio
4g 2h
PR unite (30g)
63

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di redhat-developer/gitops-operator

Tutte le issue di redhat-developer/gitops-operator

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.