mirror of
https://github.com/discourse/discourse.git
synced 2025-02-13 14:55:06 +00:00
SECURITY: Prevent ReDoS in user agent parsing (#20003)
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com>
This commit is contained in:
parent
ec4c302708
commit
3c6d938077
@ -36,7 +36,9 @@ module MobileDetection
|
||||
Firefox\/1[0-9][0-9]
|
||||
}x
|
||||
|
||||
USER_AGENT_MAX_LENGTH = 400
|
||||
|
||||
def self.modern_mobile_device?(user_agent)
|
||||
user_agent.match?(MODERN_MOBILE_REGEX)
|
||||
user_agent[0...USER_AGENT_MAX_LENGTH].match?(MODERN_MOBILE_REGEX)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user