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

fix(ProvisioningAPI): set typed config values by via API #46991

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

blizzz
Copy link
Member

@blizzz blizzz commented Aug 2, 2024

Summary

On Javascript side we have one method at hand to set an app config value: CP.AppConfig.setValue(). As value it takes a string and sends this over the Provisioning API to the server.

Meanwhile we have typed configuration entries. All existing entries are default to the IAppConfig::VALUE_MIXED type. New entries however are bound to their type. For instance a new boolean value cannot be set via JavaScript anymore.

This fix solves this on API level. All clients may still send strings, and the Provisioning API's Controller tries to cast the provided value into the target type.

I see this sort of critical myself as there is not good validation of the casted value. On the other hand I do not think it can do much harm, only fail in a different way. Still, an alternative would be to have also dedicated setter on the JS side, and endpoints for each acceptable type. Personally I don't have the time for this approach today anymore. I am totally fine to discard this PR in favor of a better replacement :)

Todo

  • check were backports are necessary

Checklist

@blizzz blizzz added bug 3. to review Waiting for reviews labels Aug 2, 2024
@blizzz blizzz added this to the Nextcloud 30 milestone Aug 2, 2024
@blizzz blizzz requested review from ArtificialOwl and a team August 2, 2024 16:14
Copy link
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a ok solution for now. We probably need a better way to fix this in the future as you said.

@Altahrim Altahrim mentioned this pull request Aug 5, 2024
@come-nc come-nc requested a review from kesselb August 5, 2024 13:04
@Altahrim Altahrim mentioned this pull request Aug 7, 2024
@skjnldsv skjnldsv mentioned this pull request Aug 13, 2024
@skjnldsv skjnldsv modified the milestones: Nextcloud 30, Nextcloud 31 Aug 14, 2024
@ariep
Copy link

ariep commented Aug 16, 2024

Hi, I'm impacted by #45083 so I'm eagerly watching this PR. I get the same type conflict error when I do a php occ config:import ... and the json file contains

[...]
        "apps":{                                                                                                                                                                              
            "core":{                                                                                                                                                                          
                "backgroundjobs_mode": "webcron"
[...]

@kesselb recommended that I mention this particular case here because it might not be solved by this PR in its current form. Is there any chance you could fix that case as well?

@blizzz blizzz requested a review from come-nc August 19, 2024 16:42
@blizzz
Copy link
Member Author

blizzz commented Aug 19, 2024

I get the same type conflict error when I do a php occ config:import ...

Hm, on occ there is should be another entrypoint somewhere.

@blizzz blizzz force-pushed the fix/45083/config-from-js branch 2 times, most recently from 6025810 to c747aff Compare August 20, 2024 10:48
@blizzz
Copy link
Member Author

blizzz commented Aug 21, 2024

rebased, adjusted and added tests (no prod code change since)

@blizzz blizzz merged commit ebe2429 into master Aug 21, 2024
171 checks passed
@blizzz blizzz deleted the fix/45083/config-from-js branch August 21, 2024 12:58
@blizzz
Copy link
Member Author

blizzz commented Aug 21, 2024

/backport to stable30

@blizzz
Copy link
Member Author

blizzz commented Aug 21, 2024

/backport to stable29

@blizzz
Copy link
Member Author

blizzz commented Aug 21, 2024

I get the same type conflict error when I do a php occ config:import ...

Hm, on occ there is should be another entrypoint somewhere.

Not scope of this PR, requires a follow up.

@nickvergessen
Copy link
Member

Please no backports. this is a breaking change 👎
Talk integration tests are glowing red with {"Exception":"OCP\\Exceptions\\AppConfigUnknownKeyException","Message":"unknown config key"

@nickvergessen
Copy link
Member

Fix in #47409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to update background execution mode: conflict between new type (mixed) and old type (string)
6 participants