Skip to content

Commit

Permalink
Use a regex that doesn't suffer from catastrophic backtracking
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmuller committed Sep 27, 2017
1 parent 624bf9b commit 32d8a02
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/rack/contrib/jsonp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ module Rack
class JSONP
include Rack::Utils

VALID_JS_VAR = /[a-zA-Z_$][\w$]*/
VALID_CALLBACK = /\A#{VALID_JS_VAR}(?:\.?#{VALID_JS_VAR})*\z/
VALID_CALLBACK = /\A[a-zA-Z_$](?:\.?[\w$])*\z/

# These hold the Unicode characters \u2028 and \u2029.
#
Expand Down

0 comments on commit 32d8a02

Please sign in to comment.