Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INVALID_RESULT_PATTERNS #17338

Closed
KylerKatz opened this issue Aug 30, 2024 · 2 comments
Closed

INVALID_RESULT_PATTERNS #17338

KylerKatz opened this issue Aug 30, 2024 · 2 comments
Labels
question Further information is requested

Comments

@KylerKatz
Copy link

Hello, I am getting some strange behavior when running one of my queries,

/**
 * @name Find all SensitiveVariableExpr instances
 * @description Identifies all variables that are considered SensitiveVariableExpr.
 * @kind problem
 * @problem.severity warning
 * @id java/find-sensitive-variable-expr
 */

 import java
 import SensitiveInfo.SensitiveInfo
 
 from SensitiveVariableExpr sve, Variable v
 where sve = v.getAnAccess()
 select sve, v.getName().toString() + "|" + v.getType().toString()

This is producing this error

Error was: Expected result pattern(s) are not present for problem query: Expected at least 2 columns. [INVALID_RESULT_PATTERNS]

It looks like I am following the entry-to-string pattern.

This is the full command, I have flags such as max-paths because I am running it with another query in the same dir that is a path problem.

codeql database analyze testing\\Dataflow\\db_dir\\ContainerExecDecorator codeql\\codeql-custom-queries-java\\ProgramSlicing --format=sarif-latest --output testing\\Dataflow\\query_results\\ContainerExecDecorator.sarif --max-paths=100 --sarif-add-snippets=true --no-group-results --threads=12

I call this strange because it works just fine in the extension without any errors. Usually, the extension won't display anything if there is a pattern issue.

Here is the SensitiveVariableExpr class for more context

  class SensitiveVariableExpr extends Expr {
    SensitiveVariableExpr() {
      exists(Variable v, File f |
        this = v.getAnAccess() and
        f = v.getCompilationUnit().getFile() and
        sensitiveVariables(f.getBaseName(), v.getName()) and
        not this instanceof CompileTimeConstantExpr and
        not v.getName().toLowerCase().matches("%encrypted%")
        )
    }
  }
@KylerKatz KylerKatz added the question Further information is requested label Aug 30, 2024
@aibaars
Copy link
Contributor

aibaars commented Aug 30, 2024

Have you tried the --rerun flag?

      --[no-]rerun           Evaluate even queries that seem to have a BQRS
                               result stored in the database already.

It might be that there is a cached result file from an earlier version of the query.

@rvermeulen
Copy link
Contributor

Hi @KylerKatz,

It looks like @aibaars provided you with information to resolve your issue, therefore I'm closing this issue. If you still need further support, feel free to open a new issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants