mirror of
https://github.com/storytold/artcraft-services.git
synced 2026-11-19 08:53:03 +01:00
fix: remove SMTP and Stripe secrets from tracked dev config (#236)
## What was wrong - `email-sender-job.development.env` committed a plaintext SMTP password for the Gmail sending account used by the email worker. - `storyteller-web.development.env` committed the Stripe test-mode secret key (`sk_test_...`) and webhook signing secret (`whsec_...`). Anyone with read access to the repository (or to a Docker build context or image built from it) gets these credentials. ## What changed - Removed `SMTP_PASSWORD`, `STRIPE_SECRET_KEY` and `STRIPE_SECRET_WEBHOOK_SIGNING_KEY` from the tracked development configs, with a comment pointing to the gitignored `<app>.development-secrets.env` file. `bootstrap` already loads that file after `<app>.development.env` (and dotenv keeps earlier values, so the lines had to be removed rather than replaced with placeholders). - Added `*-secrets.env` and `secrets/` to `.dockerignore` so local secret files never enter a build context. ## Required follow-up (cannot be done in code) - **Rotate the SMTP password** for the sending account and the **Stripe test secret key + webhook signing secret**. They remain in git history; removing them from `main` does not revoke them. - Developers running storyteller-web or email-sender-job locally must now put those three values in their `*.development-secrets.env` (or environment); startup fails with a missing-variable error otherwise, since both are read with `get_env_string_required`. ## Blast radius Development configuration only. Production config files are unchanged; production already supplies these from secrets. ## Checks - Run: reviewed bootstrap env-file load order (`crates/lib/bootstrap/src/bootstrap.rs`) to confirm the secrets file is still read in development. - Not run: no build needed (config-only change); no local startup test (needs the real secrets). Addresses CodeRabbit security findings (CWE-798). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Configuration** * Development settings no longer include hard-coded SMTP passwords or Stripe secret keys. These values can be provided through environment variables or local secrets files. * Files matching `*-secrets.env` and the `secrets/` directory are excluded from Docker build contexts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
f8e0a28cb5
commit
c054e6371f
3 files changed
+7
-5
No files matched your search
@@ -3,6 +3,8 @@
|
||||
.dockerignore
|
||||
.env
|
||||
.env-secrets
|
||||
*-secrets.env
|
||||
secrets/
|
||||
.git
|
||||
.idea/
|
||||
Dockerfile
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
# inference-job default .env configurations (these can be overridden with k8s)
|
||||
|
||||
# TODO(bt,2023-11-11): Password and account details should be a secret, but gotta go fast.
|
||||
SMTP_RELAY="smtp.gmail.com"
|
||||
# SMTP_USERNAME="noreply@storyteller.ai"
|
||||
SMTP_USERNAME="accounts@storyteller.ai"
|
||||
SMTP_PASSWORD="FakeYouHanashi1"
|
||||
# SMTP_PASSWORD is a secret. Set it in the untracked (gitignored)
|
||||
# `email-sender-job.development-secrets.env` next to this file, or in the environment.
|
||||
|
||||
# NB: To not step on storyteller-web (the main API gateway)
|
||||
HTTP_BIND_ADDRESS=0.0.0.0:11223
|
||||
@@ -16,14 +16,14 @@ ENABLE_PAGING_FOR_500S=false
|
||||
AI_STREAMER_USERNAMES="PewDiePie,xQc"
|
||||
|
||||
# Stripe configs
|
||||
# All secrets are development and okay to check in
|
||||
# STRIPE_SECRET_KEY and STRIPE_SECRET_WEBHOOK_SIGNING_KEY are secrets. Set them in the
|
||||
# untracked (gitignored) `storyteller-web.development-secrets.env` next to this file,
|
||||
# or in the environment. They must not be committed here.
|
||||
STRIPE_CHECKOUT_SUCCESS_URL_PATH=/checkout_success
|
||||
STRIPE_CHECKOUT_CANCEL_URL_PATH=/checkout_cancel
|
||||
STRIPE_PORTAL_RETURN_URL_PATH=/portal_success
|
||||
STRIPE_PORTAL_DEFAULT_CONFIG_ID=bpc_1LyPPREU5se17MekYiViZF12
|
||||
STRIPE_PUBLISHABLE_KEY=pk_test_51KZvWXEU5se17Mekx6e0gw32ovDF78k2eeaGctLIs8oQVxN6DerEp1BDqh6gLMYKli4VsTZoVGHoxq5RmwKMlxtP00r59UEEad
|
||||
STRIPE_SECRET_KEY=sk_test_51KZvWXEU5se17Mek11ZdnWr4frnyw7tWOPuvl3pRzL290zvkT6KqcbGUl3fcvc3hA8oH6lWXz2kGWXXUlNcCuDxB003uVT9JX0
|
||||
STRIPE_SECRET_WEBHOOK_SIGNING_KEY=whsec_40b60bd75768052532b63dbeefa7a1b163e182c3e657fb27fa906ef49a2cd59f
|
||||
|
||||
# Development container
|
||||
NUM_WORKERS=16
|
||||
|
||||
Reference in new issue
Block a user