diff options
author | Go MAEDA <maeda@farend.jp> | 2019-08-26 04:18:18 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-08-26 04:18:18 +0000 |
commit | 47dd2083f7958ff05deea3c56c1c2067fef64f9c (patch) | |
tree | a0386a6d30d3475a4788336593998813a5ec9ad8 /app/models/setting.rb | |
parent | e03617881e5f4c1240b9d494df975968da4a9478 (diff) | |
download | redmine-47dd2083f7958ff05deea3c56c1c2067fef64f9c.tar.gz redmine-47dd2083f7958ff05deea3c56c1c2067fef64f9c.zip |
Reject setting RFC non-compliant emission email addresses (#31154).
Patch by Mizuki ISHIKAWA.
git-svn-id: http://svn.redmine.org/redmine/trunk@18396 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/setting.rb')
-rw-r--r-- | app/models/setting.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb index b18f8ed89..9eaaaec33 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -166,6 +166,14 @@ class Setting < ActiveRecord::Base end end + if settings.key?(:mail_from) + begin + mail_from = Mail::Address.new(settings[:mail_from]) + raise unless mail_from.address =~ EmailAddress::EMAIL_REGEXP + rescue + messages << [:mail_from, l('activerecord.errors.messages.invalid')] + end + end messages end |