chore: clarify credential validation errors and constants

Agent-Logs-Url: https://github.com/Stalin-143/Keylogger/sessions/cef34b0e-605b-4ab9-8da6-2559d1dd4529

Co-authored-by: Stalin-143 <161853795+Stalin-143@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-19 04:46:25 +00:00
committed by GitHub
parent 66436ce0a5
commit 37ab7a3c67
+17 -4
View File
@@ -38,6 +38,7 @@ CONFIG = {
'api_key': None 'api_key': None
} }
MAX_LOG_PAYLOAD_BYTES = 64 * 1024 MAX_LOG_PAYLOAD_BYTES = 64 * 1024
MIN_API_KEY_UNIQUE_CHARS = 8
def check_auth(username, password): def check_auth(username, password):
@@ -127,7 +128,7 @@ def has_sufficient_key_entropy(value):
Returns: Returns:
bool: True when key has enough character variety bool: True when key has enough character variety
""" """
if len(set(value)) < 8: if len(set(value)) < MIN_API_KEY_UNIQUE_CHARS:
return False return False
if value.count(value[0]) == len(value): if value.count(value[0]) == len(value):
return False return False
@@ -368,13 +369,25 @@ def main():
print(" source config/.env") print(" source config/.env")
sys.exit(1) sys.exit(1)
if CONFIG['password'] == 'admin' or len(CONFIG['password']) < 12 or not is_strong_password(CONFIG['password']): if CONFIG['password'] == 'admin':
print("ERROR: Default password 'admin' is not allowed.")
sys.exit(1)
if len(CONFIG['password']) < 12 or not is_strong_password(CONFIG['password']):
print("ERROR: Weak password detected.") print("ERROR: Weak password detected.")
print("Please use at least 12 characters with uppercase, lowercase, number, and special character.") print("Please use at least 12 characters with uppercase, lowercase, number, and special character.")
sys.exit(1) sys.exit(1)
if not CONFIG['api_key'] or len(CONFIG['api_key']) < 24 or not has_sufficient_key_entropy(CONFIG['api_key']): if not CONFIG['api_key']:
print("ERROR: LOG_INGEST_API_KEY is required, must be at least 24 characters, and must have sufficient entropy.") print("ERROR: LOG_INGEST_API_KEY is required.")
sys.exit(1)
if len(CONFIG['api_key']) < 24:
print("ERROR: LOG_INGEST_API_KEY must be at least 24 characters.")
sys.exit(1)
if not has_sufficient_key_entropy(CONFIG['api_key']):
print(f"ERROR: LOG_INGEST_API_KEY must include at least {MIN_API_KEY_UNIQUE_CHARS} unique characters.")
sys.exit(1) sys.exit(1)
# Get server settings # Get server settings