Skip to content

Commit

Permalink
Docs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
seshubaws committed Jan 30, 2024
1 parent b7a3345 commit 62e1aba
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
18 changes: 9 additions & 9 deletions docs/utilities/data_masking.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ stateDiagram-v2
## Key features

* Encrypt, decrypt, or irreversibly erase data with ease
* Remove sensitive information in one or more fields within nested data
* Erase sensitive information in one or more fields within nested data
* Seamless integration with [AWS Encryption SDK](https://docs.aws.amazon.com/encryption-sdk/latest/developer-guide/introduction.html){target="_blank"} for industry and AWS security best practices

## Terminology

**Erasing** replaces sensitive information **irreversibly** with a non-sensitive placeholder _(`*****`)_. This operation replaces data in-memory, making it a one-way action.

**Encrypting** transforms plaintext into ciphertext using an encryption algorithm and a cryptographic key. It allows you to encrypt any sensitive data, so only allowed personnel to decrypt it.
**Encrypting** transforms plaintext into ciphertext using an encryption algorithm and a cryptographic key. It allows you to encrypt any sensitive data, so only allowed personnel to decrypt it. Learn more about encryption [here](https://aws.amazon.com/blogs/security/importance-of-encryption-and-how-aws-can-help/){target="_blank"}.

**Decrypting** transforms ciphertext back into plaintext using a decryption algorithm and the correct decryption key.

Expand Down Expand Up @@ -179,16 +179,16 @@ Under the hood, we delegate a [number of operations](#decrypt-operation-with-enc

### Encryption context for integrity and authenticity

For a stronger security posture, you can add metadata to each encryption operation, and verify them during decryption. This is known as additional authenticated data (AAD). These are non-sensitive data that can help protect authenticity and integrity of your encrypted data.
For a stronger security posture, you can add metadata to each encryption operation, and verify them during decryption. This is known as additional authenticated data (AAD). These are non-sensitive data that can help protect authenticity and integrity of your encrypted data, and even help to prevent a [confused deputy](https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html) situation.

???+ danger "Important considerations you should know"
1. **Exact match verification on decrypt**. Be careful using random data like `timestamps` as encryption context if you can't provide them on decrypt.
2. **Only `string` values are supported**. We will raise `DataMaskingUnsupportedTypeError` for non-string values.
3. **Use non-sensitive data only**. When using KMS, encryption context is available as plaintext in AWS CloudTrail. Unless you [intentionally disabled KMS events](https://docs.aws.amazon.com/kms/latest/developerguide/logging-using-cloudtrail.html#filtering-kms-events){target="_blank"}.
3. **Use non-sensitive data only**. When using KMS, encryption context is available as plaintext in AWS CloudTrail, unless you [intentionally disabled KMS events](https://docs.aws.amazon.com/kms/latest/developerguide/logging-using-cloudtrail.html#filtering-kms-events){target="_blank"}.

=== "getting_started_encryption_context.py"

```python hl_lines="27-29"
```python hl_lines="26-28"
--8<-- "examples/data_masking/src/getting_started_encryption_context.py"
```

Expand Down Expand Up @@ -348,13 +348,13 @@ Here are common scenarios to best visualize how to use `fields`.

=== "Data"

> Expression: `data_masker.erase(data, fields=["$.address[?(@.postcode > 81846)]"])`
> Expression: `data_masker.erase(data, fields=["$.address[?(@.postcode > 12000)]"])`

> `$`: Represents the root of the JSON structure.

> `.address`: Selects the "address" property within the JSON structure.

> `(@.postcode > 81846)`: Specifies the condition that elements should meet. It selects elements where the value of the `postcode` property is `greater than 81846`.
> `(@.postcode > 12000)`: Specifies the condition that elements should meet. It selects elements where the value of the `postcode` property is `greater than 12000`.

```json hl_lines="8 12"
--8<-- "examples/data_masking/src/choosing_payload_complex_search.json"
Expand Down Expand Up @@ -406,7 +406,7 @@ For compatibility or performance, you can optionally pass your own JSON serializ

=== "advanced_custom_serializer.py"

```python hl_lines="16"
```python hl_lines="17-18"
--8<-- "examples/data_masking/src/advanced_custom_serializer.py"
```

Expand All @@ -429,7 +429,7 @@ The AWS Encryption SDK defaults to using the `AES_256_GCM_HKDF_SHA512_COMMIT_KEY

=== "changing_default_algorithm.py"

```python hl_lines="5 29"
```python hl_lines="5 26"
--8<-- "examples/data_masking/src/changing_default_algorithm.py"
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "card_number",
"name": "Carlos",
"operation": "non sensitive",
"card_number": "1111 2222 3333 4444",
"address": {
Expand Down
4 changes: 3 additions & 1 deletion examples/data_masking/src/encrypt_data_output.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{"body": "AgV4uF5K2YMtNhYrtviTwKNrUHhqQr73l/jNfukkh+qLOC8AXwABABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREEvcjEyaFZHY1R5cjJuTDNKbTJ3UFA3R3ZjaytIdi9hekZqbXVUb25Ya3J5SzFBOUlJZDZxZXpSR1NTVnZDUUxoZz09AAEAB2F3cy1rbXMAS2Fybjphd3M6a21zOnVzLWVhc3QtMToyMDA5ODQxMTIzODY6a2V5LzZkODJiMzRlLTM2NjAtNDRlMi04YWJiLTdmMzA1OGJlYTIxMgC4AQIBAHjxYXAO7wQGd+7qxoyvXAajwqboF5FL/9lgYUNJTB8VtAHBP2hwVgw+zypp7GoMNTPAAAAAfjB8BgkqhkiG9w0BBwagbzBtAgEAMGgGCSqGSIb3DQEHATAeBglghkgBZQMEAS4wEQQMx/B25MTgWwpL7CmuAgEQgDtan3orAOKFUfyNm3v6rFcglb+BVVVDV71fj4aRljhpg1ixsYFaKsoej8NcwRktIiWE+mw9XmTEVb6xFQIAABAA9DeLzlRaRQgTcXMJG0iBu/YTyyDKiROD+bU1Y09X9RBz5LA1nWIENJKq2seAhNSB/////wAAAAEAAAAAAAAAAAAAAAEAAAEBExLJ9wI4n7t+wyPEEP4kjYFBdkmNuLLsVC2Yt8mv9Y1iH2G+/g9SaIcdK57pkoW0ECpBxZVOxCuhmK2s74AJCUdem9McjS1waUKyzYTi9vv2ySNBsABIDwT990rE7jZJ3tEZAqcWZg/eWlxvnksFR/akBWZKsKzFz6lF57+cTgdISCEJRV0E7fcUeCuaMaQGK1Qw2OCmIeHEG5j5iztBkZG2IB2CVND/AbxmDUFHwgjsrJPTzaDYSufcGMoZW1A9X1sLVfqNVKvnOFP5tNY7kPF5eAI9FhGBw8SjTqODXz4k6zuqzy9no8HtXowP265U8NZ5VbVTd/zuVEbZyK5KBqzP1sExW4Rhn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kPF5eAI9FhGBw8SjTqODXz4k6zuqzy9no8HtXowP265U8NZ5VbVTd/zuVEbZyK5KBqzP1sExW4RhnlpXMoOs9WSuAGcwZQIxANTeEwb9V7CacV2Urt/oCqysUzhoV2AcT2ZjryFqY79Tsg+FRpIx7cBizL4ieRzbhQIwcRasNncO5OZOcmVr0MqHv+gCVznndMgjXJmWwUa7h6skJKmhhMPlN0CsugxtVWnD"
}
2 changes: 1 addition & 1 deletion examples/data_masking/src/getting_started_decrypt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ def lambda_handler(event: dict, context: LambdaContext) -> dict:

logger.info("Decrypting whole object")

decrypted = data_masker.decrypt(data) # (3)!
decrypted = data_masker.decrypt(data)

return decrypted
2 changes: 1 addition & 1 deletion examples/data_masking/src/getting_started_encrypt_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ def lambda_handler(event: dict, context: LambdaContext) -> dict:

logger.info("Encrypting the whole object")

encrypted = data_masker.encrypt(data) # (2)!
encrypted = data_masker.encrypt(data)

return {"body": encrypted}
2 changes: 1 addition & 1 deletion examples/data_masking/tests/test_lambda_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def lambda_context():
class LambdaContext:
function_name: str = "test"
memory_limit_in_mb: int = 128
invoked_function_arn: str = "arn:aws:lambda:eu-west-1:809313241:function:test"
invoked_function_arn: str = "arn:aws:lambda:eu-west-1:111111111:function:test"
aws_request_id: str = "52fdfc07-2182-154f-163f-5f0f9a621d72"

def get_remaining_time_in_millis(self) -> int:
Expand Down

0 comments on commit 62e1aba

Please sign in to comment.