You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/use-cases/sensitive-data-encryption.txt
+69-36Lines changed: 69 additions & 36 deletions
Original file line number
Diff line number
Diff line change
@@ -13,26 +13,59 @@ Sensitive Data Encryption
13
13
Introduction
14
14
------------
15
15
16
-
Cras sed rutrum nisi, vitae tristique risus. Aliquam erat volutpat.
17
-
Donec auctor nisl eget ornare accumsan. Pellentesque lectus tortor,
18
-
consectetur molestie pellentesque ac, blandit non libero.
16
+
Many applications make use of sensitive data such as confidential personal details, payment information, or proprietary data. In some jurisdictions, this type of data is subject to governance, privacy, and security compliance mandates. Unauthorized access of sensitive data or a failure to comply with a mandate often results in significant reputation damage and financial penalties. Therefore, it is important to keep sensitive data secure.
17
+
18
+
MongoDB offers several methods that protect your data from unauthorized access including:
19
+
20
+
* `Role-based access control <https://docs.mongodb.com/manual/core/authorization/>`_
21
+
* `Monitoring and logging <https://docs.mongodb.com/manual/core/auditing/>`_
22
+
* `TLS/SSL network transport encryption <https://docs.mongodb.com/manual/core/security-transport-encryption/>`_
23
+
* `Encryption at rest <https://docs.mongodb.com/manual/core/security-encryption-at-rest/>`_
24
+
25
+
Another MongoDB feature that prevents unauthorized access of data is `Client-Side Field Level Encryption (CSFLE) <https://docs.mongodb.com/manual/core/security-client-side-encryption/>`_. This feature allows a developer to selectively encrypt individual fields of a document on the client-side before it is sent to the server. This keeps the encrypted data private from the providers hosting the database as well as any user that has direct access to the database.
26
+
27
+
This guide provides steps for setup and implementation of CSFLE with a practical example.
28
+
29
+
.. note::
30
+
31
+
Client-side Field Level Encryption is available starting in MongoDB 4.2 Enterprise only.
19
32
20
33
Problem
21
34
~~~~~~~
22
35
23
-
Pellentesque non mi et est congue mattis pretium sit amet mi. Praesent
24
-
nec tortor nec arcu molestie dapibus. Phasellus at nunc ut quam molestie
25
-
finibus. Suspendisse finibus lectus eget nulla eleifend, vel consequat
26
-
leo rhoncus. Phasellus lacinia tortor id aliquet condimentum. Morbi
27
-
sodales est a leo rhoncus, non pretium neque dignissim.
36
+
In this scenario, we secure sensitive data on a Medical Care Management System which stores patients' personal information, insurance information, and medical records for a fictional company, *MedcoMD*. None of the patient data is public, and certain data such as their social security number (SSN), insurance policy number, and vital sign measurements are particularly sensitive and subject to privacy compliance. It is important for the company and the patient that the data is kept private and secure.
37
+
38
+
MedcoMD needs this system to satisfy the following use cases:
39
+
40
+
- Doctors use the system to access Patients' medical records, insurance information, and add new vital sign measurements.
41
+
- Receptionists use the system to verify the Patients' identity, using a combination of their contact information and the last four digits of their Social Security Number (SSN).
42
+
- Receptionists can view a Patient's insurance policy provider, but not their policy number.
43
+
- Receptionists cannot access a Patient's medical records.
44
+
45
+
MedcoMD is also concerned with disclosure of sensitive data through any of the following methods:
46
+
47
+
- Accidental disclosure of data on the Receptionist's publicly-viewable screen.
48
+
- Direct access to the database by a superuser such as a database administrator.
49
+
- Capture of data over an insecure network.
50
+
- Access to the data by reading a server's memory.
51
+
- Access to the on-disk data by reading database or backup files.
52
+
53
+
What can MedcoMD do to balance the functionality and access restrictions of their Medical Care Management System?
28
54
29
55
Solution
30
56
~~~~~~~~
31
57
32
-
Praesent sit amet elit pretium mi molestie porta a sit amet ipsum. Sed
33
-
sollicitudin purus et mi blandit sodales.
58
+
The MedcoMD software engineers review the Medical Care Management System specification and research the proper solution for limiting access to sensitive data.
59
+
60
+
The first MongoDB security feature they evaluated was `Role-Based Access Control <https://docs.mongodb.com/manual/core/authorization/>`_ which allows administrators to grant and restrict collection-level permissions for users. With the appropriate role definition and assignment, this solution prevents accidental disclosure of data and access. However, it does not prevent capture of the data over an insecure network, direct access of data by a superuser, access to data by reading the server's memory, or access to on-disk data by reading the database or backup files.
61
+
62
+
The next MongoDB security features they evaluated were `Encryption at Rest <https://docs.mongodb.com/manual/core/security-encryption-at-rest/>`_ which encrypts the database files on disk and `Transport Encryption using TLS/SSL <https://docs.mongodb.com/manual/core/security-transport-encryption/>`_ which encrypts data over the network. When applied together, these two features prevent access to on-disk database files as well as capture of the data on the network, respectively. When combined with Role-Based Access Control, these three security features offer near-comprehensive security coverage of the sensitive data, but lack a mechanism to prevent the data from being read from the server's memory.
34
63
35
-
- Deterministic vs Non-Deterministic
64
+
Finally, the MedcoMD developers discovered a feature that independently satisfies all the security criteria. Client-side Field Level Encryption allows the developers to specify the fields of a document that should be kept encrypted. Sensitive data is transparently encrypted/decrypted by the client and only communicated to and from the server in encrypted form. This mechanism keeps the specified data fields secure in encrypted form on both the server and the network. While all clients have access to the non-sensitive data fields, only appropriately-configured CSFLE clients are able to read and write the sensitive data fields.
65
+
66
+
MedcoMD will provide Receptionists with a client that is not configured to access data encrypted with CSFLE. This will prevent them from viewing the sensitive fields and accidentally leaving them displayed on-screen in a public area. MedcoMD will provide Doctors with a client with CSFLE enabled which will allow them to access the sensitive data fields in the privacy of their own office.
67
+
68
+
Equipped with CSFLE, MedcoMD can keep their sensitive data secure and compliant to data privacy regulations with MongoDB.
36
69
37
70
Procedure
38
71
---------
@@ -95,11 +128,11 @@ B. Define a JSON Schema
95
128
~~~~~~~~~~~~~~~~~~~~~~~
96
129
97
130
`JSON Schema
98
-
<http://json-schema.org/>`_ is a vocabulary that allows you to annotate and
131
+
<http://json-schema.org/>`_ is a vocabulary that allows you to annotate and
99
132
validate JSON documents. MongoDB extends the JSON Schema standard to allow CSFLE
100
-
to use automatically encrypt and decrypt the fields of documents in a collection.
133
+
to use automatically encrypt and decrypt the fields of documents in a collection.
101
134
102
-
The following fields are required in the JSON Schema to enable automatic
135
+
The following fields are required in the JSON Schema to enable automatic
103
136
encryption and decryption for each field:
104
137
105
138
* The encryption algorithm (:manual:`Deterministic Encryption </core/security-client-side-encryption#deterministic-encryption>` or :manual:`Random Encryption </core/security-client-side-encryption#random-encryption>`)
@@ -124,7 +157,7 @@ the data model of the Medco Management System.
124
157
- Encryption Algorithm
125
158
- BSON Type
126
159
* - Name
127
-
- Non-Encrypted
160
+
- Non-Encrypted
128
161
- String
129
162
* - SSN
130
163
- Deterministic
@@ -137,7 +170,7 @@ the data model of the Medco Management System.
137
170
- Array
138
171
* - Insurance: Policy Number
139
172
- Deterministic
140
-
- Int (embedded inside `insurance` object)
173
+
- Int (embedded inside `insurance` object)
141
174
* - Insurance: Provider
142
175
- Non-Encrypted
143
176
- String (embedded inside `insurance` object)
@@ -151,7 +184,7 @@ encryption method to use. Initially, they define a data key for all
151
184
fields in the data model by specifying the `encryptMetadata
attribute. All child properties will inherit this encryption key unless
154
-
specifically overwritten.
187
+
specifically overwritten.
155
188
156
189
.. code-block:: javascript
157
190
@@ -161,7 +194,7 @@ specifically overwritten.
161
194
"keyId" : // copy and paste your keyID generated here
162
195
},
163
196
"properties": {
164
-
// copy and paste your fields here
197
+
// copy and paste your fields here
165
198
}
166
199
}
167
200
@@ -171,11 +204,11 @@ the `properties` map.
171
204
SSN
172
205
+++
173
206
``ssn`` is a field representing the patient's social security number. This
174
-
field is sensitive and should be encrypted. MedcoMD engineers decide
207
+
field is sensitive and should be encrypted. MedcoMD engineers decide
175
208
upon deterministic encryption based on the following properties:
176
209
177
210
* Queryable
178
-
* High cardinality
211
+
* High cardinality
179
212
180
213
.. code-block:: json
181
214
@@ -190,12 +223,12 @@ upon deterministic encryption based on the following properties:
190
223
191
224
Blood Type
192
225
++++++++++
193
-
``bloodType`` is a field representing the patient's blood type. This field is
194
-
sensitive and should be encrypted. MedcoMD engineers decide
226
+
``bloodType`` is a field representing the patient's blood type. This field is
227
+
sensitive and should be encrypted. MedcoMD engineers decide
195
228
upon random encryption based on the following properties:
196
229
197
230
* No plans to query
198
-
* Low cardinality
231
+
* Low cardinality
199
232
200
233
.. code-block:: json
201
234
@@ -209,10 +242,10 @@ upon random encryption based on the following properties:
209
242
210
243
Medical Records
211
244
+++++++++++++++
212
-
``medicalRecords`` is an array field holding a set of medical records. Each
213
-
medical record document specifies information, such as the patient's blood
214
-
pressure, weight, and heart rate. This field is sensitive and should be
215
-
encrypted. MedcoMD engineers decide upon random encryption based on
245
+
``medicalRecords`` is an array field holding a set of medical records. Each
246
+
medical record document specifies information, such as the patient's blood
247
+
pressure, weight, and heart rate. This field is sensitive and should be
248
+
encrypted. MedcoMD engineers decide upon random encryption based on
216
249
the following properties:
217
250
218
251
* Array fields must use random encryption with CSFLE to enable auto-encryption
@@ -228,13 +261,13 @@ the following properties:
228
261
229
262
Insurance: Policy Number
230
263
++++++++++++++++++++++++
231
-
``insurance.policyNumber`` is a field embedded inside the ``Insurance`` object
232
-
field and represents the patient's policy number. This policy number is a
233
-
distinct and sensitive field. MedcoMD engineers decide upon
264
+
``insurance.policyNumber`` is a field embedded inside the ``Insurance`` object
265
+
field and represents the patient's policy number. This policy number is a
266
+
distinct and sensitive field. MedcoMD engineers decide upon
234
267
deterministic encryption based on the following properties:
235
268
236
269
* Queryable
237
-
* High cardinality
270
+
* High cardinality
238
271
239
272
.. code-block:: json
240
273
@@ -248,14 +281,14 @@ deterministic encryption based on the following properties:
248
281
}
249
282
}
250
283
}
251
-
}
284
+
}
252
285
253
286
254
287
Recap
255
288
+++++++
256
-
MedcoMD engineers created a JSON Schema that satisfies their requirements of
257
-
making sensitive data queryable and secure. View the full `JSON Schema
258
-
for the Medco Medical Management System <https://raw.githubusercontent.com/mongodb/docs-assets/DOCSP-json-schema-helper-and-json/MedcoMDSchema.json>`_.
289
+
MedcoMD engineers created a JSON Schema that satisfies their requirements of
290
+
making sensitive data queryable and secure. View the full `JSON Schema
291
+
for the Medco Medical Management System <https://raw.githubusercontent.com/mongodb/docs-assets/DOCSP-json-schema-helper-and-json/MedcoMDSchema.json>`_.
259
292
260
293
261
294
.. tabs::
@@ -266,7 +299,7 @@ for the Medco Medical Management System <https://raw.githubusercontent.com/mongo
266
299
name: "Java"
267
300
content: |
268
301
269
-
View the `helper code in Java <https://gist.github.com/ccho-mongodb/088176b1bed3b9e54cdc0c2c3c537d1b>`_.
302
+
View the `helper code in Java <https://gist.github.com/ccho-mongodb/088176b1bed3b9e54cdc0c2c3c537d1b>`_.
0 commit comments