Skip to content

Commit 2aa0d81

Browse files
committed
Escape mongocryptd path before calling it
1 parent 8a8bdd4 commit 2aa0d81

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/DataCollector/EncryptionDiagnostic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private function getMongocryptdVersion(?string $mongocryptdPath): ?string
7171
}
7272

7373
$output = [];
74-
exec($mongocryptdPath . ' --version', $output);
74+
exec(escapeshellarg($mongocryptdPath) . ' --version', $output);
7575

7676
if (isset($output[0])) {
7777
return trim($output[0]);

src/DependencyInjection/DoctrineMongoDBExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ private function normalizeAutoEncryption(array $autoEncryption, string $defaultD
542542

543543
if (isset($autoEncryption['encryptedFieldsMap'])) {
544544
foreach ($autoEncryption['encryptedFieldsMap'] as &$value) {
545+
// Wrap the encrypted fields in a 'fields' key as required the encryptedFieldsMap structure.
546+
// Some values can be BSON binary, date or numbers, the extended JSON format is used to convert them BSON document.
545547
$value = (new Definition(BsonDocument::class))->setFactory([BsonDocument::class, 'fromJSON'])->setArguments([json_encode(['fields' => $value])]);
546548
}
547549
}

0 commit comments

Comments
 (0)