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: validate account properties as a repair step #50985

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Feb 23, 2025

Summary

Replace ValidatePhoneNumber from Nextcloud 21 with a new repair step,
ValidateAccountProperties which validates and sanitizes all account properties.
It ensures all existing values are valid (now that we also validate twitter and fediverse it could lead to issues like the reported one).

Checklist

@susnux susnux added bug 3. to review Waiting for reviews labels Feb 23, 2025
@susnux susnux added this to the Nextcloud 32 milestone Feb 23, 2025
@susnux susnux requested review from a team, artonge, skjnldsv and sorbaugh and removed request for a team February 23, 2025 18:29
@susnux
Copy link
Contributor Author

susnux commented Feb 23, 2025

/backport to stable31

@susnux
Copy link
Contributor Author

susnux commented Feb 23, 2025

/backport to stable30

@susnux
Copy link
Contributor Author

susnux commented Feb 23, 2025

/backport to stable29

@susnux susnux requested a review from come-nc February 23, 2025 18:30
@susnux susnux force-pushed the fix/account-property-validation branch from d47f311 to 3dfafc9 Compare February 24, 2025 08:31
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Possible performance issue for upgrades that will be an issue on larger instances

public function run(IOutput $output): void {
$numRemoved = 0;

$this->userManager->callForSeenUsers(function (IUser $user) use (&$numRemoved) {
Copy link
Member

Choose a reason for hiding this comment

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

This will cause long update times on larger instances. Please make sure that this is either running in a background job or marked as an expensive repair step so it is manually triggered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

or marked as an expensive repair step so it is manually triggered.

It is marked as expensive - basically it is the same as the removed repair step (also called for all seen users).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But if you prefer then we can migrate this to a background job.

Copy link
Member

Choose a reason for hiding this comment

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

Anything we can do to reduce time upgrades take is good. Background job would be best as with the expensive repair step there is the risk that the admin just never runs it (or we need extra logic to note as a setup check), but fine either way with me.

Replace `ValidatePhoneNumber` from Nextcloud 21 with a new repair step,
`ValidateAccountProperties` which validates and sanitizes all account
properties.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux susnux force-pushed the fix/account-property-validation branch from 3dfafc9 to 6016ebc Compare February 24, 2025 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: 31rc5 Error when upgrading or when setting user personal details / sanitizePropertyFediverse
4 participants