occ config:app:set --value ignores --no-sensitive (and drops --sensitive for boolean values)

Aperta Adatta ai principianti
#67,531 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
php
Ambito
backend, cli

Direzione di ricerca

Inizia da core/Command/Config/App/SetConfig.php e segui la gestione di --value per ogni tipo supportato. Poi leggi lib/private/AppConfig.php e i casi esistenti in tests/Core/Command/Config/App/SetConfigTest.php. Aggiungi test per rimuovere la sensibilità dopo la conferma e per i valori booleani con --sensitive. Il lavoro è completato quando entrambi i comportamenti sono coperti e il test mirato passa.

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

Descrizione

bug feature: occ
Bug description

occ config:app:set <app> <key> --value=… --no-sensitive asks for confirmation to change the sensitive flag, but the flag is never cleared:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/core/Command/Config/App/SetConfig.php#L177-L189

The resulting $sensitive = false is passed to setValueString()/setValueInt()/…, but AppConfig::setTypedValue() keeps an existing sensitive flag (it only ever switches sensitivity from false to true):

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/lib/private/AppConfig.php#L872-L874
https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/lib/private/AppConfig.php#L951-L953

Only the branch without --value calls updateSensitive(). In addition, the boolean case does not pass $sensitive at all, so --sensitive is silently ignored for --type=boolean:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/core/Command/Config/App/SetConfig.php#L213-L214

Steps to reproduce

Found by code reading.

  1. occ config:app:set myapp mykey --value=foo --sensitive
  2. occ config:app:set myapp mykey --value=bar --no-sensitive and confirm the question
  3. occ config:app:get myapp mykey --details still shows the key as sensitive.
Expected behavior

When the admin confirms the change, --no-sensitive clears the flag (e.g. by calling updateSensitive() after setting the value, like the branch without --value does), and --sensitive is honoured for boolean values too. A test in tests/Core/Command/Config/App/SetConfigTest.php should cover both. (The wrong "Config value was not updated" output for type-only changes is tracked separately in #60065.)

Nextcloud version

master

Lingua principale
PHP
Stelle
37.6k
Fork
5.4k
Merge medio
1g 20h
PR unite (30g)
605

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 nextcloud/server

Tutte le issue di nextcloud/server

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.