mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 18:52:07 +08:00
Add list of whitelisted attributes [SCI-102]
This commit is contained in:
parent
6487bd788a
commit
1009347026
2 changed files with 9 additions and 2 deletions
|
@ -1,7 +1,10 @@
|
|||
module InputSanitizeHelper
|
||||
def sanitize_input(text)
|
||||
ActionController::Base.helpers.sanitize(text,
|
||||
tags: Constants::WHITELISTED_TAGS)
|
||||
ActionController::Base.helpers.sanitize(
|
||||
text,
|
||||
tags: Constants::WHITELISTED_TAGS,
|
||||
attributes: Constants::WHITELISTED_ATTRIBUTES
|
||||
)
|
||||
end
|
||||
|
||||
def escape_input(text)
|
||||
|
|
|
@ -213,6 +213,10 @@ class Constants
|
|||
'div', 'span', 'u', 's', 'blockquote', 'pre'
|
||||
].freeze
|
||||
|
||||
WHITELISTED_ATTRIBUTES = [
|
||||
'href', 'src', 'width', 'height', 'alt', 'cite', 'datetime', 'title',
|
||||
'class', 'name', 'xml:lang', 'abbr', 'style'
|
||||
]
|
||||
# Very basic regex to check for validity of emails
|
||||
BASIC_EMAIL_REGEX = URI::MailTo::EMAIL_REGEXP
|
||||
|
||||
|
|
Loading…
Reference in a new issue