mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
drop ViewComponent parts from the ActionView library
This commit is contained in:
@@ -7,9 +7,6 @@ private import codeql_ruby.ast.internal.Module
|
||||
private import ActionController
|
||||
|
||||
predicate inActionViewContext(AstNode n) {
|
||||
// Within a view component
|
||||
n.getEnclosingModule() instanceof ViewComponentClass
|
||||
or
|
||||
// Within a template
|
||||
// TODO: n.getLocation().getFile() instanceof ErbFile
|
||||
n.getLocation().getFile().getExtension() = "erb"
|
||||
@@ -121,28 +118,6 @@ abstract class RenderToCall extends MethodCall {
|
||||
// A call to `render_to` from within a template or view component.
|
||||
private class ActionViewRenderToCall extends ActionViewContextCall, RenderToCall { }
|
||||
|
||||
private class ViewComponentBaseAccess extends ConstantReadAccess {
|
||||
ViewComponentBaseAccess() {
|
||||
this.getName() = "Base" and
|
||||
this.getScopeExpr().(ConstantAccess).getName() = "ViewComponent"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class extending `ViewComponent::Base`.
|
||||
*/
|
||||
class ViewComponentClass extends ClassDeclaration {
|
||||
ViewComponentClass() {
|
||||
// class Foo < ViewComponent::Base
|
||||
this.getSuperclassExpr() instanceof ViewComponentBaseAccess
|
||||
or
|
||||
// class Bar < Foo
|
||||
exists(ViewComponentClass other |
|
||||
other.getModule() = resolveScopeExpr(this.getSuperclassExpr())
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A call to the ActionView `link_to` helper method.
|
||||
*
|
||||
|
||||
@@ -17,7 +17,5 @@ renderCalls
|
||||
| app/views/foo/bars/show.html.erb:31:5:31:89 | call to render |
|
||||
renderToCalls
|
||||
| app/controllers/foo/bars_controller.rb:10:16:10:97 | call to render_to_string |
|
||||
viewComponentClasses
|
||||
| app/components/DummyComponent.rb:1:1:2:3 | DummyComponent |
|
||||
linkToCalls
|
||||
| app/views/foo/bars/show.html.erb:33:5:33:41 | call to link_to |
|
||||
|
||||
@@ -9,6 +9,4 @@ query predicate renderCalls(RenderCall c) { any() }
|
||||
|
||||
query predicate renderToCalls(RenderToCall c) { any() }
|
||||
|
||||
query predicate viewComponentClasses(ViewComponentClass cls) { any() }
|
||||
|
||||
query predicate linkToCalls(LinkToCall c) { any() }
|
||||
|
||||
Reference in New Issue
Block a user