-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from NREL/0.11.1-release
v0.11.1 release
- Loading branch information
Showing
15 changed files
with
278 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Documenting gem security issues reported by bundler-audit that are tricky to | ||
# upgrade, but we've manually verified we're not vulnerable to. | ||
# | ||
# Support for this .bundlerauditignore when using bundle-audit currently | ||
# requires this patch: https://github.com/rubysec/bundler-audit/pull/122 | ||
|
||
# devise: Not relevant since we're not using Remember Me cookies. | ||
CVE-2015-8314 | ||
|
||
# handlebars: We're not vulnerable since we don't have any unquoted variables | ||
# (eg, attr={{val}} instead of attr="{{value}}"). But it would still be good to | ||
# address, which we'll do whenever we upgrade to a newer version of Ember | ||
# (https://github.com/NREL/api-umbrella/tree/admin-upgrade). | ||
OSVDB-131671 | ||
|
||
# mail: Can't upgrade due to Rails 3.2, but our lib/mail_sanitizer.rb addresses | ||
# the underlying issue by raising errors for problematic addresses. | ||
OSVDB-131677 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
require "mail_sanitizer" | ||
|
||
class ContactMailer < ActionMailer::Base | ||
default :from => "noreply@#{ApiUmbrellaConfig[:default_host]}" | ||
|
||
def contact_email(contact) | ||
@contact = contact | ||
|
||
mail :reply_to => contact.email, | ||
mail :reply_to => MailSanitizer.sanitize_address(contact.email), | ||
:subject => "#{ApiUmbrellaConfig[:site_name]} Contact Message from #{contact.email}", | ||
:to => ApiUmbrellaConfig[:web][:contact_form_email] | ||
:to => MailSanitizer.sanitize_address(ApiUmbrellaConfig[:web][:contact_form_email]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class MailSanitizer | ||
class InvalidAddress < StandardError | ||
end | ||
|
||
# A workaround to address OSVDB-131677 that is patched in the mail 2.6 gem, | ||
# but since we're still on Rails 3.2, we can't upgrade yet. | ||
# | ||
# If the fixes get backported (https://github.com/mikel/mail/issues/944), | ||
# then we could get rid of this, but in the meantime, this is a quick fix to | ||
# address the underlying issues related to newlines and lengths. | ||
# | ||
# See: | ||
# http://rubysec.com/advisories/OSVDB-131677/ | ||
# http://www.mbsd.jp/Whitepaper/smtpi.pdf | ||
def self.sanitize_address(address) | ||
if(address) | ||
# Ensure no linebreaks are in the address. | ||
if(address =~ /[\r\n]/) | ||
raise InvalidAddress, "E-mail address cannot contain newlines" | ||
end | ||
|
||
# Ensure the address doesn't exceed 500 chars to prevent some servers | ||
# from wrapping the content, introducing line breaks (technically, longer | ||
# should work, but 500 seems like enough for our simple purposes). | ||
if(address.length > 500) | ||
raise InvalidAddress, "E-mail address cannot exceed 500 characters" | ||
end | ||
end | ||
|
||
address | ||
end | ||
end |
Oops, something went wrong.