Skip to content

@kind metadata property not recognized by cli database analyze #19328

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

Closed
cppHusky opened this issue Apr 16, 2025 · 2 comments
Closed

@kind metadata property not recognized by cli database analyze #19328

cppHusky opened this issue Apr 16, 2025 · 2 comments
Labels
question Further information is requested

Comments

@cppHusky
Copy link

Description of the issue

In http-handlers.ql I have specified @kind problem metadata property:

/**
 * @name Finds functions that look like HTTP route handlers based on parameter names.
 * @description ...
 * @id js/http-handlers
 * @kind problem
 * @tags etherpad 1
 * @problem.severity recommendation
 */

import javascript

/**
 * A function with `req` and `res` parameters, and hence most likely an
 * HTTP route handler.
 */
class LikelyRouteHandler extends DataFlow::FunctionNode {
  DataFlow::ParameterNode req;
  DataFlow::ParameterNode res;

  LikelyRouteHandler() {
    req = getParameter(0) and req.getName() = "req" and
    res = getParameter(1) and res.getName() = "res"
  }
}

// Find HTTP route handlers, using the heuristic of looking for parameters
// named `req` and `res`.
from LikelyRouteHandler l
select l

However, when I use codeql database analyze, it shows that

$ codeql database analyze ethdb/ http-handlers.ql --format=csv --output=./
Running queries.
[1/1] No need to rerun /home/cpphusky/Downloads/etherpad-lite-revision-1.6.2/http-handlers.ql.
Shutting down query evaluator.
Interpreting results.
A fatal error occurred: Could not process query metadata for /home/cpphusky/Downloads/etherpad-lite-revision-1.6.2/ethdb/results/my-queries/http-handlers.bqrs.
Error was: Cannot process query metadata for a query without the '@kind' metadata property. To learn more, see https://codeql.github.com/docs/writing-codeql-queries/metadata-for-codeql-queries/ [NO_KIND_SPECIFIED]

I've read the documentation but unable to find what's wrong with my ql. Can anyone help with me?

@cppHusky cppHusky added the question Further information is requested label Apr 16, 2025
@aibaars
Copy link
Contributor

aibaars commented Apr 16, 2025

At a glance the metadata of your query looks fine. Make sure to re-run the query, I believe there is a --rerun flag. The No need to rerun phrase in the log suggests the query was not run, so perhaps the metadata in the bqrs (query results) file is still the old data.

Also the select statement should select a code element and a message, so it should be something like l, "a message" .

@cppHusky
Copy link
Author

At a glance the metadata of your query looks fine. Make sure to re-run the query, I believe there is a --rerun flag. The No need to rerun phrase in the log suggests the query was not run, so perhaps the metadata in the bqrs (query results) file is still the old data.

Also the select statement should select a code element and a message, so it should be something like l, "a message" .

With a --rerun flag it works. Thanks a lot.

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

2 participants