Improve Azure DevOps authentication diagnostics - #10999
Conversation
Stop following Azure DevOps authentication redirects and report actionable guidance for unavailable fork-build tokens. Reject successful HTML responses with status and content-type details instead of surfacing JSON parse failures. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Recognize unauthorized and browser opaque redirect responses, while preserving WASI compatibility when configuring redirect behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
✅ 22/22 dimensions clean — no findings.
Highlights:
- Resource disposal is correctly handled in both the HTML-content and auth-failure paths (explicit
response.Dispose()before throw in the HTML path;finallyblock covers the auth path). OperatingSystem.IsWasi()has a polyfill insrc/Polyfills/OperatingSystem.cs, sonetstandard2.0builds compile fine..resxentries use proper{Locked}markers with sufficient context;.xlffiles appear build-generated.- New tests cover
401,302, opaque-redirect, and HTML-response scenarios with correct assertions.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Throwing for successful HTML publish responses can requeue accepted batches and create duplicate Azure DevOps result rows.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsClient.Http.cs — This check also runs for PublishTestResultsWithSubResultsAsync, where throwing marks the batch as… |
What changed in this PR
Improves Azure DevOps authentication diagnostics while preserving browser/WASI compatibility.
Changes:
- Disables supported automatic redirects and diagnoses authentication redirects.
- Reports unexpected successful HTML responses with status/content type.
- Adds localized resources and regression tests.
| File | Description |
|---|---|
AzureDevOpsTestResultsClient.Http.cs |
Adds redirect and response diagnostics. |
AzureDevOpsResources.resx |
Adds diagnostic messages. |
AzureDevOpsResources.cs.xlf |
Updates Czech localization. |
AzureDevOpsResources.de.xlf |
Updates German localization. |
AzureDevOpsResources.es.xlf |
Updates Spanish localization. |
AzureDevOpsResources.fr.xlf |
Updates French localization. |
AzureDevOpsResources.it.xlf |
Updates Italian localization. |
AzureDevOpsResources.ja.xlf |
Updates Japanese localization. |
AzureDevOpsResources.ko.xlf |
Updates Korean localization. |
AzureDevOpsResources.pl.xlf |
Updates Polish localization. |
AzureDevOpsResources.pt-BR.xlf |
Updates Brazilian Portuguese localization. |
AzureDevOpsResources.ru.xlf |
Updates Russian localization. |
AzureDevOpsResources.tr.xlf |
Updates Turkish localization. |
AzureDevOpsResources.zh-Hans.xlf |
Updates Simplified Chinese localization. |
AzureDevOpsResources.zh-Hant.xlf |
Updates Traditional Chinese localization. |
AzureDevOpsTestResultsClientHandlerTests.cs |
Verifies redirects are disabled. |
AzureDevOpsLivePublishingTests.cs |
Covers authentication and HTML diagnostics. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
🧪 Expert test review — PR #10999
This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Re-run with
|
Log unexpected successful HTML responses without retrying non-idempotent result publishing, while retaining exceptions for other request paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🧪 Expert test review — PR #10999
Together these four new tests give solid coverage of This advisory comment was generated automatically. Grades are heuristic
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
A logger failure after an accepted publish can still cause the batch to be retried and duplicated.
Review tier: Balanced
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsClient.Http.cs — This check also runs for PublishTestResultsWithSubResultsAsync, where throwing marks the batch as… View resolved comment |
Suppressed comments (1)
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsClient.Http.cs:123
- On this non-idempotent POST path, a failing logger provider can throw after Azure DevOps has already returned 2xx.
Logger.LogAsyncpropagates provider failures, so the publisher then treats the accepted batch as failed and requeues it, potentially creating duplicate result rows. Make this diagnostic best-effort, as the surrounding publisher'sTryLogWarningalready does; aThrowOnLogregression case would also protect this guarantee.
await _logger.LogWarningAsync(diagnostic).ConfigureAwait(false);
Treat the HTML response diagnostic as best-effort so a failing logger cannot requeue a non-idempotent Azure DevOps result batch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
🧪 Expert test review — PR #10999
This advisory comment was generated automatically. Grades are heuristic
|
Make the logger-failure regression test explicitly verify that the non-idempotent Azure DevOps request is not replayed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Direct fork pull request builds to publish from a separate trusted context instead of recommending that secrets be exposed to untrusted fork code. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
🧵 Parallel-safety audit — PR #10999Parallelization — assembly audited:
This PR touches two test files in Changes reviewed:
Findings: A (global-state) No process-global state mutation, shared filesystem path, or resource-lock declaration issue found in the changed lines. All new/modified test bodies operate on per-test instances (handler, HttpClient, client, logger), which is exactly the pattern that stays safe under Advisory only — heuristic, non-blocking. Re-run with
|
🧪 Expert test review — PR #10999No new or modified test methods were identified in the changed regions Re-run with
|
Youssef Fahmy (Youssef1313)
left a comment
There was a problem hiding this comment.
Can you check with Helix folks how does this work for fork PRs where Helix is in a similar situation as MTP extensions?
Correction: my previous reply was incomplete and misleading. I inspected the Helix task implementation but missed Arcade's authoritative security guidance. Evidence:
Conclusion: the Helix task's embedded error text is not a reliable statement of current Arcade security policy and appears stale or narrowly team-specific. This PR now follows the documented safe default: do not expose secrets to untrusted fork code; publish from a separate trusted context or disable live publishing. |
|
/backport to rel/4.4 |
|
Started backporting to rel/4.4: https://github.com/microsoft/testfx/actions/runs/33860538309 |
(backport to rel/4.4) (#11036) Co-authored-by: Amaury Levé <amauryleve@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Summary
SYSTEM_ACCESSTOKENguidance for401,302, and browseropaqueredirectresponsesValidation
build.cmd -projects test\UnitTests\Microsoft.Testing.Extensions.UnitTests\Microsoft.Testing.Extensions.UnitTests.csproj -binaryLognet8.0Fixes #10983