Open dgarofoli1987 opened 1 month ago
Seeing a similar issue:
{
// some properties
foo: <%= JSON.pretty_generate(Model.method.map(&:to_s)).html_safe %>,
}
Fails but:
<%- names = Model.method.map(&:to_s) %>
{
// some properties
foo: <%= JSON.pretty_generate(names).html_safe %>,
}
Works
Background
Brakeman version: 6.2.1 Rails version: 7.0.8.4 Ruby version: 3.2.4
I have this piece of code
Which generate this issue:
I resolve the issue with this change:
But if I move the
order
var inside the.erb
I keep getting the same error:As suggested in this blogpost I use
escape_javascript
:In this way, no warnings are displayed. Is this the correct way to fix the issue?
TYSM