mirror of
https://github.com/0x5t4l1n/Keylogger.git
synced 2026-05-26 11:35:50 +00:00
fix: resolve final codeql alert and improve policy messaging
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:
committed by
GitHub
parent
1f99612918
commit
e938f21e92
+2
-4
@@ -230,12 +230,10 @@ def main():
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not api_key:
|
if not api_key:
|
||||||
print("ERROR: LOG_INGEST_API_KEY environment variable is required.")
|
sys.exit("ERROR: Ingestion API secret is required.")
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if len(api_key) < MIN_API_KEY_LENGTH:
|
if len(api_key) < MIN_API_KEY_LENGTH:
|
||||||
print(f"ERROR: LOG_INGEST_API_KEY must be at least {MIN_API_KEY_LENGTH} characters.")
|
sys.exit(f"ERROR: Ingestion API secret must be at least {MIN_API_KEY_LENGTH} characters.")
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if args.no_verify_ssl:
|
if args.no_verify_ssl:
|
||||||
print("⚠️ WARNING: SSL certificate verification is DISABLED!")
|
print("⚠️ WARNING: SSL certificate verification is DISABLED!")
|
||||||
|
|||||||
+11
-5
@@ -117,7 +117,8 @@ def is_strong_password(password):
|
|||||||
has_lower = any(char.islower() for char in password)
|
has_lower = any(char.islower() for char in password)
|
||||||
has_digit = any(char.isdigit() for char in password)
|
has_digit = any(char.isdigit() for char in password)
|
||||||
has_special = any(char in string.punctuation for char in password)
|
has_special = any(char in string.punctuation for char in password)
|
||||||
return has_upper and has_lower and has_digit and has_special
|
has_min_length = len(password) >= MIN_PASSWORD_LENGTH
|
||||||
|
return has_min_length and has_upper and has_lower and has_digit and has_special
|
||||||
|
|
||||||
|
|
||||||
def has_sufficient_key_entropy(value):
|
def has_sufficient_key_entropy(value):
|
||||||
@@ -374,17 +375,22 @@ def main():
|
|||||||
if CONFIG['password'] == 'admin':
|
if CONFIG['password'] == 'admin':
|
||||||
sys.exit("ERROR: Authentication secret uses a disallowed default value.")
|
sys.exit("ERROR: Authentication secret uses a disallowed default value.")
|
||||||
|
|
||||||
if len(CONFIG['password']) < MIN_PASSWORD_LENGTH or not is_strong_password(CONFIG['password']):
|
if not is_strong_password(CONFIG['password']):
|
||||||
sys.exit("ERROR: Authentication secret does not meet complexity policy.")
|
sys.exit(
|
||||||
|
"ERROR: Authentication secret must be at least 12 characters and include uppercase, "
|
||||||
|
"lowercase, number, and special character."
|
||||||
|
)
|
||||||
|
|
||||||
if not CONFIG['api_key']:
|
if not CONFIG['api_key']:
|
||||||
sys.exit("ERROR: Ingestion API secret is required.")
|
sys.exit("ERROR: Ingestion API secret is required.")
|
||||||
|
|
||||||
if len(CONFIG['api_key']) < MIN_API_KEY_LENGTH:
|
if len(CONFIG['api_key']) < MIN_API_KEY_LENGTH:
|
||||||
sys.exit("ERROR: Ingestion API secret does not meet length policy.")
|
sys.exit(f"ERROR: Ingestion API secret must be at least {MIN_API_KEY_LENGTH} characters.")
|
||||||
|
|
||||||
if not has_sufficient_key_entropy(CONFIG['api_key']):
|
if not has_sufficient_key_entropy(CONFIG['api_key']):
|
||||||
sys.exit("ERROR: Ingestion API secret does not meet entropy policy.")
|
sys.exit(
|
||||||
|
f"ERROR: Ingestion API secret must contain at least {MIN_API_KEY_UNIQUE_CHARS} unique characters."
|
||||||
|
)
|
||||||
|
|
||||||
# Get server settings
|
# Get server settings
|
||||||
host = args.host or server_config.get('host', '0.0.0.0')
|
host = args.host or server_config.get('host', '0.0.0.0')
|
||||||
|
|||||||
Reference in New Issue
Block a user