Skip to content

S15-06 - The Binding Commands

Purpose: How wb cred sets, lists and removes the binding secrets in the secret store through the wb-credset helper, while wb itself holds no store access.

Requirements: SEC12-least-privilegeSEC12-least-privilege: Least privilege on the hostNo root or administrator rights at run time and no extra host user accounts., SEC04-no-guest-secretsSEC04-no-guest-secrets: No secrets in the guestThis includes the model credential.

Tests: C05-credentials-and-storeC05-credentials-and-store: Credentials and the Secret StoreThe test cases for the secret store and its callers, the signing setup that gives development builds their Keychain groups, and the credential checks wb-proxyd makes on guest requests and server responses.

wb-credset is the helper that wb cred set, wb cred rm and wb cred list run as the user.

It does one operation and exits:

  • write reads the value from its standard input;
  • delete removes the item;
  • list prints the names of the binding/ items, never a value.

It takes exactly two arguments, the operation and the binding name. Its environment has only the variable names on a fixed list compiled into it, which wb also uses when it starts it. The list is empty. Before any store call, it refuses each of these with the rule credset-refused:

The operations are write, delete and list. The second argument of list is -. A refusal names a bad argument by its length, and never prints it.

A write reads at most 16 KiB from its standard input. It refuses an empty value and a longer one with credset-refused, before any store call. It zeroes its buffer when the call returns.

A failed store call is refused with the store’s rule (S15-02-secret-storeS15-02-secret-store: The Secret StoreWhere credentials are held: the secret store, its backends, and the guarantees a backend must give., “Failed store calls”). For a locked store that refusal comes at once, without a wait for the unlock. wb tells the user to unlock the Mac’s own screen and run the command again, since a remote or SSH session doesn’t unlock the Keychain. A delete of a binding that isn’t in the store succeeds, and its decision has the rule store-item-not-found.

It logs one decision line, a JSON line on its standard error with the message wb-credset decision. The line holds the decision, the rule, the operation, the binding name and the store’s status, never the value. It exits 0 after the operation, and 1 after a refusal. wb reads the outcome from that line, and prints the rule and its fix.

wb cred runs wb-credset by its path in the bundle wb runs from, never from PATH. It checks the binding name first, and exits 2 on a bad one before set reads anything. It refuses with cred-no-bundle when its bundle’s build version isn’t its own, as wb setup does (S17-02-setupS17-02-setup: InstallHow wb setup installs Wraith Box from its bundle without administrator rights, and how wb setup --remove takes it out., “The bundle check”), and when the helper’s path goes through a link.

set sets its core file limit to 0, then reads the value from a prompt that doesn’t show it. It refuses a prompt line of 1000 bytes or more, which the terminal may have cut, and names a pipe instead. When standard input isn’t a terminal, it reads standard input to its end, and removes one trailing newline, so echo token | wb cred set github stores token. It refuses an empty value, or one over 16 KiB, before wb-credset starts. It zeroes its buffer once the write to wb-credset ends.

list prints the names on standard output, and the signing team on standard error (S15-02-secret-storeS15-02-secret-store: The Secret StoreWhere credentials are held: the secret store, its backends, and the guarantees a backend must give., “Backend guarantees”). rm of a binding that isn’t in the store succeeds, and says so on standard error only. Output from wb-credset longer than wb keeps fails the run with cred-helper-failed, and prints no names. A refusal ends with wraith box: <message> (<rule>) after the fix, and exits 255 (S05-02-exit-status-and-signalsS05-02-exit-status-and-signals: Exit Status and SignalsWhat wb claude exits with, and what it does with each signal.). The rule is wb-credset’s, or the store’s, as it came.

wb cred doesn’t write an audit record yet. It logs each access at warning level, before and after wb-credset runs, with the operation and the binding name (S15-03-access-rulesS15-03-access-rules: Access RulesHow each host process gets only the credentials it needs, for only as long as it needs them, and which process may access which item., rule 6).

wb-credset doesn’t read a variable, and wb starts it with an empty environment.

list takes - as its second argument, so wb-credset always takes exactly two arguments.

wb-credset refuses at once with store-locked, and doesn’t wait for the unlock.

wb-credset opens the store, then confines itself.

The audit record of each wb cred access comes from wb, which asks wb-hostd to write it before and after wb-credset runs, and refuses when the first record can’t be written. I514I514 (open): wb cred: record each store access through wb-hostd before and after the helper runsFollow-up of #504 (M3.8b), decision 1 there. builds it.

  • Placeholders and bindings in the policy, and any check of a name against the declared bindings: M4.10.
  • The expired-profile report on a SIGKILL of wb-credset: M6.6.

Status: Draft