Skip to content

fix: ignore client sent option UUID and generate new UUID on column update - #2899

Open
samin-z wants to merge 3 commits into
mainfrom
bug/2897-selection-column-uuid
Open

fix: ignore client sent option UUID and generate new UUID on column update#2899
samin-z wants to merge 3 commits into
mainfrom
bug/2897-selection-column-uuid

Conversation

@samin-z

@samin-z samin-z commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Issue: #2897

Behaviour:

Upon column update, any UUID sent in the request payload is ignored (to prevent client manipulation and to preserve the server managed identity). existing options keep their stored UUID and new options get a newly generated one.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stableX.X
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

…pdate

Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
@samin-z
samin-z requested review from blizzz and enjeck as code owners August 19, 2026 08:28
@github-project-automation github-project-automation Bot moved this to 🧭 Planning evaluation (don't pick) in 📝 Productivity team Aug 19, 2026
@samin-z samin-z moved this from 🧭 Planning evaluation (don't pick) to 👀 In review in 📝 Productivity team Aug 19, 2026

@blizzz blizzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Brief look, left a comment. But a UUID should never be regenerated, it must remain stable once assigned upon creation.

Comment thread lib/Model/SelectionOption.php
Signed-off-by: samin-z <samin.zavarkesh@gmail.com>
@blizzz blizzz mentioned this pull request Aug 24, 2026
5 tasks
Comment on lines +107 to +111
if ($existing !== null) {
foreach ($existing as $existingOption) {
$existingByKey[$existingOption->key()] = $existingOption;
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need to worry about protecting agains t TypeError if stored options are null ?

Suggested change
if ($existing !== null) {
foreach ($existing as $existingOption) {
$existingByKey[$existingOption->key()] = $existingOption;
}
}
if ($existing !== null && $existing->jsonSerialize() !== null) {
foreach ($existing as $existingOption) {
$existingByKey[$existingOption->key()] = $existingOption;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When $existing is not null, it is SelectionOption and then it must have a key. So the jsonSerialize() check is not necessary.

}

/**
* UUIDs are never regenerated or taken from client input

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this comment still true? Column::fromDto parses with allowPassingUuid = true?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Create from Tables Structure should set them. And upcoming structure update as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe add a test for the existing options being null. The potential issue I mentioned earlier

Comment thread lib/Model/SelectionOption.php Outdated
* Generate a UUID when creating an option for the first time, existing ones are not replaced
*/
public function generateUuid(): void {
if ($this->uuid() !== null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it necessary to check if uuid() !== null ? Wondering if the guard insetUuid is enough already

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ack, seems duplicated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the duplicated check is already removed, setUuid() is no-ops if a UUID is set.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>

@blizzz blizzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tested successfully on top of table-scheme-import

Added a commit to re-run migration for the selection options

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.

3 participants