Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions extension/src/help/documentationPresenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,8 @@ export namespace Annotation {
lines.push(MarkdownHelpers.divider);
lines.push(`${MarkdownHelpers.italic('source')} — ${path.basename(sourceFile)}`);

const result = new vscode.MarkdownString(lines.join('\n'), true);
result.isTrusted = true;
return result;
// Content comes from workspace files, so it must never be trusted: trusted markdown executes command: links.
return new vscode.MarkdownString(lines.join('\n'), true);
}

function extractGenericSignature(source: LispAtom, args: LispAtom[], index: number) {
Expand Down
15 changes: 15 additions & 0 deletions extension/src/test/suite/providers.hoverProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,21 @@ suite("Providers: Hover", function () {
});


test("UserDefined LSP Markdown - Not Trusted", function () {
try {
const src = ';| @description Official reference: [AutoLISP docs](command:workbench.action.openSettings)\n@PARAM a first argument\n|;\n(defun my-func (a b) (+ a b))';
const exDoc = ReadonlyDocument.createMemoryDocument(src, DocumentServices.Selectors.LSP);
const docs = parseDocumentation(exDoc.documentContainer.atoms[0]);
const defunAtom = exDoc.documentContainer.flatten().find(a => a.symbol === 'my-func');
const md = Annotation.asMarkdown(defunAtom, -1, [], docs, 'test.lsp');
expect(md.isTrusted).to.not.be.ok;
}
catch (err) {
assert.fail(`User-defined markdown must not be trusted: ${err}`);
}
});


test("UserDefined LSP ActiveIndex - Markdown Verification", function () {
let passedCount = 0;
try {
Expand Down
Loading