forked from mtusi2026/mtusi2026lab7
fix: address rotation-revocation re-verify findings
Name only the repeat of rotate_secret while sessions of the previous PostgreSQL password may stay open, compare KV version time with the container start when the load record is gone, refuse run_docker and rolling_update next to a running rotation, defer SIGQUIT, and name the remaining windows and cases in the trust matrix and threat model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -313,6 +313,38 @@ def test_role_password_rejected(
|
||||
assert api.request("GET", "/health/ready").status_code == 200
|
||||
|
||||
|
||||
LOGIN_REFUSED = "Database refused login"
|
||||
LOGIN_ACCEPTED = "Database accepts login again"
|
||||
|
||||
|
||||
@pytest.mark.spec("data-storage", "Неготовность из-за входа роли названа")
|
||||
def test_role_password_refusal_is_named(api: Api, stand: Stand) -> None:
|
||||
# запись — одна на отказ, а не на каждую проверку: готовность спрашивают
|
||||
# и тест, и healthcheck контейнера
|
||||
def records(event: str) -> list[dict[str, Any]]:
|
||||
return [
|
||||
r for r in api_records(stand, "default") if r["event"] == event
|
||||
]
|
||||
|
||||
before = len(records(LOGIN_REFUSED)), len(records(LOGIN_ACCEPTED))
|
||||
stand("role-password", "break")
|
||||
try:
|
||||
for _ in range(10):
|
||||
assert_error(api.request("GET", "/health/ready"), 503)
|
||||
refused = records(LOGIN_REFUSED)[before[0] :]
|
||||
assert [(r["level"], r["sqlstate"]) for r in refused] == [
|
||||
("warning", "28P01"),
|
||||
]
|
||||
assert len(records(LOGIN_ACCEPTED)) == before[1]
|
||||
finally:
|
||||
stand("role-password", "restore")
|
||||
for _ in range(5):
|
||||
assert api.request("GET", "/health/ready").status_code == 200
|
||||
accepted = records(LOGIN_ACCEPTED)[before[1] :]
|
||||
assert [r["level"] for r in accepted] == ["info"]
|
||||
assert len(records(LOGIN_REFUSED)) == before[0] + 1
|
||||
|
||||
|
||||
# пачка одновременных запросов больше пула обычного API (10)
|
||||
BURST_THREADS = 48
|
||||
BURST_AFTER_BARRIER = 4
|
||||
|
||||
Reference in New Issue
Block a user