Raw AES Keyring zeros out passed in unwrappedMasterKey
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- cryptography
Research direction
Read the materials manager code in modules/material-management/src/cryptographic_material.ts around lines 823-838, then inspect the Raw AES keyring constructor in modules/raw-aes-keyring-node/src/raw_aes_keyring_node.ts around line 63. Confirm that the constructor defensively copies the customer-provided unwrappedMasterKey so later material processing does not zero the caller's buffer.
Written by the indexing model from the issue text.
Description
Problem:
The materials manager zeros out the dataKey in the processing of creating wrapping key material during construction:
https://github.com/aws/aws-encryption-sdk-javascript/blob/6b1d1a6cd62d56dfb47eb9b70307b5f9083e5e10/modules/material-management/src/cryptographic_material.ts#L823-L838
This is normally good practice. However in the case where the buffer has been passed in by the customer via Keyring creation, for example in the Raw AES Keyring case, this leads to surprising behavior.
The Raw AES Keyrings does not make a defensive copy of the key material before creating this material: https://github.com/aws/aws-encryption-sdk-javascript/blob/master/modules/raw-aes-keyring-node/src/raw_aes_keyring_node.ts#L63
And thus the "unwrappedMasterKey" that the customer passed in looks like it gets "consumed." This is surprising to the customer, especially since our docs have no indication of this behavior.
Solution:
The Raw AES Keyring should make a defensive copy of the "unwrappedMasterKey" in it's constructor. It is the responsibility of the customer to zero out the "unwrappedMasterKey" in their application after creation of the Keyring if it is no longer needed, in order to minimize the time the data key exists in plaintext in memory.
Out of scope:
Is there anything the solution will intentionally NOT address?
- Dominant language
- TypeScript
- Stars
- 260
- Forks
- 68
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-encryption-sdk-javascript
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aws/aws-encryption-sdk-javascript#1656 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 68/100
aws/aws-encryption-sdk-javascript#1691 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
aws/aws-encryption-sdk-javascript#1665 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
aws/aws-encryption-sdk-javascript#1663 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
aws/aws-encryption-sdk-javascript#1520 · 1 comment ·
All issues in aws/aws-encryption-sdk-javascript
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·