Visitar URL original
Ruby: Add query for access paths in model editor by koesie10 · Pull Request #15503 · github/codeql · GitHub
The Wayback Machine - https://web.archive.org/web/20240202132433/https://github.com/github/codeql/pull/15503
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

Ruby: Add query for access paths in model editor #15503

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

koesie10
Copy link
Member

@koesie10 koesie10 commented Feb 1, 2024

This adds a simple query for creating a subset of valid access paths that can be used in MaD models. It's not intended to be complete, and will probably be rewritten to be a recursive query rather than this simple query.

Considerations:

  • Right now, it's a simple query that hardcodes some strings, but it should be recursive in the future.
  • In the future, it might make sense to make this a graph query (i.e. having nodes and edges query predicates), but we want to get this simple solution in first.
  • Util::pathToNode does something close to what we want, but it doesn't have the details and defType, which are really useful to have in the model editor.
  • The intention is to iterate on this query, so the most important part for now is that the query is at least correct in reporting valid access paths.

It seems like the query is also reporting Argument[self] for for example def self. self_foo. Does this make sense? It seems like the method node does return the parameter from getSelfParameter.

@koesie10 koesie10 added the no-change-note-required This PR does not need a change note label Feb 1, 2024
@github-actions github-actions bot added the Ruby label Feb 1, 2024
|
Util::pathToMethod(methodNode, type, path) and
value = "ReturnValue" and
details = returnNode.toString()

Check warning

Code scanning / CodeQL

Using 'toString' in query logic Warning

Query logic depends on implementation of 'toString'.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-change-note-required This PR does not need a change note Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant