fix: resolve security concerns in AIS proxy, GDELT parsing, and env key validation

Former-commit-id: fad9572959
This commit is contained in:
anoracleofra-code
2026-03-09 05:53:15 -06:00
parent 30595843a0
commit 923c80368d
3 changed files with 22 additions and 3 deletions
+9
View File
@@ -157,6 +157,15 @@ def get_api_keys():
def update_api_key(env_key: str, new_value: str) -> bool:
"""Update a single key in the .env file and in the current process env."""
valid_keys = {api["env_key"] for api in API_REGISTRY if api.get("env_key")}
if env_key not in valid_keys:
return False
if not isinstance(new_value, str):
return False
if "\n" in new_value or "\r" in new_value:
return False
if not ENV_PATH.exists():
return False