Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

chore: audit and tighten check-env-vars hook exceptions (#2212)

LearningCircuit641332ca3ad1
diff --git a/.pre-commit-hooks/check-env-vars.py b/.pre-commit-hooks/check-env-vars.py
index b3320a4965..d0fcf3f0e1 100755
--- a/.pre-commit-hooks/check-env-vars.py
+++ b/.pre-commit-hooks/check-env-vars.py
@@ -10,29 +10,23 @@ import sys
# Files/patterns where direct os.environ access is allowed
ALLOWED_PATTERNS = {
- # Configuration and settings
+ # Settings infrastructure (reads env vars to bootstrap the system)
"settings/",
"config/",
- # Tests
+ # Tests, scripts, examples (expected to use env vars freely)
"test_",
"_test.py",
"tests/",
- # Scripts and utilities
"scripts/",
".pre-commit-hooks/",
- "utils/", # Utility modules may need env checks
- # Example and optimization scripts
"examples/",
- # Specific modules that need direct access (bootstrap/config)
- "log_utils.py", # Logging configuration
- "server_config.py", # Server configuration
- "app_factory.py", # App initialization (needs env check before imports)
- "rate_limiter.py", # Rate limiter config (decorator needs env at module load)
- # Database initialization (needs env vars before DB exists)
- "alembic/",
+ # Database migrations (run outside normal app context)
"migrations/",
- "encrypted_db.py",
- "sqlcipher_utils.py",
+ # Bootstrap modules (run before SettingsManager is initialized)
+ "log_utils.py", # Logger init before DB/SettingsManager
+ "server_config.py", # Fail-closed security validation for LDR_APP_ALLOW_REGISTRATIONS
+ "security/rate_limiter.py", # Module-level RATE_LIMIT_FAIL_CLOSED at decorator time
+ "sqlcipher_utils.py", # Encryption init needs LDR_TEST_MODE before SettingsManager
}
# System environment variables that are always allowed
@@ -44,12 +38,10 @@ SYSTEM_VARS = {
"TMPDIR",
"TEMP",
"TZ", # Standard POSIX timezone variable
- "DEBUG",
"CI",
"GITHUB_ACTIONS",
"TESTING", # External testing flag
"PYTEST_CURRENT_TEST", # Pytest test detection
- "DISABLE_SSRF_CHECK", # Security test bypass
}
diff --git a/tests/settings/env_vars/test_env_var_usage.py b/tests/settings/env_vars/test_env_var_usage.py
index 1836fa45cb..20a5a7ce9d 100755
--- a/tests/settings/env_vars/test_env_var_usage.py
+++ b/tests/settings/env_vars/test_env_var_usage.py
@@ -71,7 +71,6 @@ SYSTEM_VARS = {
"LANG",
"LC_ALL",
"TZ",
- "DEBUG",
"CI",
"GITHUB_ACTIONS",
"TESTING", # External testing flag