Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 1.74 KB

File metadata and controls

55 lines (44 loc) · 1.74 KB

Fix Applied: Secret Key Name Consistency

Problem

The app was looking for lowercase keys ('signing_secret') but the encryption script was now saving uppercase keys ('SIGNING_SECRET'), causing a mismatch.

Solution

Updated all references in app.py to use uppercase key names consistently:

Changed Keys:

  • 'signing_secret''SIGNING_SECRET'
  • 'mongo_uri''MONGO_URI'
  • 'gemini_api_key''GEMINI_API_KEY'

Files Modified:

  1. encrypt_secrets.py - Now saves all keys in uppercase
  2. app.py - All key lookups now use uppercase

What to Do Now

1. Reload Secrets in App

Since you already ran encrypt_secrets.py with the updated code:

  • Go to 🔐 Security tab
  • Click 🔄 Reload Secrets
  • Or restart the app and load secrets again
  • Enter your passphrase
  • Click 🔓 Load Secrets

2. Verify It's Working

After reloading secrets, you should see:

  • Secrets Loaded
  • In "Loaded Secrets" expander:
    • GEMINI_API_KEY
    • MONGO_URI
    • 🔑 SIGNING_SECRET (auto-generated, 256-bit)
  • Signing secret available (in Signature Verification section)

3. Test MongoDB History

  • Go to 📧 Email Analysis tab
  • Scan some emails
  • Go to 📚 History tab
  • You should now see the stored emails with:
    • Risk scores and labels
    • ✅ Verified signatures
    • Full analysis details

Technical Details

The signing secret is now stored as a hex string (e.g., "abc123def456...") and converted to bytes when needed:

signing_secret = st.session_state.secrets['SIGNING_SECRET']
if isinstance(signing_secret, str):
    signing_secret = signing_secret.encode('utf-8')

This is simpler than the previous hex conversion approach and works consistently across all modules.