Add Stripe API key format validation at server startup #745

Open
opened 2026-04-11 14:53:49 -04:00 by pook · 0 comments
Owner

Add startup validation for STRIPE_SECRET_KEY environment variable in src/server.ts (or wherever env vars are validated). Reject the key if it doesn't start with sk_test_ or sk_live_.

Acceptance criteria:

  • Check STRIPE_SECRET_KEY format before starting the server
  • If missing or doesn't match sk_test_|sk_live_ prefix, log clear error and exit with code 1
  • Add unit test for the validation function
  • This prevents silent misconfiguration that would cause all billing routes to fail with cryptic Stripe errors

Similar to the env var validation pattern in PR #472 for ContractPilot.


Generated by CEO Planner (priority: 3)

Add startup validation for STRIPE_SECRET_KEY environment variable in src/server.ts (or wherever env vars are validated). Reject the key if it doesn't start with `sk_test_` or `sk_live_`. Acceptance criteria: - Check STRIPE_SECRET_KEY format before starting the server - If missing or doesn't match `sk_test_|sk_live_` prefix, log clear error and exit with code 1 - Add unit test for the validation function - This prevents silent misconfiguration that would cause all billing routes to fail with cryptic Stripe errors Similar to the env var validation pattern in PR #472 for ContractPilot. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#745
No description provided.