Skip to content

Commit 13f2035

Browse files
Merge branch 'main' into security/vuln-remediation
2 parents e9b947d + 638ef73 commit 13f2035

10 files changed

Lines changed: 811 additions & 47 deletions

File tree

.github/workflows/fix-ci.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ jobs:
2020
steps:
2121
- name: Generate app token
2222
id: app-token
23-
uses: actions/create-github-app-token@v1
23+
uses: actions/create-github-app-token@v3
2424
with:
2525
app-id: ${{ secrets.ADMIN_APP_ID }}
2626
private-key: ${{ secrets.ADMIN_APP_PRIVATE_KEY }}
2727

2828
- name: Checkout repository
29-
uses: actions/checkout@v4
29+
uses: actions/checkout@v6
3030
with:
3131
token: ${{ steps.app-token.outputs.token }}
3232
fetch-depth: 0
@@ -36,13 +36,20 @@ jobs:
3636
curl https://cursor.com/install -fsS | bash
3737
echo "$HOME/.cursor/bin" >> $GITHUB_PATH
3838
39+
- name: Enable Cursor Max Mode
40+
run: |
41+
CFG_DIR="$HOME/.cursor"
42+
mkdir -p "$CFG_DIR"
43+
echo '{"maxMode": true}' > "$CFG_DIR/cli-config.json"
44+
echo "CURSOR_CONFIG_DIR=$CFG_DIR" >> "$GITHUB_ENV"
45+
3946
- name: Configure git identity
4047
run: |
4148
git config user.name "kernel-internal[bot]"
4249
git config user.email "260533166+kernel-internal[bot]@users.noreply.github.com"
4350
4451
- name: Setup Go
45-
uses: actions/setup-go@v5
52+
uses: actions/setup-go@v6
4653
with:
4754
go-version-file: 'go.mod'
4855

.github/workflows/release.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ jobs:
1515
steps:
1616
- name: Generate app token
1717
id: app-token
18-
uses: actions/create-github-app-token@v1
18+
uses: actions/create-github-app-token@v3
1919
with:
2020
app-id: ${{ secrets.ADMIN_APP_ID }}
2121
private-key: ${{ secrets.ADMIN_APP_PRIVATE_KEY }}
2222
repositories: cli,homebrew-tap
2323

2424
- name: Checkout
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v6
2626
with:
2727
fetch-depth: 0
2828

2929
- name: Set up Go
30-
uses: actions/setup-go@v5
30+
uses: actions/setup-go@v6
3131
with:
3232
go-version-file: "go.mod"
3333
cache: true
3434

3535
- name: Set up Node.js
36-
uses: actions/setup-node@v4
36+
uses: actions/setup-node@v6
3737
with:
3838
node-version: '20'
3939
registry-url: 'https://registry.npmjs.org'
@@ -45,7 +45,7 @@ jobs:
4545
run: make clean-templates
4646

4747
- name: Run GoReleaser
48-
uses: goreleaser/goreleaser-action@v6
48+
uses: goreleaser/goreleaser-action@v7
4949
with:
5050
distribution: goreleaser-pro
5151
version: '~> v2'

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515

1616
steps:
1717
- name: Checkout code
18-
uses: actions/checkout@v4
18+
uses: actions/checkout@v6
1919

2020
- name: Set up Go
21-
uses: actions/setup-go@v5
21+
uses: actions/setup-go@v6
2222
with:
2323
go-version-file: "go.mod"
2424
cache: true

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,15 @@ Commands with JSON output support:
213213
- `-H, --headless` - Launch browser without GUI access
214214
- `--kiosk` - Launch browser in kiosk mode
215215
- `--start-url <url>` - Initial page to open on launch
216-
- `--name <name>` - Optional unique name for the session (set at creation; used to find it later by name)
216+
- `--name <name>` - Optional unique name for the session (used to find it later by name; can be changed with `browsers update --name`)
217217
- `--tag <KEY=VALUE>` - Set a tag on the session, repeatable; up to 50 pairs
218218
- `--pool-id <id>` - Acquire a browser from the specified pool (mutually exclusive with --pool-name; ignores other session flags). `--name`/`--tag` still apply to the acquired session.
219219
- `--pool-name <name>` - Acquire a browser from the pool name (mutually exclusive with --pool-id; ignores other session flags)
220220
- `--telemetry=all` - Enable telemetry for all categories
221221
- `--telemetry=off` - Disable telemetry
222222
- `--telemetry=<list>` - Per-category config, e.g. `--telemetry=network=on,page=off`
223+
- `--chrome-policy <json>` - Custom Chrome enterprise policy as a JSON object. Kernel-managed policies (extensions, proxy, automation) are rejected server-side.
224+
- `--chrome-policy-file <path>` - Read the Chrome enterprise policy from a file (use `-` for stdin). Mutually exclusive with `--chrome-policy`.
223225
- `--output json`, `-o json` - Output raw JSON object
224226
- _Note: When a pool is specified, omit other session configuration flags—pool settings determine profile, proxy, viewport, etc._
225227
- `kernel browsers delete <id-or-name>` - Delete a browser by ID or name
@@ -228,6 +230,10 @@ Commands with JSON output support:
228230
- `kernel browsers get <id-or-name>` - Get detailed browser session info by ID or name
229231
- `--output json`, `-o json` - Output raw JSON object
230232
- `kernel browsers update <id-or-name>` - Update a running browser session by ID or name
233+
- `--name <name>` - Set a new unique name for the session (mutually exclusive with `--clear-name`)
234+
- `--clear-name` - Clear the session name
235+
- `--tag <KEY=VALUE>` - Set a tag, repeatable; up to 50 pairs. Replaces the entire tag set (not merged); mutually exclusive with `--clear-tags`
236+
- `--clear-tags` - Remove all tags from the session
231237
- `--telemetry=all` - Enable telemetry for all categories
232238
- `--telemetry=off` - Disable telemetry
233239
- `--telemetry=<list>` - Per-category config, e.g. `--telemetry=network=on,page=off`
@@ -258,11 +264,12 @@ Commands with JSON output support:
258264
- `--timeout <seconds>` - Idle timeout for browsers acquired from the pool
259265
- `--stealth`, `--headless`, `--kiosk` - Default pool configuration
260266
- `--profile-id`, `--profile-name`, `--save-changes`, `--proxy-id`, `--start-url`, `--extension`, `--viewport` - Same semantics as `kernel browsers create`
267+
- `--chrome-policy <json>` / `--chrome-policy-file <path>` - Custom Chrome enterprise policy applied to every browser in the pool, as a JSON object or from a file (`-` for stdin). Same semantics as `kernel browsers create`.
261268
- `--output json`, `-o json` - Output raw JSON object
262269
- `kernel browser-pools get <id-or-name>` - Get pool details
263270
- `--output json`, `-o json` - Output raw JSON object
264271
- `kernel browser-pools update <id-or-name>` - Update pool configuration
265-
- Same flags as create plus `--clear-start-url` (remove the pool's start URL) and `--discard-all-idle` (discard all idle browsers and refill)
272+
- Same flags as create plus `--clear-start-url` (remove the pool's start URL) and `--discard-all-idle` (discard all idle browsers and refill). An empty `--chrome-policy '{}'` is ignored and does not clear an existing policy; recreate the pool to remove one.
266273
- `--output json`, `-o json` - Output raw JSON object
267274
- `kernel browser-pools delete <id-or-name>` - Delete a pool
268275
- `--force` - Force delete even if browsers are leased
@@ -300,14 +307,14 @@ Commands with JSON output support:
300307

301308
Telemetry config is a sub-field of the browser session. Use `browsers create` or `browsers update` to enable, disable, or configure it, and `browsers get` to inspect the current state.
302309

303-
- Enable all categories: `kernel browsers update <id> --telemetry=all`
310+
- Enable the default set: `kernel browsers update <id> --telemetry=all`
304311
- Disable: `kernel browsers update <id> --telemetry=off`
305-
- Per-category: `kernel browsers update <id> --telemetry=network=on,page=off` (valid: `console`, `interaction`, `network`, `page`; `system` always emits and cannot be toggled)
312+
- Capture specific categories: `kernel browsers update <id> --telemetry=console,network` (any of: `console`, `network`, `page`, `interaction`, `control`, `connection`, `system`, `screenshot`, `captcha`)
306313

307314
Per-category updates are partial — only categories you name are changed; others retain their current state. `--telemetry=all` and `--telemetry=off` reset the entire config.
308315

309316
- `kernel browsers telemetry stream <id>` - Stream live telemetry events (NDJSON with `-o json`)
310-
- `--categories <list>` - Filter by event category (`api`, `console`, `interaction`, `network`, `page`, `system`); `system` matches `monitor_*` and `cdp_*` event types
317+
- `--categories <list>` - Filter by event category (`console`, `network`, `page`, `interaction`, `control`, `connection`, `system`, `screenshot`, `captcha`, `monitor`)
311318
- `--types <list>` - Filter by event type (e.g. `network_response`, `console_error`)
312319
- `--seq <n>` - Resume after sequence number N (Last-Event-ID); replays events with `seq > N`. Omit to stream from now.
313320
- `-o, --output json` - Output newline-delimited JSON envelopes
@@ -657,6 +664,10 @@ kernel browsers create --kiosk
657664
# Create a browser with a profile for session state
658665
kernel browsers create --profile-name my-profile
659666

667+
# Create a browser with a custom Chrome enterprise policy
668+
kernel browsers create --chrome-policy '{"BookmarkBarEnabled": false}'
669+
kernel browsers create --chrome-policy-file policy.json
670+
660671
# Delete a browser
661672
kernel browsers delete browser123
662673

cmd/browser_pools.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ type BrowserPoolsCreateInput struct {
105105
StartURL string
106106
Extensions []string
107107
Viewport string
108+
ChromePolicy string
109+
ChromePolicyFile string
108110
Output string
109111
}
110112

@@ -166,6 +168,14 @@ func (c BrowserPoolsCmd) Create(ctx context.Context, in BrowserPoolsCreateInput)
166168
params.Viewport = *viewport
167169
}
168170

171+
chromePolicy, err := parseChromePolicy(in.ChromePolicy, in.ChromePolicyFile)
172+
if err != nil {
173+
return err
174+
}
175+
if len(chromePolicy) > 0 {
176+
params.ChromePolicy = chromePolicy
177+
}
178+
169179
pool, err := c.client.New(ctx, params)
170180
if err != nil {
171181
return util.CleanedUpSdkError{Err: err}
@@ -245,6 +255,8 @@ type BrowserPoolsUpdateInput struct {
245255
ClearStartURL bool
246256
Extensions []string
247257
Viewport string
258+
ChromePolicy string
259+
ChromePolicyFile string
248260
DiscardAllIdle BoolFlag
249261
Output string
250262
}
@@ -316,6 +328,19 @@ func (c BrowserPoolsCmd) Update(ctx context.Context, in BrowserPoolsUpdateInput)
316328
params.Viewport = *viewport
317329
}
318330

331+
chromePolicy, err := parseChromePolicy(in.ChromePolicy, in.ChromePolicyFile)
332+
if err != nil {
333+
return err
334+
}
335+
if len(chromePolicy) > 0 {
336+
params.ChromePolicy = chromePolicy
337+
} else if (in.ChromePolicy != "" || in.ChromePolicyFile != "") && in.Output != "json" {
338+
// An empty policy ({}) cannot clear an existing one: omitzero drops it before it
339+
// reaches the server. Warn instead of silently doing nothing, but stay quiet on the
340+
// json path so stdout remains valid JSON.
341+
pterm.Warning.Println("An empty chrome policy is ignored and does not clear the pool's existing policy; recreate the pool to remove a policy.")
342+
}
343+
319344
pool, err := c.client.Update(ctx, in.IDOrName, params)
320345
if err != nil {
321346
return util.CleanedUpSdkError{Err: err}
@@ -541,6 +566,9 @@ func init() {
541566
browserPoolsCreateCmd.Flags().String("start-url", "", "Initial page to open for new browsers")
542567
browserPoolsCreateCmd.Flags().StringSlice("extension", []string{}, "Extension IDs or names")
543568
browserPoolsCreateCmd.Flags().String("viewport", "", "Viewport size (e.g. 1280x800)")
569+
browserPoolsCreateCmd.Flags().String("chrome-policy", "", "Custom Chrome enterprise policy as a JSON object")
570+
browserPoolsCreateCmd.Flags().String("chrome-policy-file", "", "Read Chrome enterprise policy (JSON object) from a file (use '-' for stdin)")
571+
browserPoolsCreateCmd.MarkFlagsMutuallyExclusive("chrome-policy", "chrome-policy-file")
544572

545573
addJSONOutputFlag(browserPoolsGetCmd)
546574

@@ -559,6 +587,9 @@ func init() {
559587
browserPoolsUpdateCmd.Flags().Bool("clear-start-url", false, "Clear the pool start URL")
560588
browserPoolsUpdateCmd.Flags().StringSlice("extension", []string{}, "Extension IDs or names")
561589
browserPoolsUpdateCmd.Flags().String("viewport", "", "Viewport size (e.g. 1280x800)")
590+
browserPoolsUpdateCmd.Flags().String("chrome-policy", "", "Custom Chrome enterprise policy as a JSON object")
591+
browserPoolsUpdateCmd.Flags().String("chrome-policy-file", "", "Read Chrome enterprise policy (JSON object) from a file (use '-' for stdin)")
592+
browserPoolsUpdateCmd.MarkFlagsMutuallyExclusive("chrome-policy", "chrome-policy-file")
562593
browserPoolsUpdateCmd.Flags().Bool("discard-all-idle", false, "Discard all idle browsers")
563594
addJSONOutputFlag(browserPoolsUpdateCmd)
564595

@@ -615,6 +646,8 @@ func runBrowserPoolsCreate(cmd *cobra.Command, args []string) error {
615646
startURL, _ := cmd.Flags().GetString("start-url")
616647
extensions, _ := cmd.Flags().GetStringSlice("extension")
617648
viewport, _ := cmd.Flags().GetString("viewport")
649+
chromePolicy, _ := cmd.Flags().GetString("chrome-policy")
650+
chromePolicyFile, _ := cmd.Flags().GetString("chrome-policy-file")
618651
output, _ := cmd.Flags().GetString("output")
619652

620653
in := BrowserPoolsCreateInput{
@@ -632,6 +665,8 @@ func runBrowserPoolsCreate(cmd *cobra.Command, args []string) error {
632665
StartURL: startURL,
633666
Extensions: extensions,
634667
Viewport: viewport,
668+
ChromePolicy: chromePolicy,
669+
ChromePolicyFile: chromePolicyFile,
635670
Output: output,
636671
}
637672

@@ -664,6 +699,8 @@ func runBrowserPoolsUpdate(cmd *cobra.Command, args []string) error {
664699
clearStartURL, _ := cmd.Flags().GetBool("clear-start-url")
665700
extensions, _ := cmd.Flags().GetStringSlice("extension")
666701
viewport, _ := cmd.Flags().GetString("viewport")
702+
chromePolicy, _ := cmd.Flags().GetString("chrome-policy")
703+
chromePolicyFile, _ := cmd.Flags().GetString("chrome-policy-file")
667704
discardIdle, _ := cmd.Flags().GetBool("discard-all-idle")
668705
output, _ := cmd.Flags().GetString("output")
669706

@@ -684,6 +721,8 @@ func runBrowserPoolsUpdate(cmd *cobra.Command, args []string) error {
684721
ClearStartURL: clearStartURL,
685722
Extensions: extensions,
686723
Viewport: viewport,
724+
ChromePolicy: chromePolicy,
725+
ChromePolicyFile: chromePolicyFile,
687726
DiscardAllIdle: BoolFlag{Set: cmd.Flags().Changed("discard-all-idle"), Value: discardIdle},
688727
Output: output,
689728
}
@@ -703,7 +742,7 @@ func runBrowserPoolsAcquire(cmd *cobra.Command, args []string) error {
703742
client := getKernelClient(cmd)
704743
timeout, _ := cmd.Flags().GetInt64("timeout")
705744
name, _ := cmd.Flags().GetString("name")
706-
tags := tagsFromFlag(cmd, "tag")
745+
tags, _ := tagsFromFlag(cmd, "tag")
707746
output, _ := cmd.Flags().GetString("output")
708747
c := BrowserPoolsCmd{client: &client.BrowserPools}
709748
return c.Acquire(cmd.Context(), BrowserPoolsAcquireInput{

0 commit comments

Comments
 (0)