feat(scrub): add comprehensive browser fingerprint and client identity header scrubbing

This commit is contained in:
maplelove
2026-02-22 20:51:00 +08:00
parent 9491517b26
commit 5dc1848466
3 changed files with 73 additions and 14 deletions

View File

@@ -149,13 +149,7 @@ func (e *AntigravityExecutor) HttpRequest(ctx context.Context, auth *cliproxyaut
}
httpReq.Close = true
httpReq.Header.Del("Accept")
httpReq.Header.Del("X-Forwarded-For")
httpReq.Header.Del("X-Forwarded-Host")
httpReq.Header.Del("X-Forwarded-Proto")
httpReq.Header.Del("X-Forwarded-Port")
httpReq.Header.Del("X-Real-IP")
httpReq.Header.Del("Forwarded")
httpReq.Header.Del("Via")
scrubProxyAndFingerprintHeaders(httpReq)
httpClient := newAntigravityHTTPClient(ctx, e.cfg, auth, 0)
return httpClient.Do(httpReq)
}
@@ -1405,13 +1399,7 @@ func (e *AntigravityExecutor) buildRequest(ctx context.Context, auth *cliproxyau
httpReq.Header.Set("Content-Type", "application/json")
httpReq.Header.Set("Authorization", "Bearer "+token)
httpReq.Header.Set("User-Agent", resolveUserAgent(auth))
httpReq.Header.Del("X-Forwarded-For")
httpReq.Header.Del("X-Forwarded-Host")
httpReq.Header.Del("X-Forwarded-Proto")
httpReq.Header.Del("X-Forwarded-Port")
httpReq.Header.Del("X-Real-IP")
httpReq.Header.Del("Forwarded")
httpReq.Header.Del("Via")
scrubProxyAndFingerprintHeaders(httpReq)
if host := resolveHost(base); host != "" {
httpReq.Host = host
}