no-mistakes(review): Guard infisical-token fallback read against OSError crashes

This commit is contained in:
root
2026-08-01 13:27:41 +00:00
parent 1921937bee
commit b56501a1cf
+5 -2
View File
@@ -61,8 +61,11 @@ INFISICAL_API_URL = os.environ.get("INFISICAL_API_URL", "https://vault.sysloggh.
if not INFISICAL_TOKEN:
_token_path = os.path.expanduser("~/.infisical-token")
if os.path.isfile(_token_path):
with open(_token_path) as _f:
INFISICAL_TOKEN = _f.read().strip()
try:
with open(_token_path) as _f:
INFISICAL_TOKEN = _f.read().strip()
except (OSError, UnicodeDecodeError):
pass
# ── Helpers ──────────────────────────────────────────────────────────