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(encryption): Clicking default module in UI sets bogus value #44604

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Apr 1, 2024

Summary

update() was hard coded to return a yes/no string value just to handle enableEncryption()'s value. Since update() is also used for setting the default encryption module (which is not a simple yes/no value), whenever the default encryption module radio button was clicked the server value was being set to yes too (which is bogus).

async update(key, value) {
await confirmPassword()
const url = generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/{appId}/{key}', {
appId: 'core',
key,
})
const stringValue = value ? 'yes' : 'no'
try {
const { data } = await axios.post(url, {
value: stringValue,
})
this.handleResponse({
status: data.ocs?.meta?.status,
})
} catch (e) {
this.handleResponse({
errorMessage: t('settings', 'Unable to update server side encryption config'),
error: e,
})
}
},
async checkDefaultModule() {
await this.update('default_encryption_module', this.defaultCheckedModule)

<NcCheckboxRadioSwitch v-for="(module, id) in encryptionModules"
:key="id"
:checked.sync="defaultCheckedModule"
:value="id"
type="radio"
name="default_encryption_module"
@update:checked="checkDefaultModule">
{{ module.displayName }}
</NcCheckboxRadioSwitch>

How to test:

  • Enable Encryption app under Apps
  • Toggle on Server-side encryption under Admin Settings->Security
  • Click Enable encryption
  • Click anywhere on the Default encryption module radio button area
  • Check the server-side value of default_encryption_module (e.g. occ config:list core)

Correct value: OC_DEFAULT_MODULE (which it'll be if you're careful not to click anywhere initially)
Bogus value: yes (which it'll change to if you click anywhere without this PR)

If your default_encryption_module is set to yes try this command to manually remedy:

occ encryption:set-default-module OC_DEFAULT_MODULE

TODO

  • ...

Checklist

@joshtrichards
Copy link
Member Author

/compile amend /

Fixes #44532
Likely fixes #43123

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
@joshtrichards
Copy link
Member Author

/backport to stable29

@joshtrichards
Copy link
Member Author

/backport to stable28

@joshtrichards
Copy link
Member Author

/backport to stable27

@susnux susnux requested review from artonge and removed request for CarlSchwan April 2, 2024 12:03
Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

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

👍

@skjnldsv skjnldsv enabled auto-merge April 3, 2024 08:46
@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Apr 3, 2024
@skjnldsv skjnldsv merged commit 7bd9100 into master Apr 3, 2024
107 checks passed
@skjnldsv skjnldsv deleted the fix/encryption/web-ui-default-module-value branch April 3, 2024 09:02
Copy link
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug feature: encryption (server-side) feedback-requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Default encryption module not loaded (v2.16.0) [Bug]: Unable to enable server-side encryption
3 participants