Skip to content

0.1.2 KY1: the key helper, its address registry and the kit's key check (driver v1 N4) #2379

Closed

Description

@jparker2006

Parent

Ticket KY1 of spec #2378 (0.1.2), the contract-first ticket. Size: L.

What to build

The one place a host API key is ever read: a new rule in driver v1, the key helper, its registry, and the kit's check. This is a security piece, so its review is a full review.

1. The rule. In kernel/driver.v1.md, section 2 (Logins), add this rule after N3, word for word. N1 to N3 stay unchanged.

  • N4. A host that can be driven only through an API that takes the user's key is reached only through the kit's key helper, kernel/driver-kit/hostkey.py. The helper alone reads the key, from the user's system keychain or from the environment variable the user set, and sends it only over HTTPS to the address registered for that host in kernel/driver-kit/hosts.json. The driver never names, reads, receives or prints the key, and never chooses the address. OpenWiz never stores a key.

In the same section, under the login line, replace the sentence "When the host takes an API key, the README also names the environment variable the user sets for it." with: "When the host takes an API key, the README also names the environment variable the user may set for it and the keychain entry the helper reads (N4)."

2. The helper, kernel/driver-kit/hostkey.py. It uses only Python's standard library, on the kit's platforms.

  • Input: one JSON object on stdin, with exactly host, method (GET, POST or DELETE), path, and an optional body (an object).

  • Answer: one JSON object on stdout, with exactly status (the HTTP status) and body (the parsed JSON, or null). On a refusal or failure it exits 1 with driver v1's D3 error shape.

  • Key lookup:

    1. the registered environment variable, if it's set and non-empty;
    2. otherwise the keychain entry: security find-generic-password -s <entry> -w on macOS, secret-tool lookup service <entry> on Linux.

    It reads the keychain's output from a pipe, and never puts the key on a command line.

  • Never: it never prints, logs or echoes the key. The key is in no error text, no answer and no child process's arguments or environment. It never caches the key to disk. A missing key is an error naming the variable and the entry, never a value.

3. The registry, kernel/driver-kit/hosts.json. One object per host, with exactly:

  • origin (an https:// origin, no path);
  • variable (the environment variable name);
  • keychain (the entry name);
  • header (authorization-bearer).

The first entry is Devin: https://api.devin.ai, DEVIN_API_KEY, openwiz-devin. Add its schema to the kit's tests.

4. The address restriction. The helper refuses all of the following before any network call:

  • a host not in the registry;
  • a path that isn't absolute;
  • a path that contains //, .., \, @, #, a scheme, a host, a port, user info or a control character;
  • a method outside the three.

It never follows a redirect: a 3xx comes back as its status, with no request made to the new address. It verifies TLS with the system defaults.

The kit's tests may point a registered host at a loopback fake through OPENWIZ_HOSTKEY_TEST_ORIGIN. That override is honoured only for http://127.0.0.1:<port>; for any other value the helper refuses to run.

5. The kit's check, with no sixth check. When the driver's README names a registered host, the kit's token check also does the following:

  • plants a random canary key in the host's variable;
  • starts a loopback fake host, and runs start, wake and stop against it;
  • passes only when the canary reached the fake host only in the helper's Authorization header;
  • passes only when the canary never appears in the driver's output, on any process's command line, or under any variable other than the host's own;
  • passes only when no file of the driver names the host's variable or calls security or secret-tool.

Fixtures. Planted drivers under fixtures/planted/. Each must fail with its own named line:

  • reads the key itself;
  • passes the key in an argument;
  • asks the helper for an unregistered host;
  • asks for a path with a host in it.

Also a fake host that answers a redirect: the helper must not follow it.

The README of the kit says how a key host works, in two short paragraphs.

Owned paths

  • kernel/driver.v1.md (only section 2: the new N4 and the login-line sentence)
  • kernel/driver-kit/hostkey.py (new)
  • kernel/driver-kit/hosts.json (new)
  • kernel/driver-kit/test_hostkey.py (new)
  • kernel/driver-kit/kit.py
  • kernel/driver-kit/test_kit.py
  • kernel/driver-kit/README.md
  • kernel/driver-kit/fixtures/
  • kernel/driver-kit/evidence/
  • .github/workflows/ci.yml (shared: the helper's one test line)

Relies on: nothing

Links

none

Acceptance criteria

  • N4 and the login-line sentence are in kernel/driver.v1.md word for word, and N1 to N3 are unchanged
  • Every refusal in parts 2 and 4 has a test that fails first (red log in evidence/)
  • The four planted drivers and the redirect fake fail the kit with their own lines, and the template still passes 5 of 5
  • A fake key host driver that uses only the helper passes 5 of 5, with the canary reaching the fake host only in the header
  • The key never appears in any output, argument, error, log or file the helper or kit writes
  • Review: a full review, security included

Proof

P1 (helper and rule): test_hostkey.py and test_kit.py, red first in kernel/driver-kit/evidence/. A full security review.

Activity

  1. added this to the 0.1.2 milestone on Nov 22, 2026
  2. added
    ready-for-agent
    on Nov 22, 2026
  3. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    launch-fleet: start withdrawn

  4. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    launch-fleet: start checked, branch room/2379-key-helper

    Started by hand on the J87 planner's go (2026-11-22): fleet.sh claim failed only with "can't read REST issue facts for the GitHub query Nodes". That error comes from an unrelated cross-repository pull request (openwizdev/WizSkills#275) whose second page of checks is read from openwizdev/OpenWiz. Start conditions read at 19:58Z: open; labelled ready-for-agent only, not held; no blocker; no other live claim, builder, branch or pull request; plan approval 7084605332 (revision 1) current, and fleet.sh spec 2378 printed start #2379 at 19:54Z. The owned-path clash with #2075 was cleared (7084757958).

  5. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    agent: builder
    state: done
    harness: Claude Code
    model: Opus 5.5
    skills: build-ticket@0.2.1
    step: Fixed R3, R4, R5, R7, R16 and R17 and loosened the registry test at 2292b17 with CI green; waiting for the final check.
    time: 2026-11-22T23:39:23Z
    pr: #2395

  6. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    F4 supporting edit granted (planner), for #2379:

    changes/closedwiz-2379.md

    Reason: changes/2379.md already held a line moved over from ClosedWiz. As changes/README.md requires, that line moves byte for byte to its own closedwiz- file, so this ticket's changelog line can take changes/2379.md. It is a mechanical rename, with no new content.

  7. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    Builder question: one supporting-edit grant needed for #2395

    CI's owned-paths check refuses one file: changes/closedwiz-2379.md. Every other check result is normal.

    Why the file exists: changes/2379.md on main already holds a line moved from ClosedWiz #2379. It is listed in tools/release/moved.json and has no OpenWiz ticket. This ticket is a product change, so it needs its own changes/2379.md. changes/README.md ("Moved files") says that on a collision only the moved file is renamed, to changes/closedwiz-<N>.md, byte for byte. tools/release/entry.py enforces this: if changes/2379.md changes while no changes/closedwiz-2379.md exists, the release entry fails ("rename the moved line changes/closedwiz-2379.md, or record its new bytes in the moved-number map").

    Options:

    1. Grant an F4 supporting edit for exactly changes/closedwiz-2379.md: the moved line, unchanged, at its renamed path. Kind: changelog, supporting changes/2379.md (standing rule 2) for the product change in kernel/driver-kit/hostkey.py and kernel/driver.v1.md.
    2. Ship without a changelog line and add the no-changelog label. This is wrong: the change is a product change, which changes/README.md says can't use the label.
    3. Record the new bytes in tools/release/moved.json instead. This is worse: it overwrites a moved record, and that file isn't owned here either.

    My pick: 1. I've changed nothing else, and I won't push until a grant or another answer comes.

  8. added
    needs-info
    on Nov 22, 2026
  9. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    launch-fleet: granted supporting-edit: changes/closedwiz-2379.md, the byte-for-byte move changes/README.md requires (grant 7085386842). That answers the builder's question 7085396120.

  10. removed
    needs-info
    on Nov 22, 2026
  11. jparker2006 commented on Nov 22, 2026

    @jparker2006
    MemberAuthor

    agent: reviewer
    state: done
    harness: Codex
    model: Sol 6.2 Medium
    skills: review-ticket@0.4.0
    step: Posted CHANGES after the re-check of the pinned head
    time: 2026-11-22T22:30:05Z
    pr: #2395

  12. 16 remaining items

  13. added 9 commits that reference this issue on Nov 23, 2026
  14. jparker2006 commented on Nov 23, 2026

    @jparker2006
    MemberAuthor

    launch-fleet: archived

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions