Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private Key is stored unencrypted in DynamoDB #146

Open
sam-goodwin opened this issue Jan 10, 2025 · 0 comments
Open

Private Key is stored unencrypted in DynamoDB #146

sam-goodwin opened this issue Jan 10, 2025 · 0 comments

Comments

@sam-goodwin
Copy link

sam-goodwin commented Jan 10, 2025

DynamoStorage stores the Private Key unencrypted in DynamoDB.

export const app = issuer({
  // ..
  storage: DynamoStorage({
    table: Resource.AuthStorage.name,
  }),
});

Stored in DynamoDB:

{
  "pk": "encryption:key",
  "sh": "1eda513a-beb6-49b2-a03a-a6b108e597cd",
  "value": "{\"id\":\"1eda513a-beb6-49b2-a03a-a6b108e597cd\",\"publicKey\":\"-----BEGIN PUBLIC KEY-----\\n{REDACTED}\n-----END PUBLIC KEY-----\\n\",\"privateKey\":\"-----BEGIN PRIVATE KEY-----\\n{REDACTED}==\\n-----END PRIVATE KEY-----\\n\",\"created\":1736050896409,\"alg\":\"RSA-OAEP-512\"}"
}

This doesn't seem like good practice, even with Managed Dynamo encryption.

Have you considered the following options:

  1. Encrypt with KMS prior to storing in DynamoB
  2. Store in Secrets Manager or Secure String Parameter (SSM)
  3. KMS-managed Asymmetric Key pairs https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant