Skip to content

Handle AppHost path config guardrails#16467

Merged
adamint merged 15 commits intomicrosoft:mainfrom
adamint:dev/adamint/issue15490-apphost-path-config
Apr 27, 2026
Merged

Handle AppHost path config guardrails#16467
adamint merged 15 commits intomicrosoft:mainfrom
adamint:dev/adamint/issue15490-apphost-path-config

Conversation

@adamint
Copy link
Copy Markdown
Member

@adamint adamint commented Apr 25, 2026

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?

adamint and others added 6 commits April 25, 2026 12:47
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 25, 2026

🚀 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"

@adamint adamint marked this pull request as ready for review April 26, 2026 16:03
Copilot AI review requested due to automatic review settings April 26, 2026 16:03
Comment thread extension/schemas/aspire-settings.schema.json
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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

Comment thread src/Aspire.Cli/Configuration/AppHostPathConfigurationPolicy.cs Outdated
adamint and others added 2 commits April 26, 2026 12:12
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
adamint and others added 4 commits April 26, 2026 12:23
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member Author

@adamint adamint left a comment

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 src/Aspire.Cli/Commands/ConfigCommand.cs Outdated
Comment thread src/Aspire.Cli/Configuration/AppHostPathConfigurationPolicy.cs Outdated
Comment thread tests/Aspire.Cli.Tests/ProgramTests.cs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adamint 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

@JamesNK JamesNK left a comment

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.

Comment thread src/Aspire.Cli/Commands/ConfigCommand.cs Outdated
Comment thread src/Aspire.Cli/Commands/ConfigCommand.cs Outdated
Comment thread src/Aspire.Cli/Configuration/AppHostPathConfigurationPolicy.cs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@adamint adamint enabled auto-merge (squash) April 27, 2026 15:24
@adamint 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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