Skip to content

Commit 51fd470

Browse files
authored
fix: remove flags blocking enterprise extension loading (#133)
## Summary - Removes `--disable-background-networking` from the default `CHROMIUM_FLAGS` in the headless wrapper - **Removes `--disable-extensions-except` flag usage** - this flag was preventing Chrome from creating external providers (including the policy loader), blocking enterprise extension installation - Chrome's `ExtensionInstallForcelist` enterprise policy requires background networking to fetch `update.xml` and `.crx` files from the extension server ## Root Cause Two issues were preventing enterprise extensions from loading: 1. `--disable-background-networking` prevented Chrome from making HTTP requests to fetch extensions 2. `--disable-extensions-except` caused Chrome to set `extensions_enabled_` to `false`, which prevents external providers (including the policy loader) from being created in `extension_service.cc` ## Changes ### Flag Changes - Remove `--disable-background-networking` from headless wrapper defaults - Remove `--disable-extensions-except` from: - `wrapper.sh` proxy extension setup - `chromium.go` API flag generation - `chromiumflags.go` MergeExtensionPath function - Keep `--load-extension` for loading extensions via command line ### Test Changes - Add `TestEnterpriseExtensionInstallation` e2e test - Test uploads a kernel-like extension first (mirrors production behavior) - Then uploads enterprise extension and verifies it loads via policy ## Test plan - [x] Add new e2e test `TestEnterpriseExtensionInstallation` - [x] Test verifies Chrome fetches update.xml and .crx - [x] Test verifies extension appears in chrome://extensions - [ ] Run existing e2e tests to ensure no regressions <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Allows enterprise policy (`ExtensionInstallForcelist`) extensions to install correctly. > > - Removes `--disable-background-networking` from headless `wrapper.sh` defaults > - Eliminates use/emission of `--disable-extensions-except`; `chromiumflags.MergeFlags` now folds its paths into `--load-extension` and never re-emits it; adds `MergeExtensionPath` > - `server/cmd/api/api/chromium.go` no longer writes `--disable-extensions-except` when building flags; only uses `--load-extension` for non-policy extensions with clear inline rationale > - Adds e2e `TestEnterpriseExtensionInstallation` (headless/headful) plus minimal enterprise test extension assets and pack script; verifies policy config, update.xml/.crx fetch, logs, and presence in `chrome://extensions` > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1472fd8. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 12b2f28 commit 51fd470

File tree

11 files changed

+799
-50
lines changed

11 files changed

+799
-50
lines changed

images/chromium-headless/image/wrapper.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ fi
4444
export HOSTNAME="${HOSTNAME:-kernel-vm}"
4545

4646
# if CHROMIUM_FLAGS is not set, default to the flags used in playwright_stealth
47+
# NOTE: --disable-background-networking was intentionally removed because it prevents
48+
# Chrome from fetching extensions via ExtensionInstallForcelist enterprise policy.
49+
# Enterprise extensions require Chrome to make HTTP requests to fetch update.xml and .crx files.
4750
if [ -z "${CHROMIUM_FLAGS:-}" ]; then
4851
CHROMIUM_FLAGS="--accept-lang=en-US,en \
4952
--allow-pre-commit-input \
5053
--blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 \
5154
--crash-dumps-dir=/tmp/chromium-dumps \
5255
--disable-back-forward-cache \
53-
--disable-background-networking \
5456
--disable-background-timer-throttling \
5557
--disable-backgrounding-occluded-windows \
5658
--disable-blink-features=AutomationControlled \

server/cmd/api/api/chromium.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,14 @@ func (s *ApiService) UploadExtensionsAndRestart(ctx context.Context, request oap
260260

261261
// Build flags overlay file in /chromium/flags, merging with existing flags
262262
// Only add --load-extension flags for extensions that don't use policy installation
263+
// NOTE: We intentionally do NOT use --disable-extensions-except here because it causes
264+
// Chrome to disable external providers (including the policy loader), which prevents
265+
// enterprise policy extensions (ExtensionInstallForcelist) from being fetched and installed.
266+
// See Chromium source: extension_service.cc - external providers are only created when
267+
// extensions_enabled() returns true, which is false when --disable-extensions-except is used.
263268
var newTokens []string
264269
if len(pathsNeedingFlags) > 0 {
265270
newTokens = []string{
266-
fmt.Sprintf("--disable-extensions-except=%s", strings.Join(pathsNeedingFlags, ",")),
267271
fmt.Sprintf("--load-extension=%s", strings.Join(pathsNeedingFlags, ",")),
268272
}
269273
}

0 commit comments

Comments
 (0)