@@ -79,26 +79,37 @@ Example of configuration for AWS
79
79
Encrypted Fields Map
80
80
--------------------
81
81
82
- You can configure which fields are encrypted in each collection by specifying the
82
+ The encrypted fields are set to the collection when you create it, and the MongoDB
83
+ client will query the server for the collection schema before performing any
84
+ operations. For additional security, you can also specify the encrypted fields
85
+ in the connection configuration, which allows the client to use local rules
86
+ instead of downloading the remote schema from the server, that could potentially
87
+ be tampered with if an attacker compromises the server.
88
+
89
+ The Encrypted Fields Maps is a list of all encrypted fields associated with all
90
+ the collection namespaces that has encryption enabled. To configure it, you
91
+ can run a command that extract the encrypted fields from the server and generate
92
+ the ``encryptedFieldsMap `` configuration.
93
+
94
+ .. code-block :: console
95
+
96
+ php bin/console doctrine:mongodb:dump-encrypted-fields-map --format yaml
97
+
98
+ The output of the command will be a YAML configuration for the
83
99
``autoEncryption.encryptedFieldsMap `` option in the connection configuration.
84
- This setting is **recommended ** for improved security and performance.
85
100
86
101
- If the connection ``encryptedFieldsMap `` object contains a key for the specified
87
- collection, the client uses that object to perform automatic Queryable Encryption,
88
- rather than using the remote schema. At minimum, the local rules must encrypt
89
- all fields that the remote schema does.
102
+ collection namespace , the client uses that object to perform automatic
103
+ Queryable Encryption, rather than using the remote schema. At minimum, the
104
+ local rules must encrypt all fields that the remote schema does.
90
105
91
106
- If the connection ``encryptedFieldsMap `` object doesn't contain a key for the
92
- specified collection, the client downloads the server-side remote schema for
93
- the collection and uses it instead.
107
+ specified collection namespace , the client downloads the server-side remote
108
+ schema for the collection and uses it instead.
94
109
95
110
For more details, see the official MongoDB documentation:
96
111
`Encrypted Fields and Enabled Queries <https://www.mongodb.com/docs/manual/core/queryable-encryption/fundamentals/encrypt-and-query/ >`_.
97
112
98
- Note that there is no ``fields `` key in the configuration of each collection
99
- for the bundle configuration. Instead, you directly specify the list of
100
- encrypted fields as an array under the collection namespace.
101
-
102
113
.. tabs ::
103
114
104
115
.. group-tab :: YAML
@@ -111,9 +122,10 @@ encrypted fields as an array under the collection namespace.
111
122
autoEncryption :
112
123
encryptedFieldsMap :
113
124
" mydatabase.mycollection " :
114
- - keyId : { $binary: { base64: 2CSosXLSTEKaYphcSnUuCw==, subType: '04' } }
115
- path : " sensitive_field"
116
- bsonType : " string"
125
+ fields :
126
+ - keyId : { $binary: { base64: 2CSosXLSTEKaYphcSnUuCw==, subType: '04' } }
127
+ path : " sensitive_field"
128
+ bsonType : " string"
117
129
118
130
.. group-tab :: XML
119
131
@@ -124,11 +136,13 @@ encrypted fields as an array under the collection namespace.
124
136
<doctrine : encryptedFieldsMap >
125
137
<![CDATA[
126
138
{
127
- "mydatabase.mycollection": [
128
- "keyId": { "$binary": { "base64": "2CSosXLSTEKaYphcSnUuCw==", "subType": "04" } },
129
- "path": "sensitive_field",
130
- "bsonType": "string"
131
- ]
139
+ "mydatabase.mycollection": {
140
+ fields: [
141
+ "keyId": { "$binary": { "base64": "2CSosXLSTEKaYphcSnUuCw==", "subType": "04" } },
142
+ "path": "sensitive_field",
143
+ "bsonType": "string"
144
+ ]
145
+ }
132
146
}
133
147
]]>
134
148
</doctrine : encryptedFieldsMap >
@@ -146,10 +160,12 @@ encrypted fields as an array under the collection namespace.
146
160
->autoEncryption([
147
161
'encryptedFieldsMap' => [
148
162
'mydatabase.mycollection' => [
149
- [
150
- 'path' => 'sensitive_field',
151
- 'keyId' => ['$binary' => ['base64' => '2CSosXLSTEKaYphcSnUuCw==', 'subType' => '04' ] ],
152
- 'bsonType' => 'string',
163
+ 'fields' => [
164
+ [
165
+ 'path' => 'sensitive_field',
166
+ 'keyId' => ['$binary' => ['base64' => '2CSosXLSTEKaYphcSnUuCw==', 'subType' => '04' ] ],
167
+ 'bsonType' => 'string',
168
+ ],
153
169
],
154
170
],
155
171
],
0 commit comments