feat(vaults): report bad keys to the vault that served them

This commit is contained in:
imSp4rky
2026-09-13 20:46:38 -06:00
parent a0515f8d57
commit aa36d4c225
9 changed files with 139 additions and 18 deletions
+11 -3
View File
@@ -4369,9 +4369,17 @@ async def session_bad_key_handler(
raise APIError(APIErrorCode.INVALID_INPUT, "This session was not served that KID:KEY pair")
vaults = load_server_vaults(session.service_instance.__class__.__name__)
for vault in vaults.vaults:
if vault.local:
vault.flag_bad_key(vaults.service, UUID(hex=kid), served_key, source)
def flag() -> None:
for vault in vaults.vaults:
if not vault.local and vault.name != source:
continue
try:
vault.flag_bad_key(vaults.service, UUID(hex=kid), served_key, source)
except Exception as e:
log.debug(f"Could not flag {kid} as bad in vault {sanitize_log(vault.name)}: {e!r}")
await asyncio.to_thread(flag)
session.served_keys.pop(kid, None)
log.warning(
f"Client proved {kid}:{served_key} from vault {sanitize_log(source)} wrong, flagged in the server vaults"