ЛР7: прогон в Docker, исправления по результатам, evidence и отчёт
Skeleton contracts / contracts (pull_request) Blocked by required conditions

This commit is contained in:
LOSYASH
2026-12-03 16:54:53 +01:00
parent cbbe525b3e
commit 17baa0dd7e
47 changed files with 1934 additions and 65 deletions
+8 -3
View File
@@ -43,8 +43,13 @@ def run(args: list[str], *, input: str | None = None, env: dict | None = None, c
capture: bool = True, quiet: bool = False) -> subprocess.CompletedProcess:
if not quiet:
print(" $", " ".join(a if len(a) < 120 else a[:117] + "..." for a in args))
p = subprocess.run(args, cwd=ROOT, input=input, text=True, encoding="utf-8", errors="replace",
# stdin передаём байтами: в текстовом режиме Windows превращает \n в \r\n, и sh в контейнере
# получает «set -eu\r» (invalid option). Вывод декодируем сами.
p = subprocess.run(args, cwd=ROOT, input=input.encode("utf-8") if input is not None else None,
capture_output=capture, env={**os.environ, **(env or {})})
if capture:
p.stdout = (p.stdout or b"").decode("utf-8", "replace")
p.stderr = (p.stderr or b"").decode("utf-8", "replace")
if check and p.returncode != 0:
# stderr команд не содержит секретов (секреты идут только через stdin/env)
sys.exit(f"command failed ({p.returncode}): {' '.join(args[:6])}\n{(p.stderr or '')[-800:]}")
@@ -174,8 +179,8 @@ def configure_openbao(token: str) -> dict:
if "cert/" not in auths:
bao(["auth", "enable", "cert"], token=token)
audits = json.loads(bao(["audit", "list", "-format=json"], token=token, check=False, quiet=True).stdout or "{}")
if "file/" not in audits:
bao(["audit", "enable", "file", "file_path=/openbao/logs/audit.log"], token=token)
# аудит объявлен в infra/openbao/openbao.hcl (API-включение в 2.6 запрещено) — только проверяем
print(" audit devices:", ", ".join(sorted(audits)) or "NONE (check openbao.hcl)")
for name in ("messenger-api", "messenger-worker", "messenger-migrate", "operator"):
bao(["policy", "write", name, f"/openbao/policies/{name}.hcl"], token=token)
for r in ROLES: