You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: resolve dashboard token auth, health seeding, and MTP dotnet test runner - #689
Fix dashboard client/server lifecycle handling, standalone azd app health probes, Windows environment parsing, and .NETMicrosoft.Testing.Platform test execution:
Dashboard client & server: Read the owner-only ~/.azd/azd-app/<hash>/session-token and per-project port file in dashboard.NewClient instead of calling the removed /api/session-token endpoint; bind dashboard TCP listeners synchronously (net.Listen + Serve) before publishing port/token discovery files or marking the server started; preserve azure.yaml fallback in azd app info --json when dashboard RPCs fail; avoid falling back to stale port files in waitForDashboardURL when a dashboard.Server instance is present.
Health checks & registry scoping: Seed live service PIDs, ports, statuses, and build/task exit codes from the running dashboard in azd app health (including --stream refreshes); populate HTTP probe URLs from healthcheck.path in azure.yaml; skip registry updates for unregistered services without warnings; scope orchestrator registry lookups to projectDir instead of os.Getwd().
Environment & .NET testing: Ignore empty-key environment entries (such as Windows hidden per-drive =C:=... working-directory entries) in service and serviceinfo; detect Microsoft.Testing.Platform in DotnetTestRunner (omitting VSTest-only --logger/--collect flags and parsing succeeded:/total: summary lines).
Validation
gofmt -w -s . & go vet ./... (cli/) — passed
go test -short ./src/cmd/app/commands/... ./src/internal/dashboard/... ./src/internal/healthcheck/... ./src/internal/service/... ./src/internal/serviceinfo/... ./src/internal/testing/... ./src/internal/docsgate/... — passed
go run ./src/cmd/app metadata | go run ./src/cmd/docsgate --repo-root .. --changed-files <changed-files> — passed (Docs gate passed. 35 command(s) documented.)
…t runner
- Read owner-only session-token and port files in dashboard.NewClient and preserve JSON fallback in azd app info
- Bind dashboard listeners synchronously before writing port/token files or marking the server started, and avoid stale port-file fallback in waitForDashboardURL
- Seed live service state and build/task exit codes from the running dashboard in azd app health, honor healthcheck.path in azure.yaml, and skip unregistered-service registry warnings
- Scope service orchestration registry lookups to projectDir instead of os.Getwd()
- Skip empty-key Windows drive-CWD environment entries (=C:=...) during environment resolution
- Support Microsoft.Testing.Platform runner options and summary parsing in DotnetTestRunner
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved health-status and exit-code handling errors can misreport services, while .NET runner configuration and argument bugs can bypass test filters or break test and coverage execution.
- Normalize stopped services back to "stopped" and round-trip rawStatus, exitCode, and endTime through ServicesService metadata so standalone health checks preserve terminal results
- Distinguish native .NET 10 global.json MTP (--project and direct extension args) from MSBuild TestingPlatformDotnetTestSupport (-- separator forwarding)
- Inspect only the selected first test project for MTP detection and follow .NET nearest-global.json resolution to the filesystem root
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Review 5868841546 (concern:2ce14d8b702493c2): Fixed in db974c6 — preserved stopped/terminal statuses and exact exit codes across the ServicesService RPC round trip, and separated native .NET 10 MTP (--project) from MSBuild MTP (-- forwarding).
Review 5869244420 — Parse active MTP properties instead of raw XML substrings (concern:30d4e489029ef713, concern:1436971efce11ce9): Fixed in fb21eac — parsed active <PropertyGroup> XML elements with encoding/xml, used explicit 127.0.0.1 loopback in dashboard.newClientForPort, and started global.json discovery from r.projectDir.
Review 5869458175 — Port discovery trusts attacker-controlled shared-temp files (concern:451b0852ca883aee), global.json comments cause incorrect test-runner detection (concern:ea5dac5afdfd7a0e), and MTP detection ignores imported MSBuild properties (concern:c59de0be93d5d7c0, concern:18581243763de166): Fixed in ac8b4ba and f09b19b — stored the dashboard port file inside the owner-only 0o700~/.azd/azd-app/<hash>/ state directory (failing closed on persistence error), stripped JSONC comments/trailing commas when parsing global.json, and evaluated ancestor Directory.Build.props plus explicit <Import> files.
Review 5869724243 (concern:622bc36e9703d90b): Fixed in 1c46c85 — probed the exact Directory.Build.props filename via os.Stat so discovery follows filesystem case-sensitivity rules.
Review 5869955864 — Needs a closer look (concern:15ad267d58202049): Assessed on 1c46c85 (no code change needed) — conditioned MSBuild <PropertyGroup>/<Import>/property elements are intentionally skipped during static XML discovery to avoid false-positive -- forwarding when MSBuild expressions cannot be evaluated statically; healthcheck.path only populates default HTTP endpoint URLs when test is unset (type: none already sets test: ["NONE"]); and --stream refreshes active/stopped dashboard entries each tick while HealthChecker + updateRegistry probe live port/PID state directly if the dashboard exits.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The dashboard client can leak its session token to a separate IPv6 localhost listener, while configuration-discovery and XML-parsing flaws can select incompatible .NET test-runner arguments.
Parse active MTP properties instead of raw XML substrings
cli/src/internal/testing/dotnet_runner.go:220
Raw substring matching treats commented-out MTP opt-ins as active and misses valid values with whitespace before true. This selects the wrong runner branch, sending MTP arguments to VSTest or unsupported VSTest flags to MTP. Read active XML property values (or evaluated MSBuild properties) and add regression cases for comments and whitespace.
…overy
- Target explicit 127.0.0.1 loopback in dashboard.newClientForPort to match server listener binding
- Resolve global.json starting from DotnetTestRunner.projectDir to match dotnet CLI invocation CWD
- Parse active XML PropertyGroup elements for MTP opt-in properties, ignoring comments and trimming whitespace
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Dashboard discovery can leak live authentication tokens to a local attacker, while .NET runner detection misclassifies valid configurations using imported MSBuild properties or commented global.json files.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Port discovery trusts attacker-controlled shared-temp files
cli/src/internal/dashboard/client.go:71
On systems with a shared temporary directory, another local user can observe the nonce-bearing port filename and recreate it with their own listener's port after shutdown; the next dashboard startup ignores the failed overwrite but still publishes its live token. This client then sends that token to the attacker-controlled listener, exposing authenticated dashboard access and allowing forged RPC responses. Store and read the port alongside the token in the owner-only project state directory, and fail closed if trusted discovery state cannot be published.
global.json comments cause incorrect test-runner detection
cli/src/internal/testing/dotnet_runner.go:198
global.json supports JSON comments, but json.Unmarshal rejects them. A valid .NET 10 file with a comment and test.runner = Microsoft.Testing.Platform therefore returns false here; without a project-level override, buildTestCommand emits VSTest arguments (including a positional project) that the native MTP runner rejects. Parse the file with the SDK's comment support and add a commented-file regression case.
MTP detection ignores imported MSBuild properties
cli/src/internal/testing/dotnet_runner.go:217
projectEnablesMTP only reads the selected project file, so an MSBuild-MTP project that enables TestingPlatformDotnetTestSupport in Directory.Build.props or an imported .props file is incorrectly classified as VSTest. dotnet test evaluates those imports and runs MTP, but this runner then emits VSTest coverage/logger options and puts the filter before the required separator, so requested coverage and filtering are not forwarded correctly. Determine the mode from evaluated MSBuild properties, including imported/SDK defaults, and add an imported-property regression case.
…rops MTP config
- Move dashboard port discovery file from os.TempDir() into the 0o700 ~/.azd/azd-app/<hash> state directory and fail closed if port or token persistence fails
- Strip JSONC comments and trailing commas before unmarshaling global.json in DotnetTestRunner
- Evaluate ancestor Directory.Build.props and explicit MSBuild <Import> files when detecting MTP opt-in properties
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Case-insensitive matching of Directory.Build.props can select an unused file on case-sensitive filesystems, causing the wrong test runner and incompatible filtering or coverage arguments.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to evaluate omitted moderate findings affecting conditional .NET runner detection, TCP health-check behavior, and stale service state during streaming refreshes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Thank you for your contribution!
Description
Fix dashboard client/server lifecycle handling, standalone
azd app healthprobes, Windows environment parsing, and.NETMicrosoft.Testing.Platformtest execution:~/.azd/azd-app/<hash>/session-tokenand per-project port file indashboard.NewClientinstead of calling the removed/api/session-tokenendpoint; bind dashboard TCP listeners synchronously (net.Listen+Serve) before publishing port/token discovery files or marking the server started; preserveazure.yamlfallback inazd app info --jsonwhen dashboard RPCs fail; avoid falling back to stale port files inwaitForDashboardURLwhen adashboard.Serverinstance is present.azd app health(including--streamrefreshes); populate HTTP probe URLs fromhealthcheck.pathinazure.yaml; skip registry updates for unregistered services without warnings; scope orchestrator registry lookups toprojectDirinstead ofos.Getwd()..NETtesting: Ignore empty-key environment entries (such as Windows hidden per-drive=C:=...working-directory entries) inserviceandserviceinfo; detectMicrosoft.Testing.PlatforminDotnetTestRunner(omitting VSTest-only--logger/--collectflags and parsingsucceeded:/total:summary lines).Validation
gofmt -w -s .&go vet ./...(cli/) — passedgo test -short ./src/cmd/app/commands/... ./src/internal/dashboard/... ./src/internal/healthcheck/... ./src/internal/service/... ./src/internal/serviceinfo/... ./src/internal/testing/... ./src/internal/docsgate/...— passedgo run ./src/cmd/app metadata | go run ./src/cmd/docsgate --repo-root .. --changed-files <changed-files>— passed (Docs gate passed. 35 command(s) documented.)Related issues: None.
Checklist