Repository navigation
Conversation
|
Thanks @Junior-HJ, this is a really careful piece of work. Basing the change on an actual mitmproxy capture of agy 1.4.4 and committing a golden fixture (with the bearer token redacted) is exactly how fingerprint fidelity should be done, and keeping the IDE profile byte-for-byte unchanged (darwin/arm64 pin, Accept, numeric enums) makes the blast radius easy to reason about. The Go GOOS/GOARCH mapping, the cl= handling and the profile-aware loadCodeAssist metadata are clean, and I confirmed the new tests go red when the source hunks are reverted and green with them (49/49 on the Antigravity suites). What we will fix in place so you do not need another round: add the new ANTIGRAVITY_CLI_CL variable to .env.example and docs/reference/ENVIRONMENT.md (the check:env-doc-sync gate flags it), and rename the changelog fragment to include the PR number (17913-antigravity-cli-wire-image-fidelity.md). We may also add a numeric guard on that env value and a small test that the bootstrap/usage/OAuth call sites pass the cli profile. Two things we would love your input on, since you have the capture: (1) does the native CLI send the same minimal {"ideType":"ANTIGRAVITY"} metadata on onboardUser, or only on loadCodeAssist? The PR extends it to both, but the capture you describe only shows loadCodeAssist. (2) Did you test a non-consumer (Workspace/enterprise) account without x-goog-user-project? Dropping it for all cli connections is the one behavioural change we cannot verify offline, so we will run a live check on our side before merging. Also worth remembering that cl= is pinned to the 1.4.4 build, so it will need a refresh when agy bumps. |
|
Thanks @diegosouzapw, and thanks for taking the On your two questions: 1. 2. Non-consumer accounts. Every capture is One thing we are pushing now, since you flagged it: Also happy to add the numeric guard on |
4074bef to
ad82e99
Compare
The CLI profile presented the IDE fingerprint: a pinned darwin/arm64 platform token,
an `Accept: text/event-stream` header, `x-goog-user-project` on the consumer path, and
the numeric-enum loadCodeAssist body. A live capture of the native Go binary
(agy 1.4.4, Windows x64) shows none of that.
- User-Agent now reports the real host in Go's GOOS/GOARCH dialect (windows/amd64,
not Node's win32/x64) plus the build changelist:
`antigravity/cli/<ver> (aidev_client; os_type=<goos>; arch=<goarch>; cl=<cl>; auth_method=consumer)`.
The changelist is not derivable from the version nor exposed by the public
manifests, so it resolves from ANTIGRAVITY_CLI_CL, then a known-version table
seeded from the capture.
- streamGenerateContent drops `Accept` and `x-goog-user-project` on the CLI profile;
SSE is requested by `?alt=sse` alone. The IDE profile is unchanged and still sends
`Accept`, and sendAntigravityRequest keeps its one-shot 403 retry without the
quota-project header.
- loadCodeAssist sends the native 38-byte `{"metadata":{"ideType":"ANTIGRAVITY"}}`
body on the CLI profile; every call site passes its real profile so the IDE path
keeps the numeric enums.
- Header order for the antigravity fingerprint matches the capture, and the
never-read ANTIGRAVITY_USER_AGENT env knob is gone from .env.example and the docs.
resolveAntigravityCliChangelist fell back to 1.4.4's changelist for every version, so a bumped agy advertised cl=1003595037 alongside a version that never shipped with it. A stale cl is a worse fingerprint than no cl at all. The resolver now returns null when the version is unknown and ANTIGRAVITY_CLI_CL is unset, and antigravityCliUserAgent drops the cl token entirely in that case. 1.4.4 still resolves 1003595037 from the known-version table, so the captured wire image is unchanged.
ad82e99 to
7e2930c
Compare
Why
The
antigravityCLI client profile was sending the IDE fingerprint on every request. A live mitmproxy capture of the native Go binary (agy 1.4.4, Windows x64) shows four concrete divergences:os_type=windows; arch=amd64(GoGOOS/GOARCH)darwin/arm64cl=1003595037AcceptonstreamGenerateContent?alt=sse)text/event-streamx-goog-user-project(consumer)loadCodeAssistmetadata{"ideType":"ANTIGRAVITY"}(38 bytes, 200 OK)ideType: 9,platform,pluginType: 2)What changed
antigravityCliUserAgentnow renders the real host in Go's dialect plus the build changelist:antigravity/cli/<ver> (aidev_client; os_type=<goos>; arch=<goarch>; cl=<cl>; auth_method=consumer).resolveAntigravityGoPlatform()mapsprocess.platform/process.arch(win32→windows,x64→amd64, …).resolveAntigravityCliChangelist()resolvesANTIGRAVITY_CLI_CL, then a known-version table, then the last captured value.clis a Google Piper changelist — not derivable from the version, and the public auto-updater manifests only exposeversion/url/sha512.streamGenerateContentstops sendingAcceptandx-goog-user-projecton the CLI profile.sendAntigravityRequestkeeps its one-shot 403 retry without the quota-project header.loadCodeAssist/onboardUsersend the native minimal body on the CLI profile. Every call site (antigravityProjectBootstrap,usage/antigravity,oauth/providers/antigravity,agyAuthImport) now passes its real profile, so the IDE path keeps the numeric enums that its own live comparison proved necessary.CLI_FINGERPRINTS.antigravity.headerOrdermatches the capture (noAccept, nox-goog-*).ANTIGRAVITY_USER_AGENTenv knob is gone from.env.example,docs/security/STEALTH_GUIDE.mdanddocs/reference/ENVIRONMENT.md(no source reference existed).The IDE profile is untouched:
darwin/arm64pin,Accept: text/event-stream,x-goog-user-project, and the numeric protobuf enums.Tests
tests/unit/antigravity-wire-order.test.ts(red → green) plus the golden fixturetests/fixtures/antigravity/native-wire.json(Authorization redacted — no bearer token is stored). It asserts the UA byte for byte against the capture, the Go platform mapping, bothloadCodeAssistbody shapes, and that the CLI path carries onlyauthorization/content-type/user-agent.tests/unit/executor-antigravity.test.ts: new case provingbuildHeadersomitsAccept/x-goog-user-projectforcliand keepsAcceptforide.antigravity-headers.test.ts,antigravity-client-profile.test.ts).npm run typecheck:core,npm run lint,check:docs-syncandcheck-changelog-integrityclean.Notes
no-unused-varserrors incliFingerprints.ts:236,antigravityClientProfile.ts:2andexecutor-antigravity.test.ts:688are pre-existing on the base branch and untouched by this diff;npm run lint(with suppressions) passes.