forked from claw/flaskpaste
add entropy enforcement for optional encryption requirement
Shannon entropy check rejects low-entropy content when MIN_ENTROPY > 0. Encrypted data ~7.5-8.0 bits/byte, plaintext ~4.0-5.0 bits/byte. Configurable via FLASKPASTE_MIN_ENTROPY environment variable.
This commit is contained in:
@@ -27,6 +27,11 @@ class Config:
|
||||
CONTENT_DEDUP_WINDOW = int(os.environ.get("FLASKPASTE_DEDUP_WINDOW", 3600)) # 1 hour
|
||||
CONTENT_DEDUP_MAX = int(os.environ.get("FLASKPASTE_DEDUP_MAX", 3)) # max 3 per window
|
||||
|
||||
# Minimum entropy requirement (0 = disabled)
|
||||
# Encrypted data has ~7.5-8.0 bits/byte, plaintext ~4.0-5.0
|
||||
# Set to 7.0+ to effectively require encryption
|
||||
MIN_ENTROPY = float(os.environ.get("FLASKPASTE_MIN_ENTROPY", 0))
|
||||
|
||||
# Reverse proxy trust configuration
|
||||
# SECURITY: The X-SSL-Client-SHA1 header is trusted for authentication.
|
||||
# This header MUST only come from a trusted reverse proxy that validates
|
||||
|
||||
Reference in New Issue
Block a user