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

Open Beginner friendly
#67,531 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
backend, cli

Research direction

Start with core/Command/Config/App/SetConfig.php and trace the --value handling for each supported type, then read lib/private/AppConfig.php and the existing cases in tests/Core/Command/Config/App/SetConfigTest.php. Add coverage for clearing sensitivity after confirmation and for boolean values with --sensitive. Done means both behaviors are covered and the focused test passes.

Written by the indexing model from the issue text.

Description

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

Dominant language
PHP
Stars
37.6k
Forks
5.4k
Avg merge
1d 20h
Merged PRs (30d)
605

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/server

All issues in nextcloud/server

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.