Skip to content

Escape index tooltips and disable unnecessary Markdown command trust - #996

Merged
Tomasz Naumowicz (tnaum-ms) merged 2 commits into
release/0.11.1from
dev/tnaum/tooltips-issue
Oct 12, 2026
Merged

Tomasz Naumowicz (tnaum-ms) merged 2 commits into
release/0.11.1from
dev/tnaum/tooltips-issue

Conversation

@tnaum-ms

@tnaum-ms Tomasz Naumowicz (tnaum-ms) commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Render database-derived tooltip metadata as literal, readable content and remove unnecessary Markdown capabilities (command trust, HTML, theme icons) from index tooltips and operator documentation.

Why and Changes

Index metadata should never become active Markdown. Index tooltips now disable command trust, HTML, and theme icons, escape dynamic text, and delimit inline code and JSON safely, including values that contain backticks or newlines. The database models and stored names are unchanged.

  • escapeMarkdown now also escapes :, so a bare https://… value cannot become a GFM autolink. This applies to every caller of the shared helper.
  • A new shared formatInlineCode helper is used for index keys, the index type badge, and collection shard keys.
  • The Playground hover now uses the shared escapeMarkdown instead of its own copy.
  • Playground operator hover, Collection View operator hover, and completion documentation now disable command trust. Their HTTP(S) documentation links don't need it, so the authored Markdown, documentation HTML, link callbacks, and completion acceptance commands are kept.

Validation

Full pre-review (Case 2) checks passed on 2026-10-09:

  • npm run prettier-fix
  • npm run lint
  • Full Jest: 291 suites, 4,590 passed, 1 skipped (the jsdom-only renderer test)
  • npm run build
  • npm run package

npm run l10n was not needed because no localized strings changed.

The renderer test was also run separately under jsdom with real Monaco, and all 19 hover tests passed. The operator manually confirmed that Collection View and Playground hovers and completion details, with their clickable HTTPS documentation links, the index tooltip, and database-field hovers all work as before.

Feature Documentation

Target milestone: 0.11.1.

@tnaum-ms Tomasz Naumowicz (tnaum-ms) added this to the 0.11.1 milestone Oct 9, 2026
… trust

Render index and shard-key metadata as literal text and safe code spans, and turn off
command trust, HTML, and theme icons where tooltips do not need them. Operator
documentation keeps its HTTP(S) links and HTML setting without command trust.

Co-authored-by: Copilot <[email protected]>
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) marked this pull request as ready for review October 9, 2026 14:44
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) requested a review from a team as a code owner October 9, 2026 14:44
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ Code Quality Checks

Check Status How to fix
Localization (l10n) ✅ Passed
ESLint ✅ Passed
Prettier formatting ✅ Passed

This comment is updated automatically on each push.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

📦 Build Size Report

Metric Base (main) PR Delta
VSIX (vscode-documentdb-0.11.0.vsix) 9.15 MB 9.16 MB ⬆️ +10 KB (+0.1%)
Webview bundle (views.js) 6.19 MB 6.19 MB ⬆️ +0 KB (+0.0%)

Download artifact · updated automatically on each push.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The least-privilege Markdown changes are consistent, comprehensively tested, and have no identified unresolved defects.

0 open findings

What changed in this PR

Secures Markdown tooltips by escaping database-derived content and removing unnecessary command trust.

Changes:

  • Adds safe prose and inline-code formatting helpers.
  • Hardens index, collection, hover, and completion Markdown.
  • Adds regression tests and documents the escaping policy.

Case 2 applies; the PR reports all applicable checks passed.

File Description
src/​webviews/​utils/​escapeMarkdown.ts Adds URL and inline-code escaping.
src/​webviews/​utils/​escapeMarkdown.test.ts Tests escaping helpers.
src/​webviews/​query-language-support/​documentdbQueryHoverProvider.ts Disables hover command trust.
src/​webviews/​query-language-support/​documentdbQueryHoverProvider.test.ts Tests safe link rendering.
src/​webviews/​query-language-support/​documentdbQueryCompletionProvider.test.ts Verifies untrusted completion docs.
src/​webviews/​query-language-support/​completions/​mapCompletionItems.ts Disables completion command trust.
src/​tree/​documentdb/​IndexItem.ts Hardens index tooltip rendering.
src/​tree/​documentdb/​IndexItem.test.ts Adds tooltip security regressions.
src/​tree/​documentdb/​CollectionItem.ts Safely formats shard keys.
src/​tree/​documentdb/​CollectionItem.test.ts Tests backtick-containing shard keys.
src/​plugins/​service-atlas-mongodb/​discovery-tree/​AtlasProjectItem.test.ts Updates colon-escaping expectations.
src/​documentdb/​query-language/​playground-completions/​tdd/​hoverAndEdgeCases.test.ts Tests Playground Markdown policy.
src/​documentdb/​query-language/​playground-completions/​PlaygroundHoverProvider.ts Shares escaping and disables trust.
docs/​ai-and-plans/​README.md Registers the escaping feature.
docs/​ai-and-plans/​features/​escaping/​README.md Documents active escaping policy.
docs/​ai-and-plans/​features/​escaping/​iterations/​01-markdown-tooltips.md Records implementation and validation.
docs/​ai-and-plans/​features/​escaping/​iterations/​01-markdown-tooltips-review.md Records review outcomes.
docs/​ai-and-plans/​features/​completions-and-schema/​README.md Updates completion Markdown policy.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tnaum-ms
Tomasz Naumowicz (tnaum-ms) merged commit 25d329c into release/0.11.1 Oct 12, 2026
9 checks passed
@tnaum-ms
Tomasz Naumowicz (tnaum-ms) deleted the dev/tnaum/tooltips-issue branch October 12, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants