Skip to content

Commit

Permalink
Kek in an isolated buffer to ensure it isnt mutated
Browse files Browse the repository at this point in the history
  • Loading branch information
mattschoch committed Mar 4, 2024
1 parent da72887 commit 162a982
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/policy-engine/src/encryption/core/encryption.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ export class EncryptionService implements OnApplicationBootstrap {
}

private getKeyEncryptionKeyring(kek: Buffer) {
// Allocate a new isolated buffer to ensure we don't manipulate the kek
const isolatedKek = Buffer.alloc(kek.length)
kek.copy(isolatedKek, 0, 0, kek.length)

const keyring = new RawAesKeyringNode({
keyName: 'armory.engine.kek',
keyNamespace,
unencryptedMasterKey: kek,
unencryptedMasterKey: isolatedKek,
wrappingSuite
})

Expand Down

0 comments on commit 162a982

Please sign in to comment.