Skip to content

PHPC-2197: Support queryable encryption range indexes #1409

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

Merged
merged 2 commits into from
May 30, 2023

Conversation

jmikola
Copy link
Member

@jmikola jmikola commented Apr 6, 2023

jmikola added a commit to jmikola/mongo-php-library that referenced this pull request Apr 18, 2023
jmikola added a commit to jmikola/mongo-php-library that referenced this pull request Apr 21, 2023
@jmikola jmikola force-pushed the phpc-2197 branch 2 times, most recently from 179778f to 0f5a0c2 Compare May 19, 2023 08:15
jmikola added a commit to jmikola/mongo-php-library that referenced this pull request May 28, 2023
@jmikola jmikola marked this pull request as ready for review May 29, 2023 04:31
@jmikola jmikola requested a review from GromNaN May 29, 2023 04:44
jmikola added 2 commits May 29, 2023 12:57
Define algorithm and query type constants for range preview
Note that it is not possible to write a test for decrypt() since Binary instances always encode to BSON.
var_dump($encryptedExpr->{'$and'}[0]->encryptedInt->{'$gte'}->getType() === MongoDB\BSON\Binary::TYPE_ENCRYPTED);

var_dump($encryptedExpr->{'$and'}[1]->encryptedInt->{'$lte'} instanceof MongoDB\BSON\Binary);
var_dump($encryptedExpr->{'$and'}[1]->encryptedInt->{'$lte'}->getType() === MongoDB\BSON\Binary::TYPE_ENCRYPTED);
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: dumping the entire $encryptedExpr object and asserting the contents of both Binary objects with %a (see: EXPECTF) was unreliable for the same reasons as Session assertions. See 2104d6d for more context.

@@ -943,6 +1089,10 @@ static void phongo_clientencryption_decrypt(php_phongo_clientencryption_t* clien

php_phongo_zval_to_bson_value(zciphertext, PHONGO_BSON_NONE, &ciphertext);

if (EG(exception)) {
goto cleanup;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is added for consistency but we don't actually test for this since decrypt() expects a Binary and that is always going to successfully encode to BSON.

This is also mentioned in the commit message.

Copy link
Member

Choose a reason for hiding this comment

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

You mean it's inaccessible code, intentionally added? That seems strange to me. A comment in the code would be more appropriate.

Copy link
Member Author

Choose a reason for hiding this comment

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

See #1412 (comment) for a recent discussion about this very issue in @alcaeus' PR.

I think ideally we'd use assertions here, as is sometimes done in libmongoc; however, there's no prior art in PHPC for doing so.

I created PHPC-2235 to track this, but I'd prefer to leave this in place for now since it'd be easily detected by tooling should we end up integrating that.

@jmikola jmikola merged commit b93f7c2 into mongodb:master May 30, 2023
@jmikola jmikola deleted the phpc-2197 branch May 30, 2023 11:27
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.

2 participants