Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow empty system or app config key #38996

Merged
merged 2 commits into from Jul 14, 2021

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jul 14, 2021

Description

Currently this sort of thing works:

$ php occ config:app:set "" ""
Config value  for app  set to 
$ php occ config:list ""
{
    "apps": {
        "": {
            "": null
        }
    }
}

The app name and config key should not be able to be the empty string. There is never a need to have an app named "" or a key "". This had somehow happened in one developers install, and caused issues when trying to get the config settings.

This PR disallows using an app name or config key that is the empty string. That will avoid accidentally making such settings.

I did not change the corresponding config:delete commands - if someone does somehow have one of these "empty string" set, they need to be able to delete it.

How Has This Been Tested?

CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@phil-davis phil-davis self-assigned this Jul 14, 2021
@phil-davis
Copy link
Contributor Author

phil-davis commented Jul 14, 2021

Note: we could probably also not allow an app name or config key that is all white-space. But that is not so much of an issue - it is just "silly and useless".

core/Command/Config/App/SetConfig.php Outdated Show resolved Hide resolved
@sonarcloud
Copy link

sonarcloud bot commented Jul 14, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell B 1 Code Smell

33.3% 33.3% Coverage
0.0% 0.0% Duplication

@phil-davis phil-davis merged commit dda9352 into master Jul 14, 2021
@delete-merged-branch delete-merged-branch bot deleted the do-not-allow-empty-system-app-config-key branch July 14, 2021 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants