Reject advisory policy envelopes before lifecycle effects

Assistant: codex
Assistant-Model: gpt-6.1-sol
Assistant-Session: 01a126e1-76f8-7643-8cf3-e93336539ade
This commit is contained in:
tegwick 2026-10-11 02:22:07 +02:00
parent caab9a90ec
commit 1e0df2f4a3
13 changed files with 2854 additions and 0 deletions

View file

@ -149,6 +149,12 @@ class PolicyClient:
if not isinstance(data.get("id"), str) or not data["id"] or len(data["id"]) > 256:
raise ValueError()
binding, provenance = data["binding"], data["provenance"]
# FLEX-DEC-2026-019: advisory readback decisions are never act
# authorization. Canonical enforcement purpose is absent (Go
# omitempty) or the exact empty string; malformed values fail closed.
purpose = binding.get("purpose", "")
if type(purpose) is not str or purpose != "":
raise ValueError()
if (binding["submitted_request_digest"] != submitted
or not DIGEST.fullmatch(binding["request_digest"])
or binding["tenant"] != request["tenant"] or binding["action"] != request["action"]