-
|
I have a ruby situation where the remote untrusted data is in the controller where : @q=params[:ssss]in a view file with the ext <%= render partial: 'app1', locals: { query: @q } %>This is breaking the taint flow from reaching further locations, it looks like Could you please help me with this one? I mean do I have to add an |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
|
Hi @Sim4n6, Thanks for reporting this! Are you able to share a complete example that I can bring to the Ruby team? Ideally, it would be fantastic if you could share a Ruby file and a simple QL query that demonstrates the missing flow. |
Beta Was this translation helpful? Give feedback.
-
|
I have just identified the main issue, please: app/controllers/searches_controller.rbclass SearchesController < ApplicationController
before_action :disable_feedback
def show
@q = params[:q] /// SOURCE
end
endapp/views/searches/show.html.erb<%= render partial: 'app', locals: { query: @q } %>app/views/searches/_app.html.erb<%= f(query) %> // this is our SINKNow, I modelized the query as follows:
The problem remains in the additional taint step required. |
Beta Was this translation helpful? Give feedback.
-
|
The first part would be exists(MethodCall mc, Pair p |
mc.getMethodName() = "render" and
p = mc.getArgument(1).(Pair).getValue().(HashLiteral).getAnElement() and
p.getValue() = nodeFrom.asExpr().getExpr() and
p.getKey() = nodeTo.asExpr().getExpr()
) |
Beta Was this translation helpful? Give feedback.
-
|
Hi @Sim4n6, we handle a similar case in the XSS queries but haven't yet expanded to be a general case flow step. You can check out the I'll warn that the implementation is a bit messy - in general terms we're interested in matching up with the correct template file, then matching up an appropriate |
Beta Was this translation helpful? Give feedback.
Hi @Sim4n6, we handle a similar case in the XSS queries but haven't yet expanded to be a general case flow step. You can check out the
isFlowFromControllerInstanceVariablepredicate in XSS.qll to see how we implement this.I'll warn that the implementation is a bit messy - in general terms we're interested in matching up with the correct template file, then matching up an appropriate
InstanceVariableWriteAccessCfgNodein the controller with a correspondingVariableReadAccessin the template file. We use theCfglayer for the write to check that the variable isn't then overwritten before the render call.