siv-org / siv

Secure Internet Voting protocol
https://siv.org
Other
13 stars 9 forks source link

Move Sensitive Environment Variables to a Secret Management Service #194

Open cjackett opened 3 months ago

cjackett commented 3 months ago

Issue Description

The current implementation in the pages/api/_services.ts file relies heavily on environment variables to manage sensitive credentials such as API keys, JWT secrets, and database connection strings. Storing sensitive information in environment variables poses several security risks, including potential exposure through logs, stack traces, or misconfigured environments. These credentials can be accidentally exposed during debugging or logging, and environment variables do not offer fine-grained access control, leading to possible unauthorized access. Additionally, secrets stored in environment variables are challenging to rotate, which increases the risk if they are compromised.

Sensitive environment variables currently in use include:

These credentials are important for the security and functionality of the application and should be managed securely rather than stored in plaintext within environment variables, particularly in production environments.

Mitigation

  1. Move Sensitive Environment Variables to a Secret Management Service:

    • Use a secure, dedicated secret management service such as:
      • AWS Secrets Manager
      • Google Cloud Secret Manager
      • HashiCorp Vault
    • These services offer enhanced security through encryption, access control, and automated secret rotation.
  2. Update pages/api/_services.ts to Fetch Secrets Securely:

    • Refactor the code to fetch secrets directly from the secret management service rather than relying on environment variables.
  3. Local Development:

    • For local development, set up an equivalent secret storage system to replicate production. Securely store sensitive variables and ensure they are not committed to version control, maintaining consistency and security across environments.
arianabuilds commented 3 months ago

Entry Summary for HACK SIV @ DEF CON 2024

Thanks again for participating! This submission earned $0.00 from SIV and $$52.14 from the Public Vote, for a total of $52.14.

Here's what we noted in our evaluation:

What's interesting about this submission

What takes away from it

Issue to track getting paid: https://github.com/siv-org/hack.siv.org/issues/10