mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
I reintroduced forbidden names into hanzo source. The port carried over the
script's regex of banned strings, which put those strings in our repo -- the
exact thing the rule against them exists to prevent. Fixed by inverting it.
The script needed a denylist because it swept whole ORGS, so anything could turn
up in a listing. This never enumerates an org; it acts only on the declared
table. The one residual risk is a declared repo being TRANSFERRED out of our
estate, which Plan still checks after resolution -- and naming what we OWN
answers that without naming anything we do not.
It is also the stronger check. A denylist refuses what it was told about; an
allowlist refuses by default, including orgs nobody has thought of yet. A
near-miss like hanzoai-lookalike/repo passes a substring denylist and fails this.
hanzo-apps is in the list because three declared repos have been transferred
there -- proven by the live dry run, not assumed:
hanzoai/hanzo.{sh,one,network} <- hanzo-apps/*
Still 24 of 24 resolved. grep for the banned strings in mirror/ returns 0.
Co-authored-by: Hanzo Dev <[email protected]>
25 lines
780 B
Go
25 lines
780 B
Go
package mirror
|
|
|
|
import "testing"
|
|
|
|
// The allowlist must refuse an org we do not own, including one nobody thought
|
|
// about. A denylist can only refuse what it was told to; this refuses by default,
|
|
// which is the property that matters when a repo is transferred somewhere new.
|
|
func TestOwnedRefusesAnythingNotOurs(t *testing.T) {
|
|
for _, org := range []string{"hanzoai", "hanzobot", "hanzo-ml"} {
|
|
if !Owned[org] {
|
|
t.Errorf("%s is ours and must be allowed", org)
|
|
}
|
|
}
|
|
for _, full := range []string{
|
|
"someone-else/thing",
|
|
"an-org-nobody-added-yet/repo",
|
|
"hanzoai-lookalike/repo", // near-miss must not pass
|
|
"nope", // no slash at all
|
|
} {
|
|
if owned(full) {
|
|
t.Errorf("owned(%q) = true; the allowlist admitted something not ours", full)
|
|
}
|
|
}
|
|
}
|