-
Notifications
You must be signed in to change notification settings - Fork 265
PHPLIB-1728: Encryption flag in driver metadata #1809
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
Conversation
781e640 to
130f2e6
Compare
GromNaN
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR also extracts the options array into DriverOptions in order to simplify testing the I/O of options as we do quite a bit of transformation on them.
This sounds like a good idea, and this has no impact on users, since these classes are internal and cannot be accessed from public APIs.
But I question whether an undefined and a null option have the same meaning in this context.
8b56aa2 to
ddeaac1
Compare
There were some test cases re: this in |
GromNaN
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing. Do you need help for the spec tests?
@GromNaN I might do actually. I can't run tests locally for 8.1 cause pie is throwing an error when I install the extension so I gotta dig into that I think. |
3d10d4e to
d519d5e
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v2.x #1809 +/- ##
============================================
+ Coverage 87.74% 87.88% +0.13%
- Complexity 3185 3194 +9
============================================
Files 424 426 +2
Lines 6289 6345 +56
============================================
+ Hits 5518 5576 +58
+ Misses 771 769 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
d33fe69 to
a443ec4
Compare
a443ec4 to
636e924
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for indicating In-Use Encryption (IUE) in the MongoDB driver's handshake metadata by prepending "iue" to the platform field when auto-encryption is enabled. The implementation extracts driver options into a dedicated DriverOptions class and auto-encryption options into an AutoEncryptionOptions class to improve testability and maintainability.
Key changes:
- Created
DriverOptionsclass to encapsulate driver option handling and metadata generation - Created
AutoEncryptionOptionsclass to handle encryption-specific options - Modified
Clientclass to use the newDriverOptionsabstraction
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Model/DriverOptions.php | New class that handles driver options, including auto-encryption detection and platform metadata generation with "iue" flag |
| src/Model/AutoEncryptionOptions.php | New class that validates and processes auto-encryption configuration options |
| src/Client.php | Refactored to use DriverOptions and AutoEncryptionOptions classes, removing duplicated option handling logic |
| tests/Model/DriverOptionsTest.php | Comprehensive test coverage for DriverOptions class including encryption flag behavior |
| tests/Model/AutoEncryptionOptionsTest.php | Test coverage for AutoEncryptionOptions class validation and conversion |
| psalm.xml.dist | Added configuration to suppress RedundantConditionGivenDocblockType errors for runtime type checking |
| psalm-baseline.xml | Removed baseline entries for issues resolved by the refactoring in Client.php |
| server.pid | Process ID file, likely should not be committed |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
636e924 to
293fa6f
Compare
So we can unit test options, as we're transforming some of the options that are passed
293fa6f to
eef1068
Compare
eef1068 to
952cd62
Compare
Sending extra metadata in the handshake will allow us to detect when encryption is enabled. `iue` for In-Use Ecnryption was chosen to save bytes (as metadata will be truncated if it exceeds byte limit)
952cd62 to
0213c1e
Compare
Prepends
iueforIn-Use Encryptionto platform metadata string in MongoDB handshake. This will allow for easier detection of encryption usage in higher level libraries.This PR also extracts the options array into
DriverOptionsin order to simplify testing the I/O of options as we do quite a bit of transformation on them.