Repository navigation
fix(entra): escape Markdown in agent check results - #2774
Conversation
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| # Keep the existing HTML encoding as well: Markdown decodes a raw © or A. | ||
| @{ Shape = 'literal HTML entities'; Text = 'Contoso © A A &'; Escaped = 'Contoso © A A &' } | ||
| ) | ||
| $findingCases = foreach ($check in $checks) { |
| $findingCases = foreach ($check in $checks) { | ||
| foreach ($name in $names) { $check + $name } | ||
| } | ||
| $observationCases = foreach ($check in $checks | Where-Object Id -In 'MT.1207', 'MT.1209', 'MT.1210') { |
Up to standards ✅🟢 Issues
|
The capture only served a renderer check outside the repo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Entire-Checkpoint: 01M73GAEKXR7XGF02CNA7498VS
merill
left a comment
There was a problem hiding this comment.
Thanks @FiraSenax, nice thorough fix, and good call keeping the HtmlEncode before the escape so literal entities survive. Approving.
I pushed one small cleanup: dropped the MarkdownCapturePath param and the capture code from Test-MtEntraAgentMarkdown.Tests.ps1, since it only served the renderer check outside the repo (it also clears the code-scanning alert).
Tenant-controlled values in 14 Agent ID checks are HTML-encoded but still interpreted as Markdown in the report. A display name can become a disguised link, add formatting, or disappear into an image element.
Apply
Get-MtSafeMarkdownat 39 output sites covering names, UPNs, roles, groups, resource names, redirect URIs and descriptions, including passing observation tables. Let the helper handle pipes and line breaks. Retain HTML encoding before Markdown escaping so names containing literal entities such as©keep their original text.Addresses #2711. These are the 14 remaining checks listed there; MT.1260 already adopted the helper in #2710.
Validation on macOS, PowerShell 7.5.2 and Pester 5.7.1:
34e16ef4, 122 fail and 14 pass; all 136 pass with this patch. Cases cover disguised links, images, formatting, bare URLs, www URLs, email addresses, pipes/line breaks and literal HTML entities in findings and custom-role observations.All inputs in the regression and renderer checks are synthetic.
Summary by CodeRabbit
Bug Fixes
Tests