N°9772 - Migrating token's data in webhooks to avoid setup errors#30
Open
steffunky wants to merge 4 commits into
Open
N°9772 - Migrating token's data in webhooks to avoid setup errors#30steffunky wants to merge 4 commits into
steffunky wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a setup migration to decrypt legacy webhook tokens before converting their database column to a string.
Changes:
- Detects legacy blob-backed token columns.
- Decrypts and rewrites existing token values.
- Aborts migration when decryption fails.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Molkobain
reviewed
Jul 13, 2026
Comment on lines
+131
to
+142
| foreach ($aRows as $aRow) { | ||
| $iId = (int) $aRow['id']; | ||
| $sEncryptedValue = $aRow['token']; | ||
|
|
||
| // Try to decrypt token raw value | ||
| try { | ||
| $sDecryptedValue = $oSimpleCrypt->Decrypt($sEncryptionKey, $sEncryptedValue); | ||
| } catch (Exception $e) { | ||
| $aFailedIds[] = $iId; | ||
| SetupLog::Error("| Token migration failed for id={$iId}: {$e->getMessage()}"); | ||
| continue; | ||
| } |
Member
Author
There was a problem hiding this comment.
First part done, second part seems a bit overkill as it only work for unstable database state
Molkobain
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Base information
Symptom (bug)
When updating to a recent iTop version with existing
RemoteiTopConnectionToken, setup crashes as follow:Reproduction procedure (bug)
RemoteiTopConnectionTokenCause (bug)
In v1.4.2 due to bug N°7875 unexpected revert, the token attribute went from AttributeEncryptedString to AttributeEncryptedPassword to AttributeString in a matter of a single version.
Data went from encrypted
tinyblobto clearVARCHAR(255), bringing potential invalid characters to a varchar columnProposed solution
This pull request add a migration step as a BeforeDatabaseCreation method that tries to decrypt
tokendata if it's part of a*blobcolumn, and the update the token column data with the clear value.This lead column type migration that happens later to work
Checklist before requesting a review
Workaround
A workaround to this issue:
RemoteiTopConnectionTokenwith a CSV exportRemoteiTopConnectionTokenso the token column is populated with the clear data