Repository navigation
Don't register as system proxy or install root cert by default in CI - #2093
Conversation
When the CI environment variable is set, asSystemProxy and installCert default to false unless set explicitly in the config file or on the command line. Dev Proxy logs the effective values and how to override them at startup. Closes dotnet#2059 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the CI-specific proxy and certificate default changes.
No open issues 🎉
What changed in this PR
This PR makes Dev Proxy safer in CI by defaulting system proxy registration and root certificate installation to off when CI is set, while preserving explicit configuration and command-line overrides.
Changes:
- Apply and track CI-specific defaults for
asSystemProxyandinstallCert. - Log when CI defaults remain active and validate certificate options against effective configuration values.
- Add unit tests and update configuration and CI/CD guidance.
| File | Description |
|---|---|
skills/dev-proxy/references/configuration.md |
Document CI-dependent defaults for proxy registration and certificate installation. |
skills/dev-proxy/references/ci-cd-integration.md |
Explain CI defaults, overrides, and explicit proxy setup. |
DevProxy/Proxy/ProxyConfiguration.cs |
Apply CI defaults to settings omitted from configuration and track them. |
DevProxy/Commands/DevProxyCommand.cs |
Use effective configuration during validation and log active CI defaults. |
DevProxy.Tests/ProxyConfigurationCiDefaultsTests.cs |
Test defaults, configuration overrides, and logging conditions. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: dotnet/dev-proxy#2093
- Tested commit:
b27861e9b01f108583c8367c79c830d537728100 - Environment: macOS 27.2.1, arm64, .NET SDK 10.0.103; source-built application and matching plugins.
Runtime setup: isolated .devproxy/pr2093-functional fixtures, HOME and CFFIXED_USER_HOME, unique DEV_PROXY_CERT_PATH, schema validation and update checks disabled, noFirstRun: true, and a local MockResponsePlugin fixture. Every actual proxy launch used dotnet run --no-build --no-launch-profile --project DevProxy -- --detach --as-system-proxy false --port 0 --api-port 0 --config-file <fixture> --output json. Neither system proxy registration nor certificate trust installation was activated.
Each runtime case checked the recorded PID, PID-scoped status, a direct authenticated GET /proxy, and curl --noproxy "" --proxy <assigned-proxy-url> http://pr2093.test/ci-defaults. The mock had to return HTTP 200, X-PR2093: isolated, and {"pr":2093,"mock":true}.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
| Locked restore and application/plugin builds | Build matching PR assemblies without changing dependencies | Both builds succeeded, 0 warnings/errors. Initial missing-assets and missing-plugin setup errors were resolved by locked restores and building the plugin project. | PASS |
Inherited CI=true, config omits both settings |
Effective installCert=false; one explanatory CI-default line; working API and proxy |
Exactly one line reported asSystemProxy: false, installCert: false; authenticated API and mock both HTTP 200 |
PASS |
Config env: {"CI":"true"}, inherited CI absent |
Config-provided CI affects defaults before startup | Same effective values, exactly one CI-default line, API/mock HTTP 200 | PASS |
--env CI=true, inherited CI absent |
CLI-provided CI affects defaults before startup | Same effective values, exactly one CI-default line, API/mock HTTP 200 | PASS |
Inherited CI=false |
Presence, not Boolean parsing, enables CI defaults | Exactly one false/false CI-default line; API/mock HTTP 200 | PASS |
CI with explicit config asSystemProxy:false, installCert:false |
Explicit config suppresses default-applied notice | No CI-default line; PID-scoped system proxy false; API/mock HTTP 200 | PASS |
| CI with config values both true and CLI values both false | CLI overrides config; no default-applied notice | Started safely with system proxy false; no CI-default line; API/mock HTTP 200 | PASS |
| CI absent, CLI values both false | Adjacent non-CI startup still works without CI notice | No CI-default line; API/mock HTTP 200 | PASS |
Parser-only: CI, --install-cert false, no system-proxy override |
CI's effective system-proxy false permits this combination | No system-proxy requirement diagnostic | PASS |
Parser-only: non-CI, --install-cert false, no system-proxy override |
Existing system-proxy true default rejects this combination | Requires option '--as-system-proxy' to be 'false' |
PASS |
Parser-only: non-CI, config system-proxy false, --install-cert false |
Config false permits this combination without a CLI system-proxy override | No system-proxy requirement diagnostic | PASS |
Parser-only: CI, config system-proxy true, --install-cert false |
Explicit config true survives CI defaulting and rejects the combination | Expected system-proxy requirement diagnostic | PASS |
Parser-only: CI, CLI --as-system-proxy true --install-cert false |
Explicit CLI true survives CI defaulting and rejects the combination | Expected system-proxy requirement diagnostic | PASS |
| Current-head automated validation | Successful tests on tested SHA | CI run reports the exact tested head, successful build/unit tests, and all four test-project steps successful on macOS, Ubuntu, and Windows. Automated suites were not rerun locally. | PASS |
Parser-only commands included --config-file <fixture> --port 0 --api-port 0 --install-cert false --pr2093-parse-only, plus the case-specific override. The deliberately unknown final option guaranteed exit 2 before any proxy started. All five cases reported this guard; the system-proxy validation diagnostic appeared only in the three expected rejection cases. Thus the omitted asSystemProxy default was checked without an unsafe no-override launch.
Requested changes
None.
Outcome
Approve for functional testing of this commit; this does not replace code review. Seven detached runtime scenarios and five parser-boundary scenarios passed. Actual OS-level true overrides were intentionally not activated; effective default/override behavior was checked through startup output, parser diagnostics, safe CLI overrides, and the current-head CI tests.
All seven runtime PIDs were gracefully stopped individually and verified absent. Their log files and this run's temporary fixtures/certificate were removed; no other running instance was stopped and no source, dependency lock file, or PR description was changed. The PR remained open, non-draft, and at the tested SHA immediately before publication.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: dotnet/dev-proxy#2093
- Tested commit:
2f86217ae4e8f45efdfaf6f04aa80cd772be5c20 - Environment: macOS 27.2.1 arm64, .NET SDK 10.0.103, freshly rebuilt application and matching plugin assemblies.
Reran on the current upstream head after the main-branch merges, including the updated CI-aware option help. All nine runtime instances used dotnet run --no-build --no-launch-profile --project DevProxy -- --detach --as-system-proxy false --port 0 --api-port 0 --config-file <fixture> --output json, an isolated HOME and CFFIXED_USER_HOME with Library/Application Support pre-created, and a unique DEV_PROXY_CERT_PATH. Fixtures disabled schema network validation, version notifications, and first-run trust.
Every runtime case required the recorded PID to be alive, PID-scoped status to report apiStatus: available and asSystemProxy: false, direct authenticated GET /proxy to return HTTP 200, and an explicitly proxied mock request to return HTTP 200, X-PR2093: isolated, and {"pr":2093,"mock":true}. State, credential, and log paths were asserted to be under the owned fixture home.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
| Locked restore, application build, plugin build | Matching source build, no lock-file edits | Both builds succeeded with 0 warnings and 0 errors; tracked checkout unchanged | PASS |
Inherited CI=true, config omits both settings |
One false/false CI-default notice; working API/proxy | Exactly one expected notice; API and mock HTTP 200 | PASS |
Config env: {"CI":"true"}, inherited CI absent |
Config-provided CI affects defaults | Exactly one false/false notice; API/mock HTTP 200 | PASS |
--env CI=true, inherited CI absent |
CLI-provided CI affects defaults | Exactly one false/false notice; API/mock HTTP 200 | PASS |
Inherited CI=false |
CI presence still enables defaults | Exactly one false/false notice; API/mock HTTP 200 | PASS |
| CI with explicit config values both false | Config overrides default tracking; no notice | No CI-default notice; API/mock HTTP 200 | PASS |
| CI with config values both true and CLI values both false | CLI overrides configuration safely; no notice | System proxy false, no CI-default notice; API/mock HTTP 200 | PASS |
| CI absent, CLI values both false | Existing non-CI startup preserved | No CI-default notice; API/mock HTTP 200 | PASS |
CI, only asSystemProxy:false in config |
Remaining install-cert default produces notice | Exactly one false/false notice; API/mock HTTP 200 | PASS |
CI, only installCert:false in config, system-proxy CLI false |
Explicit config plus CLI suppress default notice | No CI-default notice; API/mock HTTP 200 | PASS |
Parser: CI, --install-cert false, no system-proxy override |
Effective CI system-proxy false permits combination | No system-proxy requirement diagnostic | PASS |
Parser: non-CI, --install-cert false, no system-proxy override |
Existing system-proxy true default rejects combination | Expected system-proxy requirement diagnostic | PASS |
| Parser: non-CI, config system-proxy false | Config false permits --install-cert false |
No system-proxy requirement diagnostic | PASS |
| Parser: CI, config system-proxy true | Explicit true survives CI defaulting | Expected system-proxy requirement diagnostic | PASS |
| Parser: CI, CLI system-proxy true | Explicit CLI true survives CI defaulting | Expected system-proxy requirement diagnostic | PASS |
--help with CI present and absent |
Both options describe conditional defaults | Both help invocations exit 0 and contain (default: true, false when CI is set) for both options |
PASS |
| Current-head automated validation | Successful tests at tested SHA | CI run confirms tested SHA, successful build, and all four test-project steps successful on Windows, macOS, and Ubuntu; automated suites not rerun locally | PASS |
Parser-only invocations used --config-file <fixture> --port 0 --api-port 0 --install-cert false --pr2093-parse-only, plus each case's override. The deliberately unknown guard option ensured all five exited 2 before a proxy could start; the system-proxy requirement diagnostic appeared only in the three expected rejection cases. These checks cover the omitted-system-proxy defaults without an unsafe no-override launch.
Requested changes
None.
Outcome
Approve for functional testing of this commit; not a substitute for code review. Nine runtime scenarios, five parser boundaries, and two help-output checks passed, with no blockers or reproduced regressions. Actual OS-level true overrides were intentionally not activated; precedence was verified through parser diagnostics, safe CLI overrides, startup output, and exact-head CI.
All nine owned PIDs were gracefully stopped individually and verified absent. Their state, credentials, and logs were removed by shutdown or targeted cleanup; the owned fixture home, certificate, and configurations were removed. The checkout is clean, no source changes or commits were made, and no other instance was stopped. The PR remained open, non-draft, and at the tested SHA immediately before publication.
Restores CRLF line endings in DevProxyCommand.cs lost in the previous merge. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: dotnet/dev-proxy#2093
- Tested commit:
964c21324cccfa701ad11a405d498f865a22fea0 - Environment: macOS 27.2.1 arm64, .NET SDK 10.0.103, application and matching plugins rebuilt from this head.
Latest-head retest after the additional upstream merges. Every runtime launch used dotnet run --no-build --no-launch-profile --project DevProxy -- --detach --as-system-proxy false --port 0 --api-port 0 --config-file <fixture> --output json. Tests used an owned .devproxy/pr2093-20261127 fixture directory, isolated HOME and CFFIXED_USER_HOME, pre-created Library/Application Support, and a unique DEV_PROXY_CERT_PATH. Schema network checks and version notifications were disabled, noFirstRun was true, and reportsFolder: "reports" was included to check startup compatibility with the merged reports-folder configuration.
Each of the nine runtime cases checked the recorded PID, isolated PID state/token/log paths, PID-scoped status reporting apiStatus: available and asSystemProxy: false, a direct authenticated GET /proxy returning HTTP 200, and curl --noproxy "" --proxy <assigned-url> http://pr2093.test/ci-defaults returning HTTP 200, X-PR2093: isolated, and {"pr":2093,"mock":true}.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
| Locked restores and application/plugin builds | Matching assemblies; no dependency edits | Both builds succeeded with 0 warnings/errors; lock files unchanged | PASS |
Inherited CI=true, omitted config settings |
One notice reporting effective false/false; working API/proxy | Exactly one expected notice; API/mock HTTP 200 | PASS |
Config env: {"CI":"true"}, inherited CI absent |
Config-provided CI affects startup defaults | Expected false/false notice; API/mock HTTP 200 | PASS |
CLI --env CI=true, inherited CI absent |
CLI-provided CI affects startup defaults | Expected false/false notice; API/mock HTTP 200 | PASS |
Inherited CI=false |
Presence, not Boolean interpretation, enables CI defaults | Expected false/false notice; API/mock HTTP 200 | PASS |
| CI, explicit config values both false | Explicit config suppresses default-applied notice | No CI notice; API/mock HTTP 200 | PASS |
| CI, config values both true, CLI values both false | CLI wins safely; no default notice | System proxy false; no CI notice; API/mock HTTP 200 | PASS |
| CI absent, CLI values both false | Non-CI startup preserved | No CI notice; API/mock HTTP 200 | PASS |
CI, only config asSystemProxy:false |
Remaining install-cert default produces notice | One false/false notice; API/mock HTTP 200 | PASS |
CI, only config installCert:false, CLI system-proxy false |
Explicit config and CLI suppress default notice | No CI notice; API/mock HTTP 200 | PASS |
Parser: CI, --install-cert false, no system-proxy override |
Effective default false permits combination | No system-proxy requirement diagnostic | PASS |
Parser: non-CI, --install-cert false, no system-proxy override |
Existing default true rejects combination | Expected system-proxy requirement diagnostic | PASS |
| Parser: non-CI, config system-proxy false | Config permits install-cert false | No system-proxy requirement diagnostic | PASS |
| Parser: CI, config system-proxy true | Explicit config true survives CI defaults | Expected system-proxy requirement diagnostic | PASS |
| Parser: CI, CLI system-proxy true | Explicit CLI true survives CI defaults | Expected system-proxy requirement diagnostic | PASS |
JSON parser: CI-default accepted combination, --output json --log-level None |
Exit 2 for guard only; valid JSONL error records | Parsed error records; no system-proxy requirement diagnostic | PASS |
| JSON parser: CLI system-proxy true/install-cert false, same output flags | Exit 2; valid JSONL includes validation failure | Decoded error message contains expected system-proxy requirement | PASS |
| Help with CI present and absent | Both options describe conditional defaults | Both exit 0 and document (default: true, false when CI is set) for both options |
PASS |
| Exact-head CI | Required automated validation passes | CI run confirms this SHA and successful build plus all four test projects on Ubuntu, Windows, and macOS | PASS |
Parser commands included --config-file <fixture> --port 0 --api-port 0 --install-cert false --pr2093-parse-only plus case-specific flags. The deliberately unknown guard option prevented any daemon or proxy from starting and required exit 2 in every case. All five text cases and both JSON cases showed precisely the expected presence/absence of the system-proxy validation diagnostic. This tests omitted system-proxy defaults without an unsafe launch.
The first JSON rejection assertion searched raw escaped JSON and incorrectly marked the expected message absent. After correcting the test harness to inspect decoded message values, both JSON cases passed on rerun; no product change was needed. Automated suites were not rerun locally: current-head CI passed, including DevProxy.Tests, notwithstanding the older failure mentioned in the PR description.
Requested changes
None.
Outcome
Approve for functional testing of this commit; not a substitute for code review. Nine runtime cases, five text parser boundaries, two JSON parser boundaries, and two help invocations passed. No reproduced product defects or blockers. Actual OS-level true overrides were deliberately not activated; precedence was checked using guarded parser diagnostics, safe false overrides, startup logs, and exact-head CI.
All nine owned PIDs were gracefully stopped individually and verified absent. Owned state, credentials, logs, fixtures, and certificates were cleaned up; the checkout is clean. No other instances were stopped, and no fixes, commits, pushes, merges, or PR-description edits were made. The PR remained open, non-draft, and at the tested SHA immediately before publication.

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
02594c85688c3933c950d6d951da562163f3394a↑ Abstractions, Kestrel and Integration tests pass locally; DevProxy.Tests passes except one test.
↓
Get_ProxyStatusResponse_ListsAllProxyInfoPropertiesfails locally, but it fails on upstream main too.↓ CI-default behavior not exercised end-to-end on a real CI runner.
↓ PR CI checks for this revision not yet inspected.
When the
CIenvironment variable is set, Dev Proxy no longer registers itself as the system proxy or installs/trusts its root certificate by default. Explicit values in the config file (asSystemProxy,installCert) or on the command line (--as-system-proxy,--install-cert) still win.CIset via the configenvsection or--envis honored too.At startup, Dev Proxy logs one line when a CI default was applied:
Changes:
ProxyConfiguration: after binding the config file, apply CI defaults for keys the config file doesn't set, and track which were defaulted.DevProxyCommand: log the line above unless both values were set on the command line. The--install-certvalidator now falls back to the effective config values instead of hard-codedtrue, so--install-cert falsein CI (or withasSystemProxy: falsein the config) no longer needs an explicit--as-system-proxy false.--install-certvalidator (extracted toCreateInstallCertOption).Release note: behavior change for CI pipelines that relied on Dev Proxy registering as the system proxy or installing the certificate. Set
asSystemProxy/installCerttotruein the config file or pass--as-system-proxy true/--install-cert trueto keep the old behavior. The public CI/CD overview docs need a matching update.Resolves #2059
Note: #2089 (merged) rewrote the
--as-system-proxy/--install-certoption descriptions. This PR keeps those descriptions and adds "false when CI is set" to the stated default.