[REFACTOR] Consolidate duplicate retry decorator logic into generic _retry_operation#325
Conversation
PR #311 Review: Security & Authentication ImprovementsSummaryThis PR introduces payment security features and authentication guards, but is incorrectly labeled as a refactor. It contains significant behavioral changes and new features that require careful consideration before merging. Classification: ❌ NOT A REFACTORExpected (Refactor): Code reorganization without behavior changes Critical Issues1. Breaking Change: Authentication Middleware Logic (🔴 HIGH SEVERITY)File: # BEFORE
if auth_enabled and app_settings.auth.enabled:
# AFTER
if auth_enabled or app_settings.auth.enabled:Impact:
Recommendation:
2. Hardcoded Security Secret (🔴 HIGH SEVERITY)File: payment_security_secret: str = "bindu-default-payment-key-please-override-in-production"Security Issues:
Recommendation: # Better approach
payment_security_secret: str | None = None
# In PaymentSecurity.__init__
if not secret_key:
if os.getenv("BINDU_ENV") == "production":
raise ValueError("PAYMENT_SECURITY_SECRET must be set in production")
logger.critical("Using insecure default payment key - DO NOT USE IN PRODUCTION")3. Unrelated File Included (
|
Fixes #283
What changed
_retry_operationfunctionretry_storage_operationcorrectly useswait_exponential; others usewait_random_exponentialTests
ruff check bindu/utils/retry.py— no errors