Skip to content

Commit 1fd4332

Browse files
committed
Limit the maximum array size produced by range().
It is trivially easy to accidentally DOS a puppet master by requesting a range larger than was intended, for example `range('host00/index.html', 'host25/index.html')`. Because jruby's implementation of unrolling the range is parallelized, this sort of thing takes down the whole box. The solution here is a simple sanity-check on it; we could get fancier with a new argument specifying a larger size etc. if someone thinks it needed.
1 parent ca61da2 commit 1fd4332

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/puppet/parser/functions/range.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module Puppet::Parser::Functions
8080
when '...' then (start...stop) # Exclusive of last element
8181
end
8282

83-
result = range.step(step).to_a
83+
result = range.step(step).first(1_000_000).to_a
8484

8585
return result
8686
end

0 commit comments

Comments
 (0)