Use documentation values in tests and drop a stale internal path

The header-stripping test sent a real internal address and an internal
client name as forwarded headers. It now uses 203.0.113.44 (TEST-NET-3) and a
neutral client name, and checks those values for leaks instead. The host
setup guide pointed at the build directory of an old monorepo layout; it is
service/ in this repository.

Claude-Session: https://claude.ai/code/session_01GGe7kUhooMFuzY6GaDb2w9
This commit is contained in:
agw
2026-10-01 17:35:00 +02:00
parent 06bdd1423f
commit 4287cb8240
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ echo wireguard >> /etc/modules-load.d/wireguard.conf
pct start 200
# Byg fetch-service binæren på din dev-maskine (Arch eller hvor):
# cd random_proxy/service && make build
# cd service && make build
# Push den + setup-scriptet ind:
pct push 200 ./service/weircon-random-proxy /usr/local/bin/weircon-random-proxy --perms 0755
+5 -5
View File
@@ -65,7 +65,7 @@ func TestStripIdentifying(t *testing.T) {
}
func TestAnonymizeOverridesUserAgent(t *testing.T) {
for _, ua := range []string{"crawlkit-roles", "python-requests/2.32", "Go-http-client/1.1", ""} {
for _, ua := range []string{"example-client", "python-requests/2.32", "Go-http-client/1.1", ""} {
h := http.Header{}
if ua != "" {
h.Set("User-Agent", ua)
@@ -103,10 +103,10 @@ func TestHandlerTargetSeesOnlyBrowser(t *testing.T) {
req := httptest.NewRequest(http.MethodGet, "/", nil)
req.Header.Set("X-Weircon-Random-Ip", "secret-key")
req.Header.Set("X-Weircon-Random-Ip-Redirect", target.URL+"/x")
req.Header.Set("User-Agent", "crawlkit-roles")
req.Header.Set("User-Agent", "example-client")
req.Header.Set("From", "someone@example.com")
req.Header.Set("X-Forwarded-For", "192.168.10.144")
req.Header.Set("X-Real-Ip", "192.168.10.144")
req.Header.Set("X-Forwarded-For", "203.0.113.44")
req.Header.Set("X-Real-Ip", "203.0.113.44")
req.Header.Set("Sec-Ch-Ua", `"Chromium";v="125"`)
rec := httptest.NewRecorder()
h.ServeHTTP(rec, req)
@@ -119,7 +119,7 @@ func TestHandlerTargetSeesOnlyBrowser(t *testing.T) {
}
for k, v := range got {
lk := strings.ToLower(k + ":" + strings.Join(v, ","))
for _, bad := range []string{"weircon", "crawlkit", "secret-key", "192.168.", "example.com", "forwarded", "sec-ch-ua", "from:"} {
for _, bad := range []string{"weircon", "example-client", "secret-key", "203.0.113.", "example.com", "forwarded", "sec-ch-ua", "from:"} {
if strings.Contains(lk, bad) {
t.Errorf("target saw identifying header %s: %v", k, v)
}