Giter Site home page Giter Site logo

vscode-codeql-starter's Introduction

vscode-codeql-starter

A starter workspace to use with the CodeQL extension for Visual Studio Code. For more information, see the vscode-codeql repo.

Instructions

  1. Install Visual Studio Code.
  2. Install the CodeQL extension for Visual Studio Code.
  3. Clone this repository to your computer.
    • Make sure to include the submodules, either by git clone --recursive or by git submodule update --init --remote after clone.
    • Use git submodule update --remote regularly to keep the submodules up to date.
  4. In VS Code, click File > Open Workspace. Select the file vscode-codeql-starter.code-workspace in your checkout of this repository.
  5. You will see several folders open in the left sidebar:
    • The ql folder contains the open-source CodeQL standard libraries for C/C++, C#, Go, Java, JavaScript/Typescript, Python, and Ruby. It tracks the branch tagged codeql-cli/latest in https://github.com/github/codeql. You can run the standard queries from here, and browse the libraries.
    • The folders named codeql-custom-queries-<language> are ready for you to start developing your own custom queries for each language, while using the standard libraries. There are some example queries to get you started.
  6. Follow the documentation for the CodeQL extension to learn how to set up the extension, add a database and run queries against it. Have fun!

Using the vscode-codeql-starter in a private repository

If you want to privately share your CodeQL queries with your teammates using this project as a template:

  1. Create an empty, private project in the organization you want.
  2. Clone this project locally: git clone [email protected]:github/vscode-codeql-starter.git
  3. Add a remote to the local copy git remote add my-org [email protected]:<MY-ORG>/vscode-codeql-starter.git
  4. Push the code to the new remote: git push my-org main

GitHub does not allow private forks of public repositories.

Contributing

This project welcomes contributions. See CONTRIBUTING.md for details.

Reporting issues

Issues and suggestions should be reported in the vscode-codeql repo.

License

This project is licensed under the MIT License.

The CodeQL extension for Visual Studio Code is licensed under the MIT License. The version of CodeQL used by the CodeQL extension is subject to the GitHub CodeQL Terms & Conditions.

vscode-codeql-starter's People

Contributors

adityasharad avatar aeisenberg avatar aibaars avatar alexet avatar alexrford avatar angelapwen avatar aschackmull avatar asgerf avatar calumgrant avatar cklin avatar criemen avatar dbartol avatar edoardopirovano avatar github-actions[bot] avatar henrymercer avatar hmakholm avatar hvitved avatar igfoo avatar infin8x avatar jbj avatar jcreedcmu avatar jf205 avatar mathiasvp avatar nickrolfe avatar rdmarsh2 avatar shati-patel avatar smowton avatar tamasvajk avatar tausbn avatar trganda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-codeql-starter's Issues

quarry error: [ERROR] resolve library-path> ERROR: Dependency not found: codeql-python

Help wanted, when i exec "run queries on selected file" about example.ql in codeql-custom-queries-python folder, below error occurs, what i should do to resolve this?

Resolving library paths failed: [2020-07-23 17:24:59] [DETAILS] resolve library-path> Resolving query at normalized path e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-python\example.ql.
[2020-07-23 17:24:59] [DETAILS] resolve library-path> Found enclosing pack 'codeql-custom-queries-python' at e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-python.
[2020-07-23 17:24:59] [DETAILS] resolve library-path> Adding compilation cache at e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-python.cache.
[2020-07-23 17:24:59] [DETAILS] resolve library-path> Resolving library dependencies from e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-python\qlpack.yml.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-cpp.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-csharp.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-go.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-java.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-javascript.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-python.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\codeql-go.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into e:\code\CODEQL\vscode-codeql-starter\ql.
[2020-07-23 17:24:59] [SPAMMIER] resolve library-path> Recursing into c:\Users\shaoshouping\AppData\Roaming\Code\User\globalStorage\github.vscode-codeql\distribution4.
[2020-07-23 17:24:59] [ERROR] resolve library-path> ERROR: Dependency not found: codeql-python (e:\code\CODEQL\vscode-codeql-starter\codeql-custom-queries-python\qlpack.yml:1,1-1)
[2020-07-23 17:24:59] Exiting with code 1

Add starter queries in the custom queries folders

In order to help users get started writing their own queries, it would be helpful to include some sample starter queries for each language. Each language folder has an example.ql query, but that is extremely basic. We should consider some more interesting queries as well.

For example, we could add some queries for the following concepts in languages where it makes sense:

  • Where does standard input flow to standard output?
  • Where are the socket/database/file reads and writes?
  • Where are the http request handlers?
  • What are the paths for parameters to flow to return values?

Resolving library paths fails

I just cloned the starter workspace on my new macbook and it failed with the error below. Also tried it in a new Codespaces image and I get the same error. I made sure to initialise all submodules with git submodules update --init. This worked two weeks ago on my windows machine without problems. Do I miss anything or is this somehow broken?

Logile
Resolving library paths using CodeQL CLI: resolve library-path -v --log-to-stderr --format json --query /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql --additional-packs /workspaces/vscode-codeql-starter/codeql-custom-queries-cpp:/workspaces/vscode-codeql-starter/codeql-custom-queries-csharp:/workspaces/vscode-codeql-starter/codeql-custom-queries-go:/workspaces/vscode-codeql-starter/codeql-custom-queries-java:/workspaces/vscode-codeql-starter/codeql-custom-queries-javascript:/workspaces/vscode-codeql-starter/codeql-custom-queries-python:/workspaces/vscode-codeql-starter/codeql-custom-queries-ruby:/workspaces/vscode-codeql-starter/codeql-go:/workspaces/vscode-codeql-starter/ql...
Sending shutdown request
Sent shutdown request
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Resolving query at normalized path /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Found enclosing pack 'getting-started/codeql-extra-queries-javascript' at /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Adding compilation cache at /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/.cache.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Resolving library dependencies from /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml.
[2021-12-08 18:25:50] [ERROR] resolve library-path> ERROR: Error reading /workspaces/vscode-codeql-starter/ql/.codeqlmanifest.json: Unrecognized field "versionPolicies" (class com.semmle.frontend.packs.QlWorkspace$ManifestFile), not marked as ignorable (3 known properties: "provide", "ignore", "chainToAncestor"])
                               at [Source: (String)"{
                                  "provide": [
                                      "*/ql/src/qlpack.yml",
                                      "*/ql/lib/qlpack.yml",
                                      "*/ql/test/qlpack.yml",
                                      "*/ql/examples/qlpack.yml",
                                      "*/upgrades/qlpack.yml",
                                      "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
                                      "javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
                                      "javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",
                                      "misc/legacy-support/*/qlpack.yml",
                                      "misc/suite-helpers/qlpack.yml","[truncated 296 chars]; line: 16, column: 25] (through reference chain: com.semmle.frontend.packs.QlWorkspace$ManifestFile["versionPolicies"]) (/workspaces/vscode-codeql-starter/ql/.codeqlmanifest.json:1,1-1)
[2021-12-08 18:25:50] [ERROR] resolve library-path> ERROR: Referenced pack 'codeql/javascript-all' not found. (/workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml:1,1-1)
[2021-12-08 18:25:50] Exiting with code 1

Resolving library paths failed: [2021-12-08 18:25:50] [DETAILS] resolve library-path> Resolving query at normalized path /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Found enclosing pack 'getting-started/codeql-extra-queries-javascript' at /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Adding compilation cache at /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/.cache.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Resolving library dependencies from /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml.
[2021-12-08 18:25:50] [ERROR] resolve library-path> ERROR: Error reading /workspaces/vscode-codeql-starter/ql/.codeqlmanifest.json: Unrecognized field "versionPolicies" (class com.semmle.frontend.packs.QlWorkspace$ManifestFile), not marked as ignorable (3 known properties: "provide", "ignore", "chainToAncestor"])
                               at [Source: (String)"{
                                  "provide": [
                                      "*/ql/src/qlpack.yml",
                                      "*/ql/lib/qlpack.yml",
                                      "*/ql/test/qlpack.yml",
                                      "*/ql/examples/qlpack.yml",
                                      "*/upgrades/qlpack.yml",
                                      "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
                                      "javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
                                      "javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",
                                      "misc/legacy-support/*/qlpack.yml",
                                      "misc/suite-helpers/qlpack.yml","[truncated 296 chars]; line: 16, column: 25] (through reference chain: com.semmle.frontend.packs.QlWorkspace$ManifestFile["versionPolicies"]) (/workspaces/vscode-codeql-starter/ql/.codeqlmanifest.json:1,1-1)
[2021-12-08 18:25:50] [ERROR] resolve library-path> ERROR: Referenced pack 'codeql/javascript-all' not found. (/workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml:1,1-1)
[2021-12-08 18:25:50] Exiting with code 1
 (codeQL.runQuery)
Error: Resolving library paths failed: [2021-12-08 18:25:50] [DETAILS] resolve library-path> Resolving query at normalized path /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/example.ql.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Found enclosing pack 'getting-started/codeql-extra-queries-javascript' at /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Adding compilation cache at /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/.cache.
[2021-12-08 18:25:50] [DETAILS] resolve library-path> Resolving library dependencies from /workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml.
[2021-12-08 18:25:50] [ERROR] resolve library-path> ERROR: Error reading /workspaces/vscode-codeql-starter/ql/.codeqlmanifest.json: Unrecognized field "versionPolicies" (class com.semmle.frontend.packs.QlWorkspace$ManifestFile), not marked as ignorable (3 known properties: "provide", "ignore", "chainToAncestor"])
                               at [Source: (String)"{
                                  "provide": [
                                      "*/ql/src/qlpack.yml",
                                      "*/ql/lib/qlpack.yml",
                                      "*/ql/test/qlpack.yml",
                                      "*/ql/examples/qlpack.yml",
                                      "*/upgrades/qlpack.yml",
                                      "cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
                                      "javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
                                      "javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",
                                      "misc/legacy-support/*/qlpack.yml",
                                      "misc/suite-helpers/qlpack.yml","[truncated 296 chars]; line: 16, column: 25] (through reference chain: com.semmle.frontend.packs.QlWorkspace$ManifestFile["versionPolicies"]) (/workspaces/vscode-codeql-starter/ql/.codeqlmanifest.json:1,1-1)
[2021-12-08 18:25:50] [ERROR] resolve library-path> ERROR: Referenced pack 'codeql/javascript-all' not found. (/workspaces/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml:1,1-1)
[2021-12-08 18:25:50] Exiting with code 1

    at CodeQLCliServer.runCodeQlCliInternal (/home/codespace/.vscode-remote/extensions/github.vscode-codeql-1.5.8/out/cli.js:203:23)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at CodeQLCliServer.runJsonCodeQlCliCommand (/home/codespace/.vscode-remote/extensions/github.vscode-codeql-1.5.8/out/cli.js:366:24)
    at CodeQLCliServer.resolveLibraryPath (/home/codespace/.vscode-remote/extensions/github.vscode-codeql-1.5.8/out/cli.js:385:16)
    at Object.compileAndRunQueryAgainstDatabase (/home/codespace/.vscode-remote/extensions/github.vscode-codeql-1.5.8/out/run-queries.js:449:24)
    at compileAndRunQuery (/home/codespace/.vscode-remote/extensions/github.vscode-codeql-1.5.8/out/extension.js:321:26)
    at ctx.subscriptions.push.commandRunner_1.commandRunnerWithProgress.title (/home/codespace/.vscode-remote/extensions/github.vscode-codeql-1.5.8/out/extension.js:390:121)

I just recently got into CODEQL and don't know what's going on below

Content-Length: 190

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-custom-queries-cpp/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-custom-queries-cpp, with library path [] and dbscheme Optional.empty
Content-Length: 346

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/misc/legacy-support/csharp/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Dependency not found: codeql/csharp-all"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\misc\legacy-support\csharp, with library path [] and dbscheme Optional.empty
Content-Length: 191

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-custom-queries-java/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-custom-queries-java, with library path [] and dbscheme Optional.empty
Content-Length: 189

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-custom-queries-go/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-custom-queries-go, with library path [] and dbscheme Optional.empty
Content-Length: 197

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-custom-queries-javascript/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-custom-queries-javascript, with library path [] and dbscheme Optional.empty
Content-Length: 346

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/misc/legacy-support/python/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Dependency not found: codeql/python-all"}]}}Content-Length: 193

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-custom-queries-python/qlpack.yml","diagnostics":[]}}Content-Length: 350

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/misc/legacy-support/javascript/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Dependency not found: codeql-javascript"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\misc\legacy-support\python, with library path [] and dbscheme Optional.empty
[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-custom-queries-python, with library path [] and dbscheme Optional.empty
[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\misc\legacy-support\javascript, with library path [] and dbscheme Optional.empty
Content-Length: 181

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/swift/ql/test/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\swift\ql\test, with library path [] and dbscheme Optional.empty
Content-Length: 342

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/misc/legacy-support/java/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Dependency not found: codeql/java-all"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\misc\legacy-support\java, with library path [] and dbscheme Optional.empty
Content-Length: 193

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-custom-queries-csharp/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-custom-queries-csharp, with library path [] and dbscheme Optional.empty
Content-Length: 340

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/misc/legacy-support/cpp/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Dependency not found: codeql/cpp-all"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\misc\legacy-support\cpp, with library path [] and dbscheme Optional.empty
Content-Length: 343

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/codeql-go/ql/config/legacy-support/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Dependency not found: codeql-go"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\codeql-go\ql\config\legacy-support, with library path [] and dbscheme Optional.empty
Content-Length: 180

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/swift/ql/lib/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\swift\ql\lib, with library path [] and dbscheme Optional[D:\Private\security\codeQL\vscode-codeql-starter\ql\swift\ql\lib\swift.dbscheme]
Content-Length: 184

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/swift/ql/lib/swift.dbscheme","diagnostics":[]}}Content-Length: 165

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/codeql/legacy-upgrades/qlpack.yml","diagnostics":[]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\codeql\legacy-upgrades, with library path [] and dbscheme Optional.empty
Content-Length: 843

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/java/ql/lib/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Error reading D:\Private\security\codeQL\vscode-codeql-starter\ql\java\ql\lib\qlpack.yml: Unrecognized field "groups" (class com.semmle.frontend.packs.QlPack), not marked as ignorable (14 known properties: "license", "dbscheme", "extractor", "libraryPathDependencies", "repository", "name", "upgrades", "version", "library", "description", "downgrades", "tests", "dependencies", "suites"])\n at [Source: (StringReader); line: 3, column: 13] (through reference chain: com.semmle.frontend.packs.QlPack["groups"])"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\java\ql\lib, with library path [] and dbscheme Optional.empty
Content-Length: 890

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/csharp/ql/campaigns/Solorigate/lib/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Error reading D:\Private\security\codeQL\vscode-codeql-starter\ql\csharp\ql\campaigns\Solorigate\lib\qlpack.yml: Unrecognized field "groups" (class com.semmle.frontend.packs.QlPack), not marked as ignorable (14 known properties: "license", "dbscheme", "extractor", "libraryPathDependencies", "repository", "name", "upgrades", "version", "library", "description", "downgrades", "tests", "dependencies", "suites"])\n at [Source: (StringReader); line: 4, column: 5] (through reference chain: com.semmle.frontend.packs.QlPack["groups"])"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\csharp\ql\campaigns\Solorigate\lib, with library path [] and dbscheme Optional.empty
Content-Length: 842

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///D:/Private/security/codeQL/vscode-codeql-starter/ql/ruby/ql/src/qlpack.yml","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"severity":1,"source":"","message":"Error reading D:\Private\security\codeQL\vscode-codeql-starter\ql\ruby\ql\src\qlpack.yml: Unrecognized field "groups" (class com.semmle.frontend.packs.QlPack), not marked as ignorable (14 known properties: "license", "dbscheme", "extractor", "libraryPathDependencies", "repository", "name", "upgrades", "version", "library", "description", "downgrades", "tests", "dependencies", "suites"])\n at [Source: (StringReader); line: 4, column: 3] (through reference chain: com.semmle.frontend.packs.QlPack["groups"])"}]}}[2022-05-04 16:08:44] Creating pack project at D:\Private\security\codeQL\vscode-codeql-starter\ql\ruby\ql\src, with library path [] and dbscheme Optional.empty
May 04, 2022 4:08:44 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError
����: Internal error: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at com.semmle.queryserver.client.JsonRpcLauncher.lambda$startListening$0(JsonRpcLauncher.java:50)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 11 more
Caused by: Error processing queries.xml file for query directory D:\Private\security\codeQL\vscode-codeql-starter\ql\ruby\ql\src: Invalid value 'ruby' for language attribute
at com.semmle.util.xml.XmlErrorHandler.reportErrorsIfAny(XmlErrorHandler.java:46)
at com.semmle.api.QueryDirectory$Resolver.fromDir(QueryDirectory.java:320)
at com.semmle.api.QueryDirectory$Resolver.forFile(QueryDirectory.java:332)
at com.semmle.api.QueryDirectory.forPath(QueryDirectory.java:112)
at com.semmle.frontend.imports.QueryImportResolver.getImportablePaths(QueryImportResolver.java:183)
at com.semmle.frontend.QueryLocationGuesser.(QueryLocationGuesser.java:47)
at com.semmle.frontend.project.QLProject.(QLProject.java:179)
at com.semmle.frontend.project.QLProject.createProject(QLProject.java:153)
at com.semmle.frontend.project.ProjectsMap.reloadPackProjects(ProjectsMap.java:142)
at com.semmle.frontend.project.ProjectsMap.setWorkspaceRoots(ProjectsMap.java:157)
at com.semmle.frontend.server.QLLanguageServer.initialize(QLLanguageServer.java:219)
... 16 more

Content-Length: 2916

{"jsonrpc":"2.0","id":0,"error":{"code":-32603,"message":"Internal error.","data":"java.lang.RuntimeException: java.lang.reflect.InvocationTargetException\r\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)\r\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)\r\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)\r\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)\r\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\r\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\r\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\r\n\tat com.semmle.queryserver.client.JsonRpcLauncher.lambda$startListening$0(JsonRpcLauncher.java:50)\r\n\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\r\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\r\n\tat java.base/java.lang.Thread.run(Unknown Source)\r\nCaused by: java.lang.reflect.InvocationTargetException\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)\r\n\tat java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)\r\n\tat java.base/java.lang.reflect.Method.invoke(Unknown Source)\r\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)\r\n\t... 11 more\r\nCaused by: Error processing queries.xml file for query directory D:\Private\security\codeQL\vscode-codeql-starter\ql\ruby\ql\src: Invalid value \u0027ruby\u0027 for language attribute\r\n\tat com.semmle.util.xml.XmlErrorHandler.reportErrorsIfAny(XmlErrorHandler.java:46)\r\n\tat com.semmle.api.QueryDirectory$Resolver.fromDir(QueryDirectory.java:320)\r\n\tat com.semmle.api.QueryDirectory$Resolver.forFile(QueryDirectory.java:332)\r\n\tat com.semmle.api.QueryDirectory.forPath(QueryDirectory.java:112)\r\n\tat com.semmle.frontend.imports.QueryImportResolver.getImportablePaths(QueryImportResolver.java:183)\r\n\tat com.semmle.frontend.QueryLocationGuesser.\u003cinit\u003e(QueryLocationGuesser.java:47)\r\n\tat com.semmle.frontend.project.QLProject.\u003cinit\u003e(QLProject.java:179)\r\n\tat com.semmle.frontend.project.QLProject.createProject(QLProject.java:153)\r\n\tat com.semmle.frontend.project.ProjectsMap.reloadPackProjects(ProjectsMap.java:142)\r\n\tat com.semmle.frontend.project.ProjectsMap.setWorkspaceRoots(ProjectsMap.java:157)\r\n\tat com.semmle.frontend.server.QLLanguageServer.initialize(QLLanguageServer.java:219)\r\n\t... 16 more\r\n"}}[Error - 16:08:44] Server initialization failed.
Message: Internal error.
Code: -32603
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at com.semmle.queryserver.client.JsonRpcLauncher.lambda$startListening$0(JsonRpcLauncher.java:50)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 11 more
Caused by: Error processing queries.xml file for query directory D:\Private\security\codeQL\vscode-codeql-starter\ql\ruby\ql\src: Invalid value 'ruby' for language attribute
at com.semmle.util.xml.XmlErrorHandler.reportErrorsIfAny(XmlErrorHandler.java:46)
at com.semmle.api.QueryDirectory$Resolver.fromDir(QueryDirectory.java:320)
at com.semmle.api.QueryDirectory$Resolver.forFile(QueryDirectory.java:332)
at com.semmle.api.QueryDirectory.forPath(QueryDirectory.java:112)
at com.semmle.frontend.imports.QueryImportResolver.getImportablePaths(QueryImportResolver.java:183)
at com.semmle.frontend.QueryLocationGuesser.(QueryLocationGuesser.java:47)
at com.semmle.frontend.project.QLProject.(QLProject.java:179)
at com.semmle.frontend.project.QLProject.createProject(QLProject.java:153)
at com.semmle.frontend.project.ProjectsMap.reloadPackProjects(ProjectsMap.java:142)
at com.semmle.frontend.project.ProjectsMap.setWorkspaceRoots(ProjectsMap.java:157)
at com.semmle.frontend.server.QLLanguageServer.initialize(QLLanguageServer.java:219)
... 16 more

[Error - 16:08:44] Starting client failed
Message: Internal error.
Code: -32603
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at com.semmle.queryserver.client.JsonRpcLauncher.lambda$startListening$0(JsonRpcLauncher.java:50)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65)
... 11 more
Caused by: Error processing queries.xml file for query directory D:\Private\security\codeQL\vscode-codeql-starter\ql\ruby\ql\src: Invalid value 'ruby' for language attribute
at com.semmle.util.xml.XmlErrorHandler.reportErrorsIfAny(XmlErrorHandler.java:46)
at com.semmle.api.QueryDirectory$Resolver.fromDir(QueryDirectory.java:320)
at com.semmle.api.QueryDirectory$Resolver.forFile(QueryDirectory.java:332)
at com.semmle.api.QueryDirectory.forPath(QueryDirectory.java:112)
at com.semmle.frontend.imports.QueryImportResolver.getImportablePaths(QueryImportResolver.java:183)
at com.semmle.frontend.QueryLocationGuesser.(QueryLocationGuesser.java:47)
at com.semmle.frontend.project.QLProject.(QLProject.java:179)
at com.semmle.frontend.project.QLProject.createProject(QLProject.java:153)
at com.semmle.frontend.project.ProjectsMap.reloadPackProjects(ProjectsMap.java:142)
at com.semmle.frontend.project.ProjectsMap.setWorkspaceRoots(ProjectsMap.java:157)
at com.semmle.frontend.server.QLLanguageServer.initialize(QLLanguageServer.java:219)
... 16 more

Problem with running test case

I'm using the CodeQL starter in VS Code to write new queries and it works great for me. The only issue is that I cannot run custom test cases.

First issue I got is the compliant of Java version. In vscode-codeql-starter/ql/java/ql/test/query-tests/maven-dependencies/my-project/.settings/org.eclipse.jdt.core.prefs, it has:

eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.5

I changed all 3 occurrences of 1.5 to 1.8 since 1.5 is too old and I'm using JDK 1.8. Then the error was gone.

However, after I created a new test then ran the test, I got:

The container 'Maven Dependencies' references non existing library '/<user-home>/.m2/repository/com/semmle/another-project/1.0/another-project-1.0.jar'

There is no directory "/.m2/repository/com/semmle/" created so I guess some dependencies are missing.

Would you please help? Thanks a lot.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.