Require a WP-0025 broker receipt at admit-plane
Platform reproduced a recanonicalized projection receipt with a substituted all-zero broker digest on the operational path. WP-0025 admission now requires --broker-receipt, threads it through broker_from_receipt, and refuses unless the digest matches exactly. Assistant: grok Assistant-Session: 01a02670-3345-76f2-a014-70fde8e2a2bb
This commit is contained in:
parent
cb6620f33b
commit
0db73f0605
5 changed files with 140 additions and 17 deletions
|
|
@ -164,6 +164,58 @@ def test_admit_plane_wp0025_receipt_requires_contract(tmp_path, capsys):
|
|||
assert "requires a bound contract" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_admit_plane_wp0025_receipt_requires_broker_receipt(tmp_path, capsys):
|
||||
engagement = tmp_path / "engagement.json"
|
||||
receipt = tmp_path / "receipt.json"
|
||||
contract = tmp_path / "contract.json"
|
||||
engagement.write_text(json.dumps(_live_e2_record()), encoding="utf-8")
|
||||
receipt.write_text(json.dumps({
|
||||
"interface": "railiance.custody-projection-receipt",
|
||||
"version": 1,
|
||||
"engagement_id": "WH-ENG-CLI-RECEIPT",
|
||||
"secret_values_observed": False,
|
||||
}), encoding="utf-8")
|
||||
contract.write_text(json.dumps({
|
||||
"interface": "railiance.custody-projection-contract",
|
||||
"version": 1,
|
||||
}), encoding="utf-8")
|
||||
with pytest.raises(SystemExit) as stopped:
|
||||
main(["admit-plane", str(engagement), "targets/audit-core-e2.json",
|
||||
"--receipt", str(receipt), "--contract", str(contract)])
|
||||
assert stopped.value.code == 2
|
||||
assert "requires a bound broker receipt" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_admit_plane_wp0025_mismatched_broker_receipt(tmp_path, capsys):
|
||||
from test_platform_custody_adapter import (
|
||||
broker_readiness, contract, digest, projection_receipt,
|
||||
)
|
||||
|
||||
bound = contract()
|
||||
receipt_doc = projection_receipt(bound)
|
||||
receipt_doc["broker_receipt_digest"] = "0" * 64
|
||||
receipt_doc["receipt_id"] = "sha256:" + digest(
|
||||
{key: value for key, value in receipt_doc.items() if key != "receipt_id"}
|
||||
)
|
||||
engagement = tmp_path / "engagement.json"
|
||||
receipt = tmp_path / "receipt.json"
|
||||
contract_path = tmp_path / "contract.json"
|
||||
broker_path = tmp_path / "broker.json"
|
||||
engagement.write_text(json.dumps(_live_e2_record()), encoding="utf-8")
|
||||
receipt.write_text(json.dumps(receipt_doc), encoding="utf-8")
|
||||
contract_path.write_text(json.dumps(bound), encoding="utf-8")
|
||||
broker_path.write_text(json.dumps(broker_readiness(bound)), encoding="utf-8")
|
||||
with pytest.raises(SystemExit) as stopped:
|
||||
main([
|
||||
"admit-plane", str(engagement), "targets/audit-core-e2.json",
|
||||
"--receipt", str(receipt),
|
||||
"--contract", str(contract_path),
|
||||
"--broker-receipt", str(broker_path),
|
||||
])
|
||||
assert stopped.value.code == 2
|
||||
assert "broker digest" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_deliver_queues_abort_without_calling_it_target_assurance(tmp_path, capsys):
|
||||
report = json.loads(
|
||||
Path("evidence/WH-ENG-20260822-AUDIT-E2-02-abort.json").read_text(encoding="utf-8")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue