forked from mtusi2026/mtusi2026lab7
fix: address openbao-secrets verify findings
bao_check now compares cert auth roles and policies in OpenBao with the repository and tries every foreign identity against every role and without a role name; API and migrations exit with code 2 on invalid settings; stop-at-start runs its attempts next to the stand's OpenBao again; openbao-outage checks the exit code, the record and the restart; run_docker restarts only services started before seed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -475,18 +475,34 @@ def test_entrypoint_without_secrets_files(
|
||||
]
|
||||
|
||||
|
||||
def test_entrypoint_bad_secrets_address_value(pki: Path) -> None:
|
||||
"""«Адрес только https»: `http://` — ошибка настроек с полем адреса."""
|
||||
# запись о неверных настройках точки входа (мимо structlog, без значений)
|
||||
SETTINGS_ERROR_EVENTS = {
|
||||
"api": "Invalid API settings",
|
||||
"worker": "Invalid worker settings",
|
||||
"relay": "Invalid relay settings",
|
||||
"cleaner": "Invalid cleaner settings",
|
||||
"migrations": "Invalid migration settings",
|
||||
"db_bootstrap": "Invalid database roles settings",
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", sorted(SETTINGS_ERROR_EVENTS))
|
||||
def test_entrypoint_bad_secrets_address_value(pki: Path, name: str) -> None:
|
||||
"""Спек `transport-security`, «Адрес OpenBao не https»: `http://` — код 2 и
|
||||
одна запись с полем адреса без значения у каждой точки входа (правки
|
||||
verify W2: API и миграции выходили с кодом 1 и traceback pydantic)."""
|
||||
code, records = _run_entrypoint(
|
||||
"worker",
|
||||
name,
|
||||
pki,
|
||||
CLIENT_TLS__CA_FILE=str(pki / "stand" / "ca.crt"),
|
||||
SECRETS__ADDRESS="http://openbao:8200",
|
||||
)
|
||||
assert code == 2, records
|
||||
errors = [r for r in records if r["event"] == "Invalid worker settings"]
|
||||
assert errors, records
|
||||
assert errors[0]["errors"][0]["loc"] == "secrets.address"
|
||||
errors = [r for r in records if r["event"] == SETTINGS_ERROR_EVENTS[name]]
|
||||
assert len(errors) == 1, records
|
||||
assert errors[0]["level"] == "error"
|
||||
assert [e["loc"] for e in errors[0]["errors"]] == ["secrets.address"]
|
||||
assert "http://openbao" not in json.dumps(records)
|
||||
|
||||
|
||||
def test_entrypoint_ignores_secret_from_environment(pki: Path) -> None:
|
||||
|
||||
Reference in New Issue
Block a user