Husk
GitHub

Security

Secrets

Two independent controls — nothing credential-shaped enters the machine, and nothing credential-shaped leaves a tool result — plus an honest list of what each one misses.

Two controls, in opposite directions, and neither depends on the other.

  1. Inbound. The environment a command runs with is rebuilt from a small allow-list, so a variable Husk has never heard of is dropped rather than forwarded.
  2. Outbound. Every tool result passes through redact() before it re-enters the conversation, so an agent that cats a .env sees the file and the model sees sk-ant-…[redacted].

The environment scrub

scrubEnv runs before every exec on the local provider, where commands run as you on this machine. It does not filter your environment — it builds a new one.

Kept, and nothing else:

PATH  HOME  LANG  LC_ALL  TZ  TERM  SHELL  USER  LOGNAME  TMPDIR  PWD
SYSTEMROOT  COMSPEC  WINDIR  PATHEXT  NUMBER_OF_PROCESSORS  PROCESSOR_ARCHITECTURE

Then anything in computer.env or the exec's own env is written over the top — an explicit value wins, because you asked for it — and last HUSK=1, which nothing overrides.

The other providers never pass this machine's environment in at all. A Docker, Podman or Fly computer gets computer.env, the exec's env and HUSK=1, and nothing else from here. On ssh, a command runs in the remote login's own environment, with those on top.

Everything else is dropped: ANTHROPIC_API_KEY, AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN, and also EDITOR, NODE_OPTIONS, npm_config_registry and your shell prompt. A smaller environment is a smaller blast radius, and agents rarely miss it.

Passing a credential deliberately

husk.yaml
computer:
  env:
    GITHUB_TOKEN: ${GITHUB_TOKEN}
husk up scratch --env GITHUB_TOKEN=ghp_...     # for one machine
husk exec scratch --env FOO=bar -- printenv    # for one command

Explicit beats implicit. The decision is now in the file, where a reviewer can see it and a diff can catch it. ${GITHUB_TOKEN} is read from the environment Husk runs in when the computer is made, so the token itself never goes into the file; if it is unset or empty, Husk refuses to make the computer rather than pass the placeholder's text.

Redaction

redact() from @husk-ai/core matches thirteen patterns:

PatternProvider
sk-ant-… (20+ chars)Anthropic
sk-… (20+ letters, digits, - and _)OpenAI, project keys included, and lookalikes
gsk_… (20+)Groq
AIza… (30+)Google
ghp_… (30+)GitHub personal access token
github_pat_… (30+)GitHub fine-grained token
xox[baprs]-… (10+)Slack
AKIA + 16 uppercase alphanumericsAWS access key id
npm_… (30+)npm token
fo1_… (20+)Fly token
xai-… (20+)xAI
Authorization: or Proxy-Authorization: with Bearer, Basic or Token, then 16+ charactersthe token in a request header
-----BEGIN … PRIVATE KEY----- (PGP's PRIVATE KEY BLOCK-----) … -----END …-----PEM private key: untyped, RSA, EC, DSA, OpenSSH, encrypted or PGP

A match is masked, not deleted, so the model can still reason about which credential it saw:

sk-ant-api03-AbCdEf...  ->  sk-ant...[redacted]
-----BEGIN RSA PRIVATE KEY-----…  ->  [redacted private key]

The mask keeps the first min(6, floor(length / 4)) characters.

Where it runs

PathRedacted
Tool result content, before it enters the conversationyes
Tool error messages and Denied: … resultsyes, same code path
Router warnings and fallback messagesyes
Provider availability reasons in husk doctoryes
tool_delta events — live stdout as it streamsyes
A tool call's arguments, warnings and errors in run eventsyes
Persisted run events in ~/.husk/runs/<id>/events.ndjsonyes, the same events
The prompt you typedno
The model's own outputno
Transcripts cached by husk importno

The clamp runs before the redaction, so redaction always operates over bounded input rather than over a 40 MB log.

Turning it off

guardrails:
  redactSecrets: false

The only reason to do this is when redaction is corrupting legitimate output — a build log full of base64 blobs that happen to match sk-. It is on by default and should stay on.

What redaction misses

It is a pattern list. Specifically:

  • Any credential format not in the table. A Stripe key, a database URL with a password in it, a JWT, a bearer token your own service issues when it is not in an Authorization header.
  • A secret split across a chunk boundary. Redaction runs on the assembled tool result, so this is rare, but a value spanning the elision marker of a truncated log can survive in halves.
  • Anything the model infers. Redaction is textual. It does not stop a model from noticing that a file exists, or from reading a config value that is not credential-shaped but is still confidential.

Redaction is a seatbelt for the common case. It is not a data-loss-prevention product, and it is not a reason to point an agent at a directory full of production secrets.

The distiller redacts more

husk distill runs a second, wider redactor over the DistilledAgent on its way into husk.yaml — because that file is the artifact people commit to a repository.

CategoryReplaced with
The credential patterns abovethe same masks
Your home directory, in every spelling~
Email addresses[email]

C:\Users\alice\dev becomes ~\dev; /home/alice/src becomes ~/src. It runs over the name, description, persona, every knowledge title, content and source, both sides of every example, and every distiller note.

What Husk never stores

  • No command writes a key to ~/.husk. Keys come from the process environment, or from ~/.husk/.env if you write one; Husk only reads it. There is no husk login and no keychain integration.
  • No telemetry. Absent from the codebase, not disabled by a flag. The requests Husk does make are listed under Requests Husk itself makes.

Everything Husk does keep lives under one directory so you can delete it in one move:

~/.husk/
  config.json      settings, model aliases
  .env             keys you put there, read at start
  husks/           registered husk.yaml files
  computers/       machine metadata and session bindings
  workspaces/      the local provider's filesystems
  runs/            run summaries and events.ndjson  ← redacted by pattern only
  transcripts/     imported chats                   ← unredacted
  data/  cache/

Directories are created with mode 0o700.