Skip to content

Handle AppHost path config guardrails - #16467

Merged
Adam Ratzman (adamint) merged 15 commits into
microsoft:mainfrom
adamint:dev/adamint/issue15490-apphost-path-config
Apr 27, 2026
Merged

Adam Ratzman (adamint) merged 15 commits into
microsoft:mainfrom
adamint:dev/adamint/issue15490-apphost-path-config

Conversation

@adamint

@adamint Adam Ratzman (adamint) commented Apr 25, 2026 •

Copy link
Copy Markdown
Member

Description

Warns when global settings contain an AppHost path, rejects global AppHost path settings and the legacy flat appHostPath key through aspire config set, and hides the legacy flat appHostPath setting from generated settings schemas.

Local aspire.config.json continues to support appHost.path, including when set through aspire config set appHost.path ....

Fixes #15490

Validation:

  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.AppHostPathConfigurationPolicyTests" --filter-class "*.ConfigCommandTests" --filter-class "*.SettingsSchemaBuilderTests" --filter-class "*.ProgramTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ConfigurationServiceTests" --filter-class "*.ConfigurationHelperTests" --filter-class "*.AspireConfigFileTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"
  • dotnet build /t:UpdateXlf src/Aspire.Cli/Aspire.Cli.csproj
  • ./build.sh --build /p:SkipNativeBuild=true
  • CLI smoke checks for blocked global/legacy AppHost path config keys and schema shape
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.SettingsSchemaBuilderTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" after reverting the extension config-info casing changes
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.ConfigCommandTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" after allowing local appHost.path
  • dotnet test --project tests/Aspire.Cli.Tests/Aspire.Cli.Tests.csproj --no-launch-profile -- --filter-class "*.AppHostPathConfigurationPolicyTests" --filter-class "*.SettingsSchemaBuilderTests" --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true"

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?

@github-actions

github-actions Bot commented Apr 25, 2026 •

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 16467

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 16467"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds guardrails around AppHost path configuration so users can’t set it via global CLI settings or aspire config set, while keeping aspire.config.json’s appHost.path valid and updating the VS Code extension to consume the CLI’s camelCase JSON output.

Changes:

  • Add an AppHost path policy and enforce it in config set, plus warn when global settings contain an AppHost path key.
  • Hide legacy appHostPath from generated settings schemas while retaining appHost.path for aspire.config.json.
  • Update VS Code extension config-info types/schema generation to use camelCase JSON fields.

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Aspire.Cli.Tests/ProgramTests.cs Adds tests validating startup warning behavior for global settings containing AppHost path.
tests/Aspire.Cli.Tests/Configuration/AppHostPathConfigurationPolicyTests.cs Adds unit tests for blocked key detection and JSON scanning for AppHost path keys.
tests/Aspire.Cli.Tests/Commands/SettingsSchemaBuilderTests.cs Verifies legacy appHostPath is excluded from settings schemas while config file schema retains appHost.path.
tests/Aspire.Cli.Tests/Commands/ConfigCommandTests.cs Adds tests ensuring config set rejects AppHost path keys but still allows appHost.language.
src/Aspire.Cli/Resources/xlf/ErrorStrings.zh-Hant.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.zh-Hans.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.tr.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.ru.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.pt-BR.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.pl.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.ko.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.ja.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.it.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.fr.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.es.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.de.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/xlf/ErrorStrings.cs.xlf Adds localized string entries for new AppHost path guardrail messages.
src/Aspire.Cli/Resources/ErrorStrings.resx Adds new resource strings for blocking config set AppHost path and warning on global AppHost path.
src/Aspire.Cli/Resources/ErrorStrings.Designer.cs Adds strongly-typed accessors for the new resource strings.
src/Aspire.Cli/Program.cs Adds startup warning when global settings file contains an AppHost path key.
src/Aspire.Cli/Configuration/HiddenFromConfigurationSchemaAttribute.cs Introduces attribute to hide config properties from schema generation.
src/Aspire.Cli/Configuration/AspireJsonConfiguration.cs Marks legacy appHostPath as hidden from generated schemas.
src/Aspire.Cli/Configuration/AppHostPathConfigurationPolicy.cs Adds shared policy logic for detecting/identifying AppHost path config keys.
src/Aspire.Cli/Commands/SettingsSchemaBuilder.cs Skips schema generation for properties marked as hidden.
src/Aspire.Cli/Commands/ConfigCommand.cs Blocks setting AppHost path keys via aspire config set.
extension/src/utils/configInfoProvider.ts Updates logging to use camelCase JSON fields from aspire config info --json.
extension/src/types/configInfo.ts Renames TypeScript types to camelCase to match CLI JSON output.
extension/src/commands/openSettings.ts Uses camelCase fields when opening local/global settings paths.
extension/src/commands/do.ts Uses camelCase capabilities field for CLI capability checks.
extension/scripts/generate-schema.js Updates schema generator to consume camelCase config info output.
extension/schemas/aspire-settings.schema.json Regenerates local settings schema (removes legacy appHostPath; updates feature flags).
extension/schemas/aspire-global-settings.schema.json Regenerates global settings schema (keeps appHostPath excluded; updates feature flags).
extension/schemas/aspire-config.schema.json Regenerates config file schema (includes appHost object shape; updates feature flags).
.gitignore Ignores .worktrees/ directory.
Files not reviewed (1)
  • src/Aspire.Cli/Resources/ErrorStrings.Designer.cs: Language not supported

@adamint
Adam Ratzman (adamint) marked this pull request as draft April 26, 2026 16:22

@adamint Adam Ratzman (adamint) left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 3 issues: 2 correctness issues and 1 test coverage issue.

Comment thread tests/Aspire.Cli.Tests/ProgramTests.cs Resolved
@adamint
Adam Ratzman (adamint) marked this pull request as ready for review April 26, 2026 21:50
@github-actions

Copy link
Copy Markdown
Contributor

Re-running the failed jobs in the CI workflow for this pull request because 1 job was identified as retry-safe transient failures in the CI run attempt.
GitHub was asked to rerun all failed jobs for that attempt, and the rerun is being tracked in the rerun attempt.
The job links below point to the failed attempt jobs that matched the retry-safe transient failure rules.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean PR — 1 minor UX nit on error message ordering in ConfigCommand.SetCommand.ExecuteAsync.

@adamint
Adam Ratzman (adamint) enabled auto-merge (squash) April 27, 2026 15:24
@adamint
Adam Ratzman (adamint) merged commit c036444 into microsoft:main Apr 27, 2026
284 checks passed
@github-actions github-actions Bot added this to the 13.3 milestone Apr 27, 2026
Nell Shamrell-Harrington (nellshamrell) pushed a commit to nellshamrell/aspire that referenced this pull request May 18, 2026
* Ignore local worktrees

Co-authored-by: Copilot <[email protected]>

* Add AppHost path configuration policy

Co-authored-by: Copilot <[email protected]>

* Disallow setting AppHost path via config command

Co-authored-by: Copilot <[email protected]>

* Warn about global AppHost path settings

Co-authored-by: Copilot <[email protected]>

* Hide legacy AppHost path from settings schema

Co-authored-by: Copilot <[email protected]>

* Update AppHost path config validation artifacts

Co-authored-by: Copilot <[email protected]>

* Revert extension config info casing changes

Co-authored-by: Copilot <[email protected]>

* Allow local AppHost path config values

Co-authored-by: Copilot <[email protected]>

* Use constants for AppHost path keys

Co-authored-by: Copilot <[email protected]>

* Handle invalid AppHost path settings files

Co-authored-by: Copilot <[email protected]>

* Deduplicate AppHost path key constants

Co-authored-by: Copilot <[email protected]>

* Show global AppHost path startup notice as warning

Co-authored-by: Copilot <[email protected]>

* Use default text color for AppHost path warning

Co-authored-by: Copilot <[email protected]>

* Fix AppHost path config review feedback

Co-authored-by: Copilot <[email protected]>

* Address apphost path config review feedback

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI should warn when apphost path is set in global settings, disallow setting it via aspire config, and remove that property from the schema

4 participants