vscode-codeql icon indicating copy to clipboard operation
vscode-codeql copied to clipboard

Path viewer shows empty line for `file://` locations

Open hvitved opened this issue 3 years ago • 2 comments

Describe the bug When a @kind path-problem query has a path node whose SARIF "location" is file:/, then the SARIF "message" is ignored, and a completely empty entry is displayed:

image

Example SARIF: interpretedResults.sarif.zip

Version Latest

Expected behavior Render the line with the provided "message", but without a location link.

hvitved avatar May 19 '22 10:05 hvitved

First question I have is why are we getting all of these invalid file locations?

aeisenberg avatar Jun 03 '22 22:06 aeisenberg

I assume the query you are using is this one: ruby/ql/src/queries/security/cwe-1333/PolynomialReDoS.ql. Can you let me know what database you are using?

aeisenberg avatar Jun 03 '22 22:06 aeisenberg

Here's a recent Swift example I hit:

Image

The query is here:

/**
 * @kind path-problem
 */

import swift
import codeql.swift.dataflow.DataFlow
import Partial::PartialPathGraph

module Config implements DataFlow::ConfigSig {
  predicate isSource(DataFlow::Node source) {
    exists(CallExpr call |
      source.asExpr() = call and
      call.getStaticTarget().hasName("source()")
    )
  }

  predicate isSink(DataFlow::Node sink) {
    exists(CallExpr call |
      sink.asExpr() = call.getAnArgument().getExpr() and
      call.getStaticTarget().getName().matches("%sink%")
    )
  }
}

module Flow = DataFlow::Global<Config>;

int limit() { result = 10 }

module Partial = Flow::FlowExploration<limit/0>;

from Partial::PartialPathNode source, Partial::PartialPathNode sink
where Partial::partialFlow(source, sink, _) and not exists(sink.getASuccessor())
select sink.getNode(), source, sink, ""

And the database is here:

quick-queries.testproj.zip

MathiasVP avatar Oct 23 '23 11:10 MathiasVP