fix(pki-test): recognize explicit cert-auth chain rejection without accepting unrelated errors

This commit is contained in:
2026-11-20 21:33:47 +03:00
parent 67224e1512
commit d97403b03a
2 changed files with 49 additions and 1 deletions
+15 -1
View File
@@ -145,6 +145,18 @@ def preserve_lb():
}
def cert_auth_denied(response):
body = response.json()
if body.get("auth"):
return False
if response.status_code in {401, 403}:
return bool(body.get("errors"))
return response.status_code == 400 and any(
"no chain matching all constraints could be found" in error
for error in body.get("errors", [])
)
def revoke(operator, leaf):
assert leaf["expires_at"] > time.time() + 5, (
"Revocation must be tested before natural expiry"
@@ -213,7 +225,7 @@ def revoke(operator, leaf):
"ttl": "120s",
},
)
assert auth.status_code in {401, 403}, (
assert cert_auth_denied(auth), (
"Revoked certificate could authenticate again"
)
assert issue.status_code in {401, 403}, (
@@ -227,6 +239,8 @@ def revoke(operator, leaf):
"still_unexpired_at_check": leaf["expires_at"] > time.time(),
"new_tls_connection_denied": True,
"bao_crl_updated": True,
"bao_old_certificate_login_status": auth.status_code,
"bao_old_token_issue_status": issue.status_code,
"revoked_lb_service_tokens": revoked_tokens,
"old_certificate_new_auth_denied": True,
"old_token_pki_issue_denied": True,