common: avoid shell in sudo_read (#38022)

This commit is contained in:
Andi Radulescu
2026-05-14 05:36:47 +03:00
committed by GitHub
parent f24ad7e27a
commit ef94b134c3

View File

@@ -48,7 +48,7 @@ def sudo_write(val: str, path: str) -> None:
def sudo_read(path: str) -> str:
try:
return subprocess.check_output(f"sudo cat {path}", shell=True, encoding='utf8').strip()
return subprocess.check_output(["sudo", "cat", "--", path], encoding='utf8').strip()
except Exception:
return ""