We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent edd7e44 commit 9a047b6Copy full SHA for 9a047b6
lib/fusioncharts/rails/chart.rb
@@ -84,7 +84,7 @@ def jsonUrl?
84
85
# Render the chart
86
def render
87
- config = self.options.to_json
+ config = json_escape JSON.generate(self.options)
88
dataUrlFormat = self.jsonUrl? ? "json" : ( self.xmlUrl ? "xml" : nil )
89
template = File.read(File.expand_path("../../../templates/chart.erb", __FILE__))
90
renderer = ERB.new(template)
@@ -118,6 +118,11 @@ def parse_options
118
parse_datasource_json
119
end
120
121
+ # Escape tags in json, if avoided might be vulnerable to XSS
122
+ def json_escape(str)
123
+ str.to_s.gsub('/', '\/')
124
+ end
125
+
126
127
128
0 commit comments