brakeman 7.1.2 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGES.md +11 -0
- data/README.md +1 -1
- data/bundle/load.rb +2 -2
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/CHANGELOG +111 -0
- data/bundle/ruby/3.2.0/gems/{erubis-2.7.0 → erubi-1.13.1}/MIT-LICENSE +1 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/README.rdoc +151 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi/capture_block.rb +91 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi/capture_end.rb +58 -0
- data/bundle/ruby/3.2.0/gems/erubi-1.13.1/lib/erubi.rb +299 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/asciidoc.rb +12 -5
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/babel.rb +5 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/builder.rb +4 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/coffee.rb +14 -4
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/commonmarker.rb +41 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/csv.rb +63 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/erb.rb +130 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/erubi.rb +41 -8
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/etanni.rb +7 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/haml.rb +67 -1
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/kramdown.rb +59 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/liquid.rb +93 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/livescript.rb +11 -4
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/mapping.rb +8 -8
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/markaby.rb +11 -2
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/nokogiri.rb +13 -2
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/pandoc.rb +81 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/pipeline.rb +6 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/plain.rb +5 -1
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/prawn.rb +17 -6
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/radius.rb +96 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/rdiscount.rb +82 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/rdoc.rb +33 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/redcarpet.rb +73 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/redcloth.rb +40 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/rst-pandoc.rb +33 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/sass.rb +16 -3
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/slim.rb +18 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/string.rb +10 -2
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/template.rb +5 -5
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/typescript.rb +5 -0
- data/bundle/ruby/3.2.0/gems/tilt-2.7.0/lib/tilt/yajl.rb +91 -0
- data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt.rb +1 -2
- data/lib/brakeman/app_tree.rb +7 -2
- data/lib/brakeman/checks/check_model_attributes.rb +1 -1
- data/lib/brakeman/checks/check_render.rb +1 -27
- data/lib/brakeman/checks/check_render_rce.rb +43 -0
- data/lib/brakeman/checks/check_session_settings.rb +1 -1
- data/lib/brakeman/checks.rb +31 -25
- data/lib/brakeman/commandline.rb +6 -1
- data/lib/brakeman/file_parser.rb +3 -2
- data/lib/brakeman/logger.rb +264 -0
- data/lib/brakeman/options.rb +0 -9
- data/lib/brakeman/parsers/rails_erubi.rb +82 -0
- data/lib/brakeman/parsers/template_parser.rb +7 -15
- data/lib/brakeman/processor.rb +2 -2
- data/lib/brakeman/processors/controller_alias_processor.rb +1 -1
- data/lib/brakeman/processors/controller_processor.rb +3 -3
- data/lib/brakeman/processors/{erubis_template_processor.rb → erubi_template_procesor.rb} +3 -3
- data/lib/brakeman/processors/lib/rails2_config_processor.rb +4 -3
- data/lib/brakeman/processors/lib/rails2_route_processor.rb +1 -1
- data/lib/brakeman/processors/lib/render_helper.rb +1 -1
- data/lib/brakeman/processors/lib/render_path.rb +1 -1
- data/lib/brakeman/processors/model_processor.rb +1 -1
- data/lib/brakeman/report/ignore/config.rb +1 -1
- data/lib/brakeman/scanner.rb +25 -49
- data/lib/brakeman/tracker/collection.rb +12 -2
- data/lib/brakeman/tracker/config.rb +17 -13
- data/lib/brakeman/tracker/constants.rb +17 -2
- data/lib/brakeman/tracker/controller.rb +1 -1
- data/lib/brakeman/tracker.rb +7 -15
- data/lib/brakeman/version.rb +1 -1
- data/lib/brakeman.rb +89 -49
- metadata +51 -80
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/CHANGES.txt +0 -828
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/README.txt +0 -102
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/erubis +0 -3468
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/erubis-run.rb +0 -132
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/contrib/inline-require +0 -179
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/context.rb +0 -83
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/converter.rb +0 -357
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ec.rb +0 -117
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ecpp.rb +0 -113
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ejava.rb +0 -110
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ejavascript.rb +0 -119
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/enhanced.rb +0 -126
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/eperl.rb +0 -95
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/ephp.rb +0 -99
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/eruby.rb +0 -125
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/escheme.rb +0 -114
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine/optimized.rb +0 -127
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/engine.rb +0 -120
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/enhancer.rb +0 -723
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/error.rb +0 -23
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/evaluator.rb +0 -88
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/generator.rb +0 -85
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helper.rb +0 -47
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_form_helper.rb +0 -197
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/helpers/rails_helper.rb +0 -353
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/local-setting.rb +0 -9
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/main.rb +0 -516
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/preprocessing.rb +0 -58
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/tiny.rb +0 -144
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis/util.rb +0 -22
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/lib/erubis.rb +0 -73
- data/bundle/ruby/3.2.0/gems/erubis-2.7.0/setup.rb +0 -1331
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/creole.rb +0 -16
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/csv.rb +0 -53
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/erb.rb +0 -65
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/kramdown.rb +0 -13
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/liquid.rb +0 -37
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/pandoc.rb +0 -39
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/radius.rb +0 -41
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rdiscount.rb +0 -23
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rdoc.rb +0 -11
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/redcarpet.rb +0 -31
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/redcloth.rb +0 -13
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/rst-pandoc.rb +0 -10
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/slim.rb +0 -5
- data/bundle/ruby/3.2.0/gems/tilt-2.6.1/lib/tilt/yajl.rb +0 -81
- data/lib/brakeman/parsers/erubis_patch.rb +0 -11
- data/lib/brakeman/parsers/rails2_erubis.rb +0 -9
- data/lib/brakeman/parsers/rails2_xss_plugin_erubis.rb +0 -52
- data/lib/brakeman/parsers/rails3_erubis.rb +0 -85
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/COPYING +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_emacs_org.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_handlebars.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_jbuilder.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/_org.rb +0 -0
- /data/bundle/ruby/3.2.0/gems/{tilt-2.6.1 → tilt-2.7.0}/lib/tilt/cli.rb +0 -0
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'creole'
|
|
4
|
-
|
|
5
|
-
warn 'tilt/creole is deprecated, as creole requires modifying string literals', uplevel: 1
|
|
6
|
-
|
|
7
|
-
allowed_opts = [:allowed_schemes, :extensions, :no_escape].freeze
|
|
8
|
-
|
|
9
|
-
# Creole implementation. See: http://www.wikicreole.org/
|
|
10
|
-
Tilt::CreoleTemplate = Tilt::StaticTemplate.subclass do
|
|
11
|
-
opts = {}
|
|
12
|
-
allowed_opts.each do |k|
|
|
13
|
-
opts[k] = @options[k] if @options[k]
|
|
14
|
-
end
|
|
15
|
-
Creole::Parser.new(@data, opts).to_html
|
|
16
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'csv'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
|
|
7
|
-
# CSV Template implementation. See:
|
|
8
|
-
# http://ruby-doc.org/stdlib/libdoc/csv/rdoc/CSV.html
|
|
9
|
-
#
|
|
10
|
-
# == Example
|
|
11
|
-
#
|
|
12
|
-
# # Example of csv template
|
|
13
|
-
# tpl = <<-EOS
|
|
14
|
-
# # header
|
|
15
|
-
# csv << ['NAME', 'ID']
|
|
16
|
-
#
|
|
17
|
-
# # data rows
|
|
18
|
-
# @people.each do |person|
|
|
19
|
-
# csv << [person[:name], person[:id]]
|
|
20
|
-
# end
|
|
21
|
-
# EOS
|
|
22
|
-
#
|
|
23
|
-
# @people = [
|
|
24
|
-
# {:name => "Joshua Peek", :id => 1},
|
|
25
|
-
# {:name => "Ryan Tomayko", :id => 2},
|
|
26
|
-
# {:name => "Simone Carletti", :id => 3}
|
|
27
|
-
# ]
|
|
28
|
-
#
|
|
29
|
-
# template = Tilt::CSVTemplate.new { tpl }
|
|
30
|
-
# template.render(self)
|
|
31
|
-
#
|
|
32
|
-
class CSVTemplate < Template
|
|
33
|
-
self.default_mime_type = 'text/csv'
|
|
34
|
-
|
|
35
|
-
def prepare
|
|
36
|
-
@outvar = @options.delete(:outvar) || '_csvout'
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def precompiled_template(locals)
|
|
40
|
-
<<-RUBY
|
|
41
|
-
#{@outvar} = CSV.generate(**#{@options}) do |csv|
|
|
42
|
-
#{@data}
|
|
43
|
-
end
|
|
44
|
-
RUBY
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def precompiled(locals)
|
|
48
|
-
source, offset = super
|
|
49
|
-
[source, offset + 1]
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'erb'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# ERB template implementation. See:
|
|
7
|
-
# http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html
|
|
8
|
-
class ERBTemplate < Template
|
|
9
|
-
SUPPORTS_KVARGS = ::ERB.instance_method(:initialize).parameters.assoc(:key) rescue false
|
|
10
|
-
|
|
11
|
-
def prepare
|
|
12
|
-
@freeze_string_literals = !!@options[:freeze]
|
|
13
|
-
@outvar = @options[:outvar] || '_erbout'
|
|
14
|
-
trim = case @options[:trim]
|
|
15
|
-
when false
|
|
16
|
-
nil
|
|
17
|
-
when nil, true
|
|
18
|
-
'<>'
|
|
19
|
-
else
|
|
20
|
-
@options[:trim]
|
|
21
|
-
end
|
|
22
|
-
@engine = if SUPPORTS_KVARGS
|
|
23
|
-
::ERB.new(@data, trim_mode: trim, eoutvar: @outvar)
|
|
24
|
-
# :nocov:
|
|
25
|
-
else
|
|
26
|
-
::ERB.new(@data, options[:safe], trim, @outvar)
|
|
27
|
-
# :nocov:
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def precompiled_template(locals)
|
|
32
|
-
source = @engine.src
|
|
33
|
-
source
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def precompiled_preamble(locals)
|
|
37
|
-
<<-RUBY
|
|
38
|
-
begin
|
|
39
|
-
__original_outvar = #{@outvar} if defined?(#{@outvar})
|
|
40
|
-
#{super}
|
|
41
|
-
RUBY
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def precompiled_postamble(locals)
|
|
45
|
-
<<-RUBY
|
|
46
|
-
#{super}
|
|
47
|
-
ensure
|
|
48
|
-
#{@outvar} = __original_outvar
|
|
49
|
-
end
|
|
50
|
-
RUBY
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# ERB generates a line to specify the character coding of the generated
|
|
54
|
-
# source in 1.9. Account for this in the line offset.
|
|
55
|
-
def precompiled(locals)
|
|
56
|
-
source, offset = super
|
|
57
|
-
[source, offset + 1]
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
def freeze_string_literals?
|
|
61
|
-
@freeze_string_literals
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'kramdown'
|
|
4
|
-
|
|
5
|
-
dumb_quotes = [39, 39, 34, 34].freeze
|
|
6
|
-
|
|
7
|
-
# Kramdown Markdown implementation. See: https://kramdown.gettalong.org/
|
|
8
|
-
Tilt::KramdownTemplate = Tilt::StaticTemplate.subclass do
|
|
9
|
-
# dup as Krawmdown modifies the passed option with map!
|
|
10
|
-
@options[:smart_quotes] = dumb_quotes.dup unless @options[:smartypants]
|
|
11
|
-
|
|
12
|
-
Kramdown::Document.new(@data, @options).to_html
|
|
13
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'liquid'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# Liquid template implementation. See:
|
|
7
|
-
# http://liquidmarkup.org/
|
|
8
|
-
#
|
|
9
|
-
# Liquid is designed to be a *safe* template system and therefore
|
|
10
|
-
# does not provide direct access to execuatable scopes. In order to
|
|
11
|
-
# support a +scope+, the +scope+ must be able to represent itself
|
|
12
|
-
# as a hash by responding to #to_h. If the +scope+ does not respond
|
|
13
|
-
# to #to_h it will be ignored.
|
|
14
|
-
#
|
|
15
|
-
# LiquidTemplate does not support yield blocks.
|
|
16
|
-
class LiquidTemplate < Template
|
|
17
|
-
def prepare
|
|
18
|
-
@options[:line_numbers] = true unless @options.has_key?(:line_numbers)
|
|
19
|
-
@engine = ::Liquid::Template.parse(@data, @options)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def evaluate(scope, locs)
|
|
23
|
-
locals = {}
|
|
24
|
-
if scope.respond_to?(:to_h)
|
|
25
|
-
scope.to_h.each{|k, v| locals[k.to_s] = v}
|
|
26
|
-
end
|
|
27
|
-
locs.each{|k, v| locals[k.to_s] = v}
|
|
28
|
-
locals['yield'] = block_given? ? yield : ''
|
|
29
|
-
locals['content'] = locals['yield']
|
|
30
|
-
@engine.render(locals)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def allows_script?
|
|
34
|
-
false
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'pandoc-ruby'
|
|
4
|
-
|
|
5
|
-
# Pandoc markdown implementation. See: http://pandoc.org/
|
|
6
|
-
Tilt::PandocTemplate = Tilt::StaticTemplate.subclass do
|
|
7
|
-
# turn options hash into an array
|
|
8
|
-
# Map tilt options to pandoc options
|
|
9
|
-
# Replace hash keys with value true with symbol for key
|
|
10
|
-
# Remove hash keys with value false
|
|
11
|
-
# Leave other hash keys untouched
|
|
12
|
-
pandoc_options = []
|
|
13
|
-
from = "markdown"
|
|
14
|
-
smart_extension = "-smart"
|
|
15
|
-
@options.each do |k,v|
|
|
16
|
-
case k
|
|
17
|
-
when :smartypants
|
|
18
|
-
smart_extension = "+smart" if v
|
|
19
|
-
when :escape_html
|
|
20
|
-
from = "markdown-raw_html" if v
|
|
21
|
-
when :commonmark
|
|
22
|
-
from = "commonmark" if v
|
|
23
|
-
when :markdown_strict
|
|
24
|
-
from = "markdown_strict" if v
|
|
25
|
-
else
|
|
26
|
-
case v
|
|
27
|
-
when true
|
|
28
|
-
pandoc_options << k
|
|
29
|
-
when false
|
|
30
|
-
# do nothing
|
|
31
|
-
else
|
|
32
|
-
pandoc_options << { k => v }
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
pandoc_options << { :f => from + smart_extension }
|
|
37
|
-
|
|
38
|
-
PandocRuby.new(@data, *pandoc_options).to_html.strip
|
|
39
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'radius'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# Radius Template
|
|
7
|
-
# http://github.com/jlong/radius/
|
|
8
|
-
class RadiusTemplate < Template
|
|
9
|
-
class ContextClass < Radius::Context
|
|
10
|
-
attr_accessor :tilt_scope
|
|
11
|
-
|
|
12
|
-
def tag_missing(name, attributes)
|
|
13
|
-
tilt_scope.__send__(name)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def dup
|
|
17
|
-
i = super
|
|
18
|
-
i.tilt_scope = tilt_scope
|
|
19
|
-
i
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def evaluate(scope, locals, &block)
|
|
24
|
-
context = ContextClass.new
|
|
25
|
-
context.tilt_scope = scope
|
|
26
|
-
context.define_tag("yield", &block) if block
|
|
27
|
-
locals.each do |tag, value|
|
|
28
|
-
context.define_tag(tag) do
|
|
29
|
-
value
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
@options[:tag_prefix] = 'r' unless @options.has_key?(:tag_prefix)
|
|
34
|
-
Radius::Parser.new(context, @options).parse(@data)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def allows_script?
|
|
38
|
-
false
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'rdiscount'
|
|
4
|
-
|
|
5
|
-
aliases = {
|
|
6
|
-
:escape_html => :filter_html,
|
|
7
|
-
:smartypants => :smart
|
|
8
|
-
}.freeze
|
|
9
|
-
|
|
10
|
-
_flags = [:smart, :filter_html, :smartypants, :escape_html].freeze
|
|
11
|
-
|
|
12
|
-
# Discount Markdown implementation. See:
|
|
13
|
-
# http://github.com/rtomayko/rdiscount
|
|
14
|
-
#
|
|
15
|
-
# RDiscount is a simple text filter. It does not support +scope+ or
|
|
16
|
-
# +locals+. The +:smart+ and +:filter_html+ options may be set true
|
|
17
|
-
# to enable those flags on the underlying RDiscount object.
|
|
18
|
-
Tilt::RDiscountTemplate = Tilt::StaticTemplate.subclass do
|
|
19
|
-
flags = _flags.select { |flag| @options[flag] }.
|
|
20
|
-
map! { |flag| aliases[flag] || flag }
|
|
21
|
-
|
|
22
|
-
RDiscount.new(@data, *flags).to_html
|
|
23
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'rdoc'
|
|
4
|
-
require 'rdoc/markup'
|
|
5
|
-
require 'rdoc/markup/to_html'
|
|
6
|
-
require 'rdoc/options'
|
|
7
|
-
|
|
8
|
-
# RDoc template. See: https://github.com/ruby/rdoc
|
|
9
|
-
Tilt::RDocTemplate = Tilt::StaticTemplate.subclass do
|
|
10
|
-
RDoc::Markup::ToHtml.new(RDoc::Options.new, nil).convert(@data).to_s
|
|
11
|
-
end
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'redcarpet'
|
|
4
|
-
|
|
5
|
-
aliases = {:escape_html => :filter_html, :smartypants => :smart}.freeze
|
|
6
|
-
|
|
7
|
-
Tilt::RedcarpetTemplate = Tilt::StaticTemplate.subclass do
|
|
8
|
-
aliases.each do |opt, aka|
|
|
9
|
-
if options.key?(aka) || !@options.key?(opt)
|
|
10
|
-
@options[opt] = @options.delete(aka)
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# only raise an exception if someone is trying to enable :escape_html
|
|
15
|
-
@options.delete(:escape_html) unless @options[:escape_html]
|
|
16
|
-
|
|
17
|
-
renderer = @options.delete(:renderer) || ::Redcarpet::Render::HTML.new(@options)
|
|
18
|
-
if options.delete(:smartypants) && !(renderer.is_a?(Class) && renderer <= ::Redcarpet::Render::SmartyPants)
|
|
19
|
-
renderer = if renderer == ::Redcarpet::Render::XHTML
|
|
20
|
-
::Redcarpet::Render::SmartyHTML.new(:xhtml => true)
|
|
21
|
-
elsif renderer == ::Redcarpet::Render::HTML
|
|
22
|
-
::Redcarpet::Render::SmartyHTML
|
|
23
|
-
elsif renderer.is_a? Class
|
|
24
|
-
Class.new(renderer) { include ::Redcarpet::Render::SmartyPants }
|
|
25
|
-
else
|
|
26
|
-
renderer.extend ::Redcarpet::Render::SmartyPants
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
Redcarpet::Markdown.new(renderer, @options).render(@data)
|
|
31
|
-
end
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'redcloth'
|
|
4
|
-
|
|
5
|
-
# RedCloth implementation. See: https://github.com/jgarber/redcloth
|
|
6
|
-
Tilt::RedClothTemplate = Tilt::StaticTemplate.subclass do
|
|
7
|
-
engine = RedCloth.new(@data)
|
|
8
|
-
@options.each do |k, v|
|
|
9
|
-
m = :"#{k}="
|
|
10
|
-
engine.send(m, v) if engine.respond_to? m
|
|
11
|
-
end
|
|
12
|
-
engine.to_html
|
|
13
|
-
end
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require_relative 'pandoc'
|
|
4
|
-
|
|
5
|
-
rst = {:f => "rst"}.freeze
|
|
6
|
-
|
|
7
|
-
# Pandoc reStructuredText implementation. See: # http://pandoc.org/
|
|
8
|
-
Tilt::RstPandocTemplate = Tilt::StaticTemplate.subclass do
|
|
9
|
-
PandocRuby.new(@data, rst).to_html.strip
|
|
10
|
-
end
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require_relative 'template'
|
|
3
|
-
require 'yajl'
|
|
4
|
-
|
|
5
|
-
module Tilt
|
|
6
|
-
# Yajl Template implementation
|
|
7
|
-
#
|
|
8
|
-
# Yajl is a fast JSON parsing and encoding library for Ruby
|
|
9
|
-
# See https://github.com/brianmario/yajl-ruby
|
|
10
|
-
#
|
|
11
|
-
# The template source is evaluated as a Ruby string,
|
|
12
|
-
# and the result is converted #to_json.
|
|
13
|
-
#
|
|
14
|
-
# == Example
|
|
15
|
-
#
|
|
16
|
-
# # This is a template example.
|
|
17
|
-
# # The template can contain any Ruby statement.
|
|
18
|
-
# tpl <<-EOS
|
|
19
|
-
# @counter = 0
|
|
20
|
-
#
|
|
21
|
-
# # The json variable represents the buffer
|
|
22
|
-
# # and holds the data to be serialized into json.
|
|
23
|
-
# # It defaults to an empty hash, but you can override it at any time.
|
|
24
|
-
# json = {
|
|
25
|
-
# :"user#{@counter += 1}" => { :name => "Joshua Peek", :id => @counter },
|
|
26
|
-
# :"user#{@counter += 1}" => { :name => "Ryan Tomayko", :id => @counter },
|
|
27
|
-
# :"user#{@counter += 1}" => { :name => "Simone Carletti", :id => @counter },
|
|
28
|
-
# }
|
|
29
|
-
#
|
|
30
|
-
# # Since the json variable is a Hash,
|
|
31
|
-
# # you can use conditional statements or any other Ruby statement
|
|
32
|
-
# # to populate it.
|
|
33
|
-
# json[:"user#{@counter += 1}"] = { :name => "Unknown" } if 1 == 2
|
|
34
|
-
#
|
|
35
|
-
# # The last line doesn't affect the returned value.
|
|
36
|
-
# nil
|
|
37
|
-
# EOS
|
|
38
|
-
#
|
|
39
|
-
# template = Tilt::YajlTemplate.new { tpl }
|
|
40
|
-
# template.render(self)
|
|
41
|
-
#
|
|
42
|
-
class YajlTemplate < Template
|
|
43
|
-
self.default_mime_type = 'application/json'
|
|
44
|
-
|
|
45
|
-
def evaluate(scope, locals, &block)
|
|
46
|
-
decorate(super)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def precompiled_preamble(locals)
|
|
50
|
-
return super if locals.include? :json
|
|
51
|
-
"json = {}\n#{super}"
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def precompiled_postamble(locals)
|
|
55
|
-
"Yajl::Encoder.new.encode(json)"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def precompiled_template(locals)
|
|
59
|
-
@data.to_str
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
# Decorates the +json+ input according to given +options+.
|
|
63
|
-
#
|
|
64
|
-
# json - The json String to decorate.
|
|
65
|
-
# options - The option Hash to customize the behavior.
|
|
66
|
-
#
|
|
67
|
-
# Returns the decorated String.
|
|
68
|
-
def decorate(json)
|
|
69
|
-
callback, variable = @options[:callback], @options[:variable]
|
|
70
|
-
if callback && variable
|
|
71
|
-
"var #{variable} = #{json}; #{callback}(#{variable});"
|
|
72
|
-
elsif variable
|
|
73
|
-
"var #{variable} = #{json};"
|
|
74
|
-
elsif callback
|
|
75
|
-
"#{callback}(#{json});"
|
|
76
|
-
else
|
|
77
|
-
json
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
module Brakeman::ErubisPatch
|
|
2
|
-
# Simple patch to make `erubis` compatible with frozen string literals
|
|
3
|
-
def convert(input)
|
|
4
|
-
codebuf = +"" # Modified line, the rest is identitical
|
|
5
|
-
@preamble.nil? ? add_preamble(codebuf) : (@preamble && (codebuf << @preamble))
|
|
6
|
-
convert_input(codebuf, input)
|
|
7
|
-
@postamble.nil? ? add_postamble(codebuf) : (@postamble && (codebuf << @postamble))
|
|
8
|
-
@_proc = nil # clear cached proc object
|
|
9
|
-
return codebuf # or codebuf.join()
|
|
10
|
-
end
|
|
11
|
-
end
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
Brakeman.load_brakeman_dependency 'erubis'
|
|
2
|
-
|
|
3
|
-
require 'brakeman/parsers/erubis_patch'
|
|
4
|
-
|
|
5
|
-
#Erubis processor which ignores any output which is plain text.
|
|
6
|
-
class Brakeman::ScannerErubis < Erubis::Eruby
|
|
7
|
-
include Erubis::NoTextEnhancer
|
|
8
|
-
include Brakeman::ErubisPatch
|
|
9
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Brakeman.load_brakeman_dependency 'erubis'
|
|
2
|
-
|
|
3
|
-
require 'brakeman/parsers/erubis_patch'
|
|
4
|
-
|
|
5
|
-
#This is from the rails_xss plugin for Rails 2
|
|
6
|
-
class Brakeman::Rails2XSSPluginErubis < ::Erubis::Eruby
|
|
7
|
-
include Brakeman::ErubisPatch
|
|
8
|
-
|
|
9
|
-
def add_preamble(src)
|
|
10
|
-
#src << "@output_buffer = ActiveSupport::SafeBuffer.new;"
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
#This is different from rails_xss - fixes some line number issues
|
|
14
|
-
def add_text(src, text)
|
|
15
|
-
if text == "\n"
|
|
16
|
-
src << "\n"
|
|
17
|
-
elsif text.include? "\n"
|
|
18
|
-
lines = text.split("\n")
|
|
19
|
-
if text.match(/\n\z/)
|
|
20
|
-
lines.each do |line|
|
|
21
|
-
src << "@output_buffer.safe_concat('" << escape_text(line) << "');\n"
|
|
22
|
-
end
|
|
23
|
-
else
|
|
24
|
-
lines[0..-2].each do |line|
|
|
25
|
-
src << "@output_buffer.safe_concat('" << escape_text(line) << "');\n"
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
src << "@output_buffer.safe_concat('" << escape_text(lines.last) << "');"
|
|
29
|
-
end
|
|
30
|
-
else
|
|
31
|
-
src << "@output_buffer.safe_concat('" << escape_text(text) << "');"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
BLOCK_EXPR = /\s+(do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
|
36
|
-
|
|
37
|
-
def add_expr_literal(src, code)
|
|
38
|
-
if code =~ BLOCK_EXPR
|
|
39
|
-
src << "@output_buffer.safe_concat((" << $1 << ").to_s);"
|
|
40
|
-
else
|
|
41
|
-
src << '@output_buffer << ((' << code << ').to_s);'
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def add_expr_escaped(src, code)
|
|
46
|
-
src << '@output_buffer << ' << escaped_expr(code) << ';'
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def add_postamble(src)
|
|
50
|
-
#src << '@output_buffer.to_s'
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
Brakeman.load_brakeman_dependency 'erubis'
|
|
2
|
-
|
|
3
|
-
require 'brakeman/parsers/erubis_patch'
|
|
4
|
-
|
|
5
|
-
# This is from Rails 5 version of the Erubis handler
|
|
6
|
-
# https://github.com/rails/rails/blob/ec608107801b1e505db03ba76bae4a326a5804ca/actionview/lib/action_view/template/handlers/erb.rb#L7-L73
|
|
7
|
-
class Brakeman::Rails3Erubis < ::Erubis::Eruby
|
|
8
|
-
include Brakeman::ErubisPatch
|
|
9
|
-
|
|
10
|
-
def add_preamble(src)
|
|
11
|
-
@newline_pending = 0
|
|
12
|
-
src << "_this_is_to_make_yields_syntactally_correct {"
|
|
13
|
-
src << "@output_buffer = output_buffer || ActionView::OutputBuffer.new;"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def add_text(src, text)
|
|
17
|
-
return if text.empty?
|
|
18
|
-
|
|
19
|
-
if text == "\n"
|
|
20
|
-
@newline_pending += 1
|
|
21
|
-
else
|
|
22
|
-
src << "@output_buffer.safe_append='"
|
|
23
|
-
src << "\n" * @newline_pending if @newline_pending > 0
|
|
24
|
-
src << escape_text(text)
|
|
25
|
-
src << "'.freeze;"
|
|
26
|
-
|
|
27
|
-
@newline_pending = 0
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Erubis toggles <%= and <%== behavior when escaping is enabled.
|
|
32
|
-
# We override to always treat <%== as escaped.
|
|
33
|
-
def add_expr(src, code, indicator)
|
|
34
|
-
case indicator
|
|
35
|
-
when '=='
|
|
36
|
-
add_expr_escaped(src, code)
|
|
37
|
-
else
|
|
38
|
-
super
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
BLOCK_EXPR = /\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z/
|
|
43
|
-
|
|
44
|
-
def add_expr_literal(src, code)
|
|
45
|
-
flush_newline_if_pending(src)
|
|
46
|
-
if code =~ BLOCK_EXPR
|
|
47
|
-
src << '@output_buffer.append= ' << code
|
|
48
|
-
else
|
|
49
|
-
src << '@output_buffer.append=(' << code << ');'
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def add_expr_escaped(src, code)
|
|
54
|
-
flush_newline_if_pending(src)
|
|
55
|
-
if code =~ BLOCK_EXPR
|
|
56
|
-
src << "@output_buffer.safe_expr_append= " << code
|
|
57
|
-
else
|
|
58
|
-
src << "@output_buffer.safe_expr_append=(" << code << ");"
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def add_stmt(src, code)
|
|
63
|
-
flush_newline_if_pending(src)
|
|
64
|
-
super
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def add_postamble(src)
|
|
68
|
-
flush_newline_if_pending(src)
|
|
69
|
-
src << '@output_buffer.to_s; }'
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def flush_newline_if_pending(src)
|
|
73
|
-
if @newline_pending > 0
|
|
74
|
-
src << "@output_buffer.safe_append='#{"\n" * @newline_pending}'.freeze;"
|
|
75
|
-
@newline_pending = 0
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
# This is borrowed from graphql's erb plugin:
|
|
80
|
-
# https://github.com/github/graphql-client/blob/51e76bd8d8b2ac0021d8fef7468b9a294e4bd6e8/lib/graphql/client/erubis.rb#L33-L38
|
|
81
|
-
def convert_input(src, input)
|
|
82
|
-
input = input.gsub(/<%graphql/, "<%#")
|
|
83
|
-
super(src, input)
|
|
84
|
-
end
|
|
85
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|