fix(cronjob): require explicit truthy session env values

This commit is contained in:
aydnOktay 2026-03-24 13:50:11 +03:00 committed by Teknium
parent 4ad5fa702f
commit 734aa0f367
2 changed files with 18 additions and 3 deletions

View file

@ -662,6 +662,14 @@ Important safety rule: cron-run sessions should not recursively schedule more cr
}
def _is_truthy_env(var_name: str) -> bool:
"""Return True only for explicit truthy env values."""
value = os.getenv(var_name)
if value is None:
return False
return value.strip().lower() in {"1", "true", "yes", "on"}
def check_cronjob_requirements() -> bool:
"""
Check if cronjob tools can be used.
@ -671,9 +679,9 @@ def check_cronjob_requirements() -> bool:
so no external crontab executable is required.
"""
return bool(
os.getenv("HERMES_INTERACTIVE")
or os.getenv("HERMES_GATEWAY_SESSION")
or os.getenv("HERMES_EXEC_ASK")
_is_truthy_env("HERMES_INTERACTIVE")
or _is_truthy_env("HERMES_GATEWAY_SESSION")
or _is_truthy_env("HERMES_EXEC_ASK")
)