fix: repair dev modules and scoped release git trust
Some checks failed
Dependency Audit / dependency-audit (push) Has been cancelled
Security Audit / security-audit (push) Has been cancelled

This commit is contained in:
2026-07-29 20:54:58 +02:00
parent 3f9567af18
commit 1aea3e7c4f
11 changed files with 356 additions and 30 deletions

View File

@@ -164,9 +164,10 @@ def git_success(path: Path, *args: str, timeout: int = 10) -> bool:
def git(path: Path, *args: str, timeout: int = 10) -> subprocess.CompletedProcess[str]:
command = scoped_git_command(path, *args)
try:
return subprocess.run(
["/usr/bin/git", "-c", "core.hooksPath=/dev/null", *args],
command,
cwd=path,
check=False,
text=True,
@@ -176,7 +177,20 @@ def git(path: Path, *args: str, timeout: int = 10) -> subprocess.CompletedProces
env=sanitized_git_environment(),
)
except subprocess.TimeoutExpired as exc:
return subprocess.CompletedProcess(["/usr/bin/git", *args], 124, exc.stdout or "", exc.stderr or "git command timed out")
return subprocess.CompletedProcess(command, 124, exc.stdout or "", exc.stderr or "git command timed out")
def scoped_git_command(path: Path, *args: str) -> tuple[str, ...]:
"""Trust exactly one resolved catalog checkout for one Git invocation."""
return (
"/usr/bin/git",
"-c",
"core.hooksPath=/dev/null",
"-c",
f"safe.directory={path.resolve()}",
*args,
)
def sanitized_git_environment(