Conversation
|
I'll monitor the rollout of the new What I'll watch for:
This is a low-risk change since it's a CLI-only addition that depends on existing API endpoints. The main thing to watch is whether the backend |
|
🔧 CI Fix Available |
06c1cdf to
811df1e
Compare
| // Seed the SDK's browser route cache before constructing the raw curl client. | ||
| if _, err := b.browsers.Get(ctx, in.Identifier, kernel.BrowserGetParams{}); err != nil { | ||
| return curlError(in, util.CleanedUpSdkError{Err: err}) | ||
| } |
There was a problem hiding this comment.
we might want to consider a local disk cache of this since this is super inefficient
| httpClient.Timeout = in.MaxTime | ||
| } | ||
|
|
||
| req, err := http.NewRequestWithContext(ctx, method, in.URL, bodyReader) |
There was a problem hiding this comment.
can we verify that /curl/raw doesn't forward Go's default User-Agent / Accept-Encoding as browser request headers when the user didn't specify them?
The CLI builds a normal Go http.Request and sends it through the SDK HTTPClient; Go's transport can add defaults like User-Agent: Go-http-client/1.1, and the raw endpoint appears to forward non-hop-by-hop headers into the Chromium forward proxy. If the Chromium proxy honors those forwarded headers, this could override the browser's UA/default headers even though the command is documented as inheriting browser headers.
There was a problem hiding this comment.
addressing upstream in chromium
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
Made-with: Cursor
fb182e7 to
db97766
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues. You can view the agent here.
Reviewed by Cursor Bugbot for commit db97766. Configure here.
| } | ||
| if body != "" && !hasCurlHeader(headers, "Content-Type") { | ||
| req.Header.Set("Content-Type", "application/x-www-form-urlencoded") | ||
| } |
There was a problem hiding this comment.
Go default headers leak through browser proxy
High Severity
When no User-Agent header is explicitly provided by the user, Go's http.Transport automatically injects User-Agent: Go-http-client/1.1 into the outgoing request. Since /curl/raw appears to forward non-hop-by-hop headers into the Chromium forward proxy, this Go default will override the browser's natural User-Agent, defeating the core purpose of routing requests through Chrome's network stack for TLS fingerprint and header inheritance. The same concern applies to Accept-Encoding: gzip. The request construction here doesn't prevent these Go defaults from being added.
Reviewed by Cursor Bugbot for commit db97766. Configure here.
| if in.Head { | ||
| method = "HEAD" | ||
| } | ||
| } |
There was a problem hiding this comment.
Empty data file doesn't default method to POST
Low Severity
The method inference checks body != "" to decide whether to default to POST, but the PR documents "defaults to POST when --data is set." When --data-file points to an empty file, readCurlBody returns "", so the method stays GET despite the user explicitly requesting a data upload. Checking in.DataFile != "" alongside the body content would fix the --data-file case.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit db97766. Configure here.


Summary
Adds a curl-like
kernel browsers curlcommand for making HTTP requests through a browser session's Chrome network stack. Requests inherit the browser's TLS fingerprint, cookies, proxy configuration, and browser headers, and responses are streamed directly through the SDK browser HTTP client wrapper around/curl/raw./curl/rawfollows redirects automatically in Chromium, so this command documents that behavior rather than exposing-L.Usage
Flags
-X, --request--datais set)-H, --header"Key: Value"format)-d, --data--data-file--max-time-o, --output-I, --head-i, --include-D, --dump-header-for stdout)-w, --write-out%{http_code},%{response_code},%{time_total},%{size_download}-f, --fail-s, --silentImplementation notes
github.com/kernel/kernel-go-sdk v0.51.0andBrowsers.HTTPClient(sessionID)to route requests through/curl/raw.--failand timeout output closer to curl behavior.Test plan
make test && make buildkernel browsers curl <id> https://example.com, delete browsercurlvskernel browsers curlfor body output,-i,-o,-i -o, and-d-I,-D,-w,-f, and--max-time/curl/rawfollows redirects automatically while plaincurldoes not without-LNote
Medium Risk
Introduces new HTTP execution paths and modifies global error output behavior; while scoped to a new subcommand, it changes stdout/stderr expectations and request/response streaming semantics.
Overview
Adds a new
kernel browsers curl <session-id> <url>command that makes HTTP requests through the browser session’s SDK-providedHTTPClient, supporting curl-like flags for method/headers/body (incl.--data-file), timeouts, output-to-file, header inclusion/dumping,--write-outmetrics,--fail, and--silent.Updates root error handling to support “silent” command errors (suppress diagnostics while still exiting non-zero) and to ensure CLI errors are written to fang’s error stream (stderr), keeping stdout clean for response bodies. Documentation and examples in
README.mdare updated, and new unit tests cover request shaping, output/header behaviors, write-out expansion, fail mode, and silent error wrapping.Reviewed by Cursor Bugbot for commit db97766. Bugbot is set up for automated code reviews on this repo. Configure here.