Skip to content

[MS-894] Add a custom CoSync deserializer that accounts for past versions of EnrolmentRecordCreationEvent#1116

Merged
BurningAXE merged 1 commit into
release/2025.1.0from
MS-894-CoSync-enrolments-made-with-SID-2023.3.3-pre-tokenization-are-not-parsed
Feb 25, 2025
Merged

[MS-894] Add a custom CoSync deserializer that accounts for past versions of EnrolmentRecordCreationEvent#1116
BurningAXE merged 1 commit into
release/2025.1.0from
MS-894-CoSync-enrolments-made-with-SID-2023.3.3-pre-tokenization-are-not-parsed

Conversation

@BurningAXE
Copy link
Copy Markdown
Contributor

@BurningAXE BurningAXE commented Feb 24, 2025

When using CoSync as data source SID fails to parse enrolments made with version < 2023.3.3 (first version that introduces tokenization). This is because in older versions moduleId and attendantId in EnrolmentRecordCreationPayload were plain Strings instead of TokenizableStrings.

@cla-bot cla-bot Bot added the ... label Feb 24, 2025
@meladRaouf
Copy link
Copy Markdown
Collaborator

@BurningAXE is this manadatory ? do we have any project that uses cosync and SID < 2023.3.3 ?

@BurningAXE
Copy link
Copy Markdown
Contributor Author

@BurningAXE is this manadatory ? do we have any project that uses cosync and SID < 2023.3.3 ?

The question is do we have any project that has saved CoSync enrolments from SID < 2023.3.3? And the answer is unfortunately yes!

@BurningAXE BurningAXE force-pushed the MS-894-CoSync-enrolments-made-with-SID-2023.3.3-pre-tokenization-are-not-parsed branch from 443e1d9 to 3c5a15f Compare February 25, 2025 09:44
@BurningAXE BurningAXE requested review from a team, TristramN, alex-vt, alexandr-simprints, luhmirin-s, meladRaouf and ybourgery and removed request for a team February 25, 2025 09:44
@BurningAXE BurningAXE marked this pull request as ready for review February 25, 2025 09:44
val moduleId = try {
ctxt.readTreeAsValue(payload["moduleId"], TokenizableString::class.java)
} catch (_: Exception) {
TokenizableString.Raw(payload["moduleId"].asText())
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.

I assume it would not be possible to see if the value is tokenized just without the appropriate meta-data, right?

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.

Unfortunately, no. We have the same problem for the "middle case" where we serilized TokenizableString without explicitly specifying the class (Raw or Tokenized). What we do downstream is try to decrypt Raw values to check whether they are actually encrypted or not. For Tokenized we are sure they are actually what they say they are.

@sonarqubecloud
Copy link
Copy Markdown

@BurningAXE BurningAXE merged commit 498b94b into release/2025.1.0 Feb 25, 2025
@luhmirin-s luhmirin-s deleted the MS-894-CoSync-enrolments-made-with-SID-2023.3.3-pre-tokenization-are-not-parsed branch February 25, 2025 10:48
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.

4 participants