MAS-WP-0011 finished: peer authentication in mode contract v0.1
CONTRACT.md section 7 (founder-reviewed): pairwise HMAC-SHA256 over TIMESTAMP.BODY in MAS-Modes-* headers, 300 s window; master commands only from the configured master; statuses only at the handoff's tokenized URL from its peer; primed webhooks must name a known peer. mas_modes.signing, signed contract.post, authenticating json_server, EmailMode/stubs/gateway signing. conformance/auth.json vectors + 7 authorization flows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 5787@bnt-lap001 Assistant-Session: 5db26b82-138b-40cc-9856-4d5eb0f752fd
This commit is contained in:
parent
2bc41a3318
commit
bdf200a600
25 changed files with 1603 additions and 151 deletions
|
|
@ -5,10 +5,11 @@ from mas_modes.harness import Harness, ROOT
|
|||
|
||||
STATUTE = ROOT / "mas-modes-v0.1-spec/conformance/statute.json"
|
||||
D = "modes.example"
|
||||
WEBHOOK = {"webhook": "{callback}", "peer": "callback-1"}
|
||||
|
||||
|
||||
def harness(**cfg):
|
||||
return Harness(STATUTE, {"case": {"role": "slave", "master_url": "{master}", **cfg}})
|
||||
return Harness(STATUTE, {"case": {"role": "slave", **cfg}})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -80,7 +81,7 @@ def test_principle_10_refuses_master_sends(h, kw, reason):
|
|||
|
||||
|
||||
def test_send_cap_and_unknown_message():
|
||||
h = Harness(STATUTE, {"case": {"role": "slave", "master_url": "{master}"}}, max_sent=0)
|
||||
h = Harness(STATUTE, {"case": {"role": "slave"}}, max_sent=0)
|
||||
try:
|
||||
body = intake(h)
|
||||
assert h.master.send(body["case"], body["message_ref"], "x")[1]["reason"] == "send-cap-reached"
|
||||
|
|
@ -110,7 +111,7 @@ def test_transfer_blocked_by_default(h):
|
|||
|
||||
|
||||
def test_transfer_to_primed_webhook():
|
||||
h = harness(transfers={"webhook": "{callback}"})
|
||||
h = harness(transfers=WEBHOOK)
|
||||
try:
|
||||
body = intake(h, local="case!callback", text="Phone: 123\nTime: now")
|
||||
assert h.master.of_type("handoff.requested")[0]["forwarded"] is True
|
||||
|
|
@ -138,7 +139,7 @@ def test_policy_from_assign_and_later_update(h):
|
|||
|
||||
def test_negotiation_only_when_autonomous():
|
||||
for autonomous, mails in ((False, 0), (True, 2)): # acknowledgement + question
|
||||
h = harness(transfers={"webhook": "{callback}"}, autonomous_send=autonomous)
|
||||
h = harness(transfers=WEBHOOK, autonomous_send=autonomous)
|
||||
try:
|
||||
h.callback.default = "negotiate"
|
||||
intake(h, local="case!callback", text="call me")
|
||||
|
|
@ -150,7 +151,7 @@ def test_negotiation_only_when_autonomous():
|
|||
|
||||
|
||||
def test_master_cancels_on_its_own_timeout():
|
||||
h = harness(transfers={"webhook": "{callback}"}, fields=("phone", "time", "scenario"))
|
||||
h = harness(transfers=WEBHOOK, fields=("phone", "time", "scenario"))
|
||||
try:
|
||||
body = intake(h, local="case!callback", text="Phone: 1\nTime: 2\nScenario: silent")
|
||||
assert h.callback.run() == []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue