tractatus/docs/stripe-analysis/STRIPE_SECURITY_CORRECTION_2025-10-21.md
TheFlow 2298d36bed fix(submissions): restructure Economist package and fix article display
- Create Economist SubmissionTracking package correctly:
  * mainArticle = full blog post content
  * coverLetter = 216-word SIR— letter
  * Links to blog post via blogPostId
- Archive 'Letter to The Economist' from blog posts (it's the cover letter)
- Fix date display on article cards (use published_at)
- Target publication already displaying via blue badge

Database changes:
- Make blogPostId optional in SubmissionTracking model
- Economist package ID: 68fa85ae49d4900e7f2ecd83
- Le Monde package ID: 68fa2abd2e6acd5691932150

Next: Enhanced modal with tabs, validation, export

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 08:47:42 +13:00

8.3 KiB


⚠️ DEPRECATED - DO NOT USE

This document contains INCORRECT risk assessment based on misunderstanding test mode capabilities.

Correct Analysis: See STRIPE_STATUS_CLARIFICATION_2025-10-21.md

Actual Status: Test mode with test keys - LOW RISK (not moderate)

Date Deprecated: 2025-10-21

URGENT: Stripe Security Assessment Correction

Date: 2025-10-21 Priority: 🚨 HIGH Status: CORRECTION TO PREVIOUS AUDIT


Critical Discovery

Previous Assessment: "Test keys only, no real money, low risk"

ACTUAL SITUATION: Stripe dashboard shows:

  • Real transactions: NZ$4.56 incoming
  • Real bank account connected
  • Real payout schedule (delayed by Labour Day bank holiday)
  • Balance: -NZ$0.05 available
  • Business name: John Geoffrey Stroh

Risk Re-Assessment

Previous Risk Level: 🟢 Minimal

ACTUAL Risk Level: 🟡 MODERATE TO HIGH

Why the Risk is Higher:

Even though the API keys start with sk_test_ (test mode), the Stripe account appears to be:

  1. Connected to a real bank account (for payouts)
  2. Processing real transactions (NZ$4.56 is real money)
  3. Associated with real business identity (John Geoffrey Stroh)

What "Test Mode" Actually Means

Test Keys CAN Process Real Money If:

  1. Test Mode with Real Bank Account

    • Test mode keys (sk_test_*) are used
    • But connected to real bank account for payout testing
    • Small real transactions may occur during setup/testing
    • This appears to be your current situation
  2. Test Cards vs Real Payment Methods

    • Test mode typically uses fake card numbers (4242 4242 4242 4242)
    • But if real payment methods are used, real money moves
    • Balance of -NZ$0.05 suggests real transaction processing

Revised Security Implications

If These Keys Are Compromised:

Immediate Risks:

  • Attacker could create unauthorized checkout sessions
  • Attacker could view transaction history
  • Attacker could access customer payment information
  • Attacker could modify webhook endpoints
  • Attacker could potentially trigger refunds or disputes
  • ⚠️ Could affect real bank account connected to Stripe

Financial Impact:

  • Current balance: Small (NZ$4.56 incoming, -NZ$0.05 available)
  • But: Access to Stripe dashboard = access to all historical transactions
  • But: Could be used to create fraudulent charges
  • But: Real bank account is connected (payout risk)

Current Security Status (Re-Evaluated)

Good News: Keys Are Still Secure

From technical audit (still valid):

  • Keys not in git repository
  • Keys not in public directories
  • Keys not in database
  • Keys not in git history
  • .env properly excluded
  • Search doesn't expose keys

This means: Keys are currently secure, but the IMPACT if they were exposed is higher than initially stated.


Immediate Recommendations

1. Clarify Stripe Mode Status (URGENT)

Action Required: Log into Stripe Dashboard and verify:

Stripe Dashboard → Top-left toggle
- Is it showing "Test mode" or "Live mode"?
- If "Test mode": Why are there real money transactions?
- If "Live mode": Keys in .env should be sk_live_*, not sk_test_*

Possible Scenarios:

Scenario A: Test mode with real bank for payout testing

  • Keys are test keys (sk_test_*)
  • Real bank account connected to test payments
  • Small real transactions expected during setup
  • Risk: Moderate (limited scope, but real money)

Scenario B: Live mode but viewing wrong dashboard section

  • Keys in .env are test keys
  • But separate live mode is active with real transactions
  • Risk: High (need to secure live keys too)

Scenario C: Test keys accidentally processing live transactions

  • Stripe misconfiguration
  • Risk: Very High (immediate action needed)

2. Verify API Key Type (IMMEDIATE)

Check Stripe Dashboard → Developers → API Keys:

Publishable key: pk_test_* or pk_live_*?
Secret key: sk_test_* or sk_live_*?

Your .env has: sk_test_51RX67k...
Dashboard shows: Real money transactions

These should match the mode (test vs live)

3. Security Hardening (DO NOW)

Even though keys are currently secure:

  1. Rotate Test Keys

    • Stripe Dashboard → Developers → API Keys
    • Click "Roll" on secret key
    • Update .env file
    • Restart server
    • Reason: Safety margin if keys were exposed unknowingly
  2. Enable Stripe Notifications

    • Stripe Dashboard → Settings → Notifications
    • Enable: "Successful payments", "Failed payments", "Disputes"
    • Reason: Monitor for unauthorized activity
  3. Review Recent Activity

    • Stripe Dashboard → Payments
    • Check all recent transactions
    • Verify: You recognize all charges
    • Reason: Detect any unauthorized use
  4. Set Up 2FA on Stripe Account

    • Stripe Dashboard → Settings → Security
    • Enable two-factor authentication
    • Reason: Protect dashboard access

4. Restrict API Key Permissions

Stripe allows restricting what test keys can do:

  • Stripe Dashboard → Developers → API Keys → Restricted Keys
  • Create restricted key with minimal permissions:
    • Read-only access
    • Create checkout sessions only
    • No refunds
    • No customer data modifications
    • No webhook endpoint changes

Use restricted key in .env for development


Updated Risk Matrix

Scenario Current Risk If Keys Leaked
Test keys + Real bank 🟡 Moderate 🟡 Moderate
Live keys 🔴 High 🔴 Very High
Misconfigured 🔴 High 🔴 Critical

What This Means for Your Security

Keys ARE Secure (Technical Audit Valid)

The original audit findings remain true:

  • No keys in git
  • No keys in public files
  • Proper .env exclusion
  • No database exposure

But Impact of Breach is Higher

Original statement: "Low risk if exposed (test environment only, no real money)"

CORRECTED statement: "Moderate to high risk if exposed (connected to real bank account, processing real transactions even in test mode)"


Action Items (Prioritized)

IMMEDIATE (Next 30 Minutes)

  1. ☐ Log into Stripe Dashboard
  2. ☐ Verify test mode vs live mode status
  3. ☐ Check if real transactions are expected in test mode
  4. ☐ Review all recent transactions (last 7 days)
  5. ☐ Enable 2FA if not already enabled

SHORT-TERM (Today)

  1. ☐ Rotate test API keys as precaution
  2. ☐ Update .env with new keys
  3. ☐ Restart application server
  4. ☐ Test Koha donations still work
  5. ☐ Enable Stripe email notifications

MEDIUM-TERM (This Week)

  1. ☐ Create restricted API keys for development
  2. ☐ Document which keys are test vs live
  3. ☐ Set up monitoring for unusual Stripe activity
  4. ☐ Review Stripe account permissions
  5. ☐ Complete Stripe account setup (resolve open case)

Corrected Conclusion

Security Posture: Currently Secure

Your credentials are not exposed. The technical implementation is sound.

Risk Level: 🟡 Higher Than Initially Stated

The keys have access to:

  • Real bank account information
  • Real transaction processing (even in test mode)
  • Customer payment data
  • Business financial information

Therefore: Treat these keys with the same security as live production keys.


My Mistake

I apologize for the initial assessment that characterized test keys as "low risk, no real money." I should have:

  1. Asked about real vs test transactions
  2. Verified the account setup status
  3. Not assumed "test keys = fake money"

The technical security audit is correct (keys are secure), but the risk characterization was wrong.


Verification Questions for User

To provide accurate guidance, please confirm:

  1. Stripe Dashboard Mode: Are you in "Test mode" or "Live mode"?
  2. Transaction Source: Where did the NZ$4.56 transaction come from?
  3. Bank Account: Is a real bank account connected in test mode?
  4. Expected Behavior: Did you intentionally process a real transaction?
  5. Key Type: Do you have separate live keys (sk_live_*) in addition to test keys?

Status: Awaiting user clarification to provide final security recommendations

Next Steps:

  1. User confirms Stripe mode and transaction source
  2. I provide mode-specific security guidance
  3. User implements recommended hardening measures