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

Revert "Revert "TableauConnectedApp, TransifexOrganization, and OpenmrsImporter models: AES CBC encryption Migration "" #35802

Merged
merged 3 commits into from
Feb 19, 2025

Conversation

Jtang-1
Copy link
Contributor

@Jtang-1 Jtang-1 commented Feb 19, 2025

Reverts #35725

This reintroduces the changes in the original PR #35666 and fixes a bug where the encrypted_secret_value field in TableauConnectedApp had an insufficient max_char limit.

…rsImporter models: AES CBC encryption Migration ""
@dimagimon dimagimon added the reindex/migration Reindex or migration will be required during or before deploy label Feb 19, 2025
@Jtang-1 Jtang-1 marked this pull request as ready for review February 19, 2025 07:14
@MartinRiese
Copy link
Contributor

@Jtang-1 Just looked at the second commit, which I thought were the only new changes. What was the reason for the revert? I am missing a bit of context.

…s encrypted so on the migration, it needs to be directly reencrypted
@Jtang-1
Copy link
Contributor Author

Jtang-1 commented Feb 19, 2025

@MartinRiese There's two new commits (I just added another). The issue was that the cbc encryption method results in a longer string (>64). However, the encrypted_secret_value field was originally set with a max_length of 64 so this caused an error upon trying to save the reenecrypted value.

Sravan reverted the previous PR before it was deployed to production (he found the issue upon trying to deploy to staging).

else:
ciphertext = b64_aes_cbc_encrypt(encrypted_secret_value)
connected_app.encrypted_secret_value = f'${ALGO_AES_CBC}${ciphertext}'
connected_app.encrypted_secret_value = reencrypt_ecb_to_cbc_mode(
Copy link
Contributor

Choose a reason for hiding this comment

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

Because reencrypt_ecb_to_cbc_mode does the b64 part as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes but the main fix was that the value is guaranteed to already be encrypted with ecb and without a prefix.

@Jtang-1 Jtang-1 merged commit 628036a into master Feb 19, 2025
14 checks passed
@Jtang-1 Jtang-1 deleted the revert-35725-revert-35666-jt/cbc-migration-pt2 branch February 19, 2025 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reindex/migration Reindex or migration will be required during or before deploy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants