Tokens sent to the wrong host
Even without a brokered secret, token-egress denies a well-known token sent to a host that is not its service’s, allowed hosts included: a GitHub token to registry.npmjs.org is denied, to api.github.com it is not.
| Token | Its own hosts |
|---|---|
GitHub (ghp_, gho_, github_pat_, …) |
github.com, githubusercontent.com, ghcr.io |
OpenAI and Anthropic (sk-, sk-proj-, sk-ant-, …) |
openai.com, anthropic.com |
AWS access key ids (AKIA…) |
amazonaws.com, aws.amazon.com |
Slack (xoxb-, xoxp-, …) |
slack.com |
Google API keys (AIza…) |
googleapis.com, google.com |
npm (npm_) |
npmjs.org, npmjs.com |
GitLab (glpat-) |
gitlab.com |
Each with its subdomains. It is checked in a fetch or network tool’s URL, an MCP URL argument, a web search, and the arguments of a command that connects to a host and of commands piped into it. Only these prefixed formats count, so commit SHAs, UUIDs and base64 data are never taken for a token. A self-hosted GitLab or GitHub Enterprise server is not the service’s host; to send tokens there, narrow the rule with openmoat edit (POLICY.md).
It does not see a token in a file a command uploads (curl -d @file), a here-document, a variable whose value is not on the command line, or an encoded or split token.
openmoat policy check "curl -H 'Authorization: token ghp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' https://registry.npmjs.org/"
✕ deny
rules : token-egress
reason: sends a known kind of token to a host that is not its service's: shell "@token-egress github registry.npmjs.org"
also : net registry.npmjs.orgA real run with the default policy (your home shown as /Users/you). It runs nothing: it only decides. The token is a made-up example.