Repository navigation
Keep the full URI reachable in the prompt URL confirmation dialog - #332937
Conversation
The label is truncated in the middle, so the host can fall entirely inside the hidden part. Carry the full URI in title and aria-label, as extensionUrlHandler already does since microsoft#239527.
There was a problem hiding this comment.
Pull request overview
Improves URL confirmation dialogs by exposing the full URI while retaining a truncated visible label.
Changes:
- Adds full-URI
titleandaria-labelattributes. - Uses an HTML anchor for consistent interaction.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| private async shouldBlockInstall(promptType: PromptsType, url: URI): Promise<boolean> { | ||
| let uriLabel = url.toString(); | ||
| const uriString = url.toString(); |
| // The label is truncated in the middle, which can hide the real host. Carry the full URI in | ||
| // `title` and `aria-label` so it stays reachable, as `extensionUrlHandler` already does. |
The dialog rendered `url.toString()` while the request is made with the raw `urlString`. `URI.toString()` reserializes, so a URL such as `https://user%[email protected]/file` is displayed as `https://[email protected]%40evil.test/file`, which reads as if the host were `example.com` when the request actually goes to `evil.test`. Pass the string that is actually requested into the confirmation and escape it for the attribute context, so the label, the tooltip and the accessible name all describe the URL that will be fetched.
`allowedMarkdownHtmlAttributes` in markdownRenderer.ts permits `title` but not `aria-label`, and the confirmation dialog renders with the default sanitizer config (dialogHandler.ts passes no `sanitizerConfig`), so the attribute never reaches the DOM. `title` alone supplies the accessible name.
|
Thanks — addressed, and the review caught a real mismatch rather than just a style issue. The dialog and the request disagreed. Escaping. The URL comes from Dropped Verified by reading the sanitizer configuration; I have not run the rendered dialog itself. Separately, |
|
@microsoft-github-policy-service agree |
A local node_modules.nativi-backup/ directory was picked up by the first commit on this branch. It is unrelated to the change and is removed here, so the diff is limited to promptUrlHandler.ts.
The label is attacker-controlled text inside raw HTML: escape it like the title attribute, and escape markdown tokens so underscores in a URL are not rendered as emphasis. Use strings.escape and escapeDoubleQuotes instead of a local replace chain.
|
Martin Aeschlimann (@aeschli) — small fix in the prompt install confirmation: the dialog showed |
The confirmation dialog shown when installing a prompt / instructions / agent file from a URL has two problems that can make it show a host other than the one being requested.
1. The label is truncated in the middle.
The host can end up entirely inside the hidden part. For example
renders as
which reads as a raw.githubusercontent.com URL, while the request goes elsewhere.
2. The dialog shows a different string than the one requested.
shouldBlockInstallrenderedurl.toString(), while the fetch uses the rawurlString.URI.toString()reserializes, sohttps://user%[email protected]/filewas shown ashttps://[email protected]%40evil.test/file: it reads as example.com, while the request goes to evil.test.The change
titleon the link, asextensionUrlHandleralready does for its own dialog (Provide a way to reveal the entire URI in an 'Allow extension to open URI" dialog (fix #239272) #239527).aria-labelis not used becauseallowedMarkdownHtmlAttributesdoes not allow it.strings.escape,escapeDoubleQuotes,escapeMarkdownSyntaxTokens).What was run. The escaping was run on hostile URLs (quotes,
<img>,<b>, underscores): no tag or attribute survives, and the same check without escaping catches them. I have not run the rendered dialog itself.A note on accessibility: since the link has text content, its accessible name is still the truncated label;
titleis exposed as the description. So this helps screen reader users reach the full URL, but it is not a complete accessibility fix.Related to #239272 (the same problem in the extension URI dialog, already fixed there).