acs.client and the example Guardian: harden the on_wire copy, the Windows key document and signed error text

Open
#631 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, typescript
Domain
backend, security

Research direction

Start with the named locations in _exchange.py, _handshake.py, and _secrets.py, then read signing.md and the tests for those paths. Reproduce each listed failure at commit df87ec64, including the benchmark page and acs.client.post API. Done means every listed behavior is fixed, each fix has a regression test that fails at that commit, and the benchmark records the rfc8785 version and cites #532.

Written by the indexing model from the issue text.

Description

Found while reviewing #618 at df87ec64. Each point was reproduced at that commit.

What is broken
  1. exchange() and open_session() raise when on_wire is set and the answer is deeply nested: report_on_wire deep-copies the answer outside the callback's try (_exchange.py:51, called at _exchange.py:454,477 and _handshake.py:329,343). json.loads accepts a 700-level answer, and deepcopy then raises RecursionError. An adapter settles that as adapter_exception under the posture, so under proceed an unsigned answer would let the step run. No caller passes on_wire yet; the signed gateway transcript is likely to.
  2. On Windows the key document isn't checked: not_writable_by_others skips Windows (_secrets.py:69) and the owner check needs geteuid, so an unpinned document loads with no opt-in or warning, though signing.md says an unpinned document must belong to the running user. The HMAC secret in the same position is refused without ACS_ALLOW_UNCHECKED_KEY_PERMS=1. Reproduced on macOS by forcing the Windows branch.
  3. The Guardian signs text an outsider chose: a request with no HMAC signature gets a -32600 signed with ML-DSA-65 whose message repeats a value from the request, for example "'Guardian approves transfer of 9000 to acct-1' is not a 'date-time'".
  4. Smaller:
    • acs.client.post now takes encoded bytes instead of the request dict, so an outside caller gets a TypeError.
    • The benchmark page doesn't record the rfc8785 version, which every timed call uses (#583 asks for every library version), and cites PR #564 for the hybrid's form, where #532 alone would do.
Done when
  • A deeply nested answer with on_wire set blocks the step the same way it does without on_wire.
  • On Windows, an unpinned key document needs ACS_GUARDIAN_KEY_FINGERPRINT or the ACS_ALLOW_UNCHECKED_KEY_PERMS opt-in with its warning.
  • The Guardian's error messages carry no value taken from the request.
  • post keeps its dict form, or the change is called out as breaking.
  • The benchmark records the rfc8785 version and cites #532.
  • Each fix has a test that fails at df87ec64.

Refs #576
Refs #583
Refs #618

Dominant language
TypeScript
Stars
183
Forks
56
Avg merge
3d 1h
Merged PRs (30d)
67

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenAI-Security-Project/agent-control-standard

All issues in GenAI-Security-Project/agent-control-standard

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.