the forge authenticates every reader, so the token is structural

An earlier note here recorded that public forge repositories are readable
anonymously. They are not. The check behind it used `git -c credential.helper=`,
which kept reading the system and global helpers, so it measured a credential it
did not know it had. With those out of the way the forge answers 401 for every
repository, public ones included:

  curl -o /dev/null -w '%{http_code}' \
    https://git.hanzo.ai/hanzoai/ci.git/info/refs?service=git-upload-pack

FORGE_TOKEN is therefore required, and stays required however much of the estate
is published — publishing changes who may read a repository on GitHub, not
whether this forge asks who is asking.

The code keeps tolerating an empty token. That is not a deployment mode; it is
that the URL rewrite must happen either way, because the rewrite is what makes
our names resolve from the forge and dropping it sends them to github.com.
This commit is contained in:
zooqueen
2026-08-20 00:06:44 -07:00
parent 23753a4cfe
commit a34b54519f
2 changed files with 25 additions and 12 deletions
+21 -8
View File
@@ -68,19 +68,32 @@ repositories are published; when it is empty for good, delete the variable.
"bypass the proxy AND the log", and bypassing the proxy is what sends the
toolchain to github.com. A test asserts the server never sets it.
## The forge credential is also a transition value
## The forge credential is structural, and going open source does not change it
Public forge repositories are readable anonymously — verified, not assumed:
The forge asks every reader to sign in, public repositories included:
```sh
GIT_TERMINAL_PROMPT=0 git -c credential.helper= ls-remote https://git.hanzo.ai/hanzoai/ci.git
curl -o /dev/null -w '%{http_code}\n' \
https://git.hanzo.ai/hanzoai/ci.git/info/refs?service=git-upload-pack # 401
```
So `FORGE_TOKEN` is only needed for source the forge will not serve
anonymously, and empty is a working configuration. The URL rewrite happens with
or without it — reaching the forge and being allowed to read a given repository
there are different questions, and dropping the rewrite would send our names
back to github.com.
So `FORGE_TOKEN` is required, and it stays required however much of the estate
is published. Publishing changes who may read a repository on GitHub; it does
not change that this forge authenticates.
An earlier note here claimed the opposite, from a `git -c credential.helper=`
check that quietly kept reading the system and global helpers. Verify anonymity
with `GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null`, or with plain
curl against `info/refs`, which has no helper to inherit.
The code still tolerates an empty token — it degrades to a plain rewrite rather
than embedding an empty credential in a URL — because the rewrite is what makes
our names resolve from the forge at all, and dropping it would send them back to
github.com. That is worth keeping as behaviour. It is not a deployment mode.
In the cluster the value comes from KMS at `hanzo:/deploy/FORGE_TOKEN`, synced
by the `git-hanzo-ai-token-kms-sync` KMSSecret into `git-hanzo-ai-token/token`.
It carries write scope and only needs read.
## Retention has a limit, and it is stated in the README
+4 -4
View File
@@ -39,7 +39,7 @@ The server reads:
| variable | default | meaning |
|---|---|---|
| `FORGE` | `https://git.hanzo.ai` | where our source lives |
| `FORGE_TOKEN` | — | forge credential; only for source the forge will not serve anonymously. Empty is a working configuration |
| `FORGE_TOKEN` | — | forge credential. Required: the forge asks every reader to sign in, public repositories included |
| `NAMESPACES` | `github.com/hanzoai` | module prefixes this proxy answers for |
| `UNLOGGED` | *(empty)* | paths the public checksum log has never seen |
| `UPSTREAM` | `https://proxy.golang.org` | where everything else resolves |
@@ -74,6 +74,6 @@ while the log remembers what was published under the same name, so a forge copy
whose bytes disagree with the published tag is caught here and nowhere else. The
caller's `go.sum` pins everything a second time.
**Credentials stay in.** When there is a forge token it reaches git through the
environment of each child process — never a config file, never an image layer —
and is removed from any text on its way to a log or a response.
**Credentials stay in.** The forge token reaches git through the environment of
each child process — never a config file, never an image layer — and is removed
from any text on its way to a log or a response.