MONGOCRYPT-922 Make padding strings unique#1182
Open
kevinAlbs wants to merge 3 commits into
Open
Conversation
df6de4b to
c2acc24
Compare
Gets test passing to ensure padding tokens are obtained from unique strings
c2acc24 to
31adbe6
Compare
erwee
reviewed
May 26, 2026
Collaborator
erwee
left a comment
There was a problem hiding this comment.
Discussed this with the crypto team. We'll be disputing the finding that an adversary can tell the real affix length after the document has been inserted (They shouldn't because each of the "fake" padding tokens have already been mapped to unique safeContent tags). So I don't think this change will be needed (perhaps not yet).
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.
Summary
Make padding strings unique.
Background & Motivation
See report in MONGOCRYPT-913 for details. This addresses finding with ID 1.
Quoting https://docs.google.com/document/d/1KhCFiofunsk7VeVB4VftvxFd9rQQOZrBQaTqHCljHtU/edit?tab=t.0:
This PR proposes appending a four byte counter after the
0xFFto ensure all padding strings are unique.Testing
Appending an additional four bytes resulted in needing to extend the test data in
RNG_DATA.hin substring tests to avoid the error "Out of random data".To additionally verify changes, the QE Text driver spec and prose tests were run locally with the C driver. The only necessary changes in tests were to update the exoected
__safeContent__(which I expect is a direct result of updating the padding string contents).