Graph viewer: node names are not escaped

Open
#1,333 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript, vscode

Research direction

Start at the graph viewer entry point in the VS Code extension and reproduce the issue with the QL query shown in the report. Trace how semmle.label values reach Graphviz, then verify that names containing backslashes, such as x\ny, are displayed with literal backslashes rather than interpreted escapes.

Written by the indexing model from the issue text.

Description

bug VSCode

In a graph query being displayed by the graph viewer, when the value for semmle.label contains backslashes, they appear to be interpreted by graphviz, when I would expect them to appear as literal backslashes. Here's an example:

/**
 * @kind graph
 * @id foo
 */
query predicate nodes(string node, string attr, string val) {
  node in ["foo\\bar", "x\\ny", "p\\q\\r\\s"] and
  attr = "semmle.label" and
  val = node
}

query predicate edges(string a, string b, string attr, string val) { none() }

It looks like this:
image

I would expect to see the actual string x\ny rather than x<newline>y.

This affected me when I was using the graph viewer to visualize parsed regexes, which often contain backslashes.

Version

VS Code: 1.66.2
CodeQL extension: 1.6.5

Dominant language
TypeScript
Stars
539
Forks
240
Avg merge
2d 6h
Merged PRs (30d)
29

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/vscode-codeql

All issues in github/vscode-codeql

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.