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

No result of the query #116

Open
sonyavalo opened this issue Mar 23, 2022 · 1 comment
Open

No result of the query #116

sonyavalo opened this issue Mar 23, 2022 · 1 comment
Labels

Comments

@sonyavalo
Copy link

Hello, my name is Sofya
I was trying to run an example from this link on Visual Studio Code:
https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/#analyzing-data-flow-in-javascript-and-typescript
I created a database of Node.js library manually and added it to Visual Studio Code and it is activated.
My query look like that:

/**

import javascript
import DataFlow::PathGraph

class CommandLineFileNameConfiguration extends TaintTracking::Configuration {
CommandLineFileNameConfiguration() { this = "CommandLineFileNameConfiguration" }

override predicate isSource(DataFlow::Node source) {
DataFlow::globalVarRef("process").getAPropertyRead("argv").getAPropertyRead() = source
}

override predicate isSink(DataFlow::Node sink) {
DataFlow::moduleMember("fs", "readFile").getACall().getArgument(0) = sink
}
}

from CommandLineFileNameConfiguration cfg, DataFlow::Node source, DataFlow::Node sink
where cfg.hasFlow(source, sink)
select sink, source, sink, ""

Unfortunately this query is not giving any results. (no errors occured)
Can you help me with it please? Maybe the problem is in database?

@github-actions github-actions bot added the CLI label Mar 23, 2022
@tausbn
Copy link

tausbn commented Mar 24, 2022

Thank you for your question.

If your query isn't producing any output, you may want to try debugging it. I would first check that your isSource and isSink predicates actually capture the data-flow nodes you are interested in. If you're using the VSCode CodeQL extension, then the "quick-eval" feature is very useful for this sort of thing.

Also, I note that your select clause has the empty string as the message:

select sink, source, sink, ""

You may want to change that to something a bit more descriptive.

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

No branches or pull requests

2 participants