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

CodeQL Csharp query help #17722

Open
sunhere opened this issue Oct 9, 2024 · 0 comments
Open

CodeQL Csharp query help #17722

sunhere opened this issue Oct 9, 2024 · 0 comments
Labels
question Further information is requested

Comments

@sunhere
Copy link

sunhere commented Oct 9, 2024

I am new to CodeQL. Here is the scenario I have.

I am trying to retrieve the parameters of all public methods in a controller class.
if the parameter type is not primitive then it should get the result as is, however if the param is ref type, then it has to get all the fields of the ref type.
I was able to get all the parameters, however not able to retrieve the fields of the ref type. I have been trying with a recursive function, not successful. can someone please help me with the query.
below is the query:

import csharp

class Controller extends Class {
Controller() {
this.getName().matches("%VaultController")
}
}

from Controller c, Method m, Parameter p
where
m.getDeclaringType() = c and
m.hasModifier("public") and
p.getCallable() = m
select c.getName(), m.getName(), p.getType().getName()

@sunhere sunhere added the question Further information is requested label Oct 9, 2024
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

1 participant