fix(tools): migrate email credentials to keyring, remove hardcoded password

Email tools now use credential_store (keyring) as primary source
with env/.env as fallback. Removes plaintext password from email_check.py.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MoltBot Service
2026-02-14 22:30:14 +00:00
parent 5928077646
commit 88d14da902
3 changed files with 51 additions and 15 deletions

View File

@@ -10,12 +10,20 @@ from email.header import decode_header
import json
import sys
from datetime import datetime
from pathlib import Path
# Try keyring first
sys.path.insert(0, str(Path(__file__).parent.parent))
try:
from src.credential_store import get_secret
except ImportError:
get_secret = lambda name: None
# IMAP Configuration
IMAP_SERVER = "mail.romfast.ro"
IMAP_SERVER = get_secret("email_server") or "mail.romfast.ro"
IMAP_PORT = 993
IMAP_USER = "moltbot@romfast.ro"
IMAP_PASS = "parola281234"
IMAP_USER = get_secret("email_user") or "echo@romfast.ro"
IMAP_PASS = get_secret("email_password") or ""
def decode_mime_header(header):
"""Decode MIME encoded header"""