Commit df778898 authored by Nina's avatar Nina

Merge branch 'fix-248-sudo-message' into 'master'

do not recognize a sudo message as automated message - fix #248

Closes #248

See merge request !307
parents 77687f29 04132aed
Pipeline #32724 failed with stages
in 9 minutes and 19 seconds
......@@ -12,6 +12,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
* Allow Jenkins job notifications to reach lists. Before, such mails were rejected due to being "auto-submitted".
* Do not recognize sudo messages as automated message (#248)
## [3.4.1] / 2019-09-16
......
......@@ -213,7 +213,8 @@ module Mail
( self['Auto-Submitted'].present? && \
self['Auto-Submitted'].to_s.downcase != 'no' && \
!self['X-Cron-Env'].present? && \
!self['X-Jenkins-Job'].present?)
!self['X-Jenkins-Job'].present? && \
self.subject.to_s !~ /\A\*\*\* SECURITY information.*\*\*\*\Z/)
end
def keywords
......
......@@ -66,6 +66,19 @@ describe Mail::Message do
expect(mail.automated_message?).to be(false)
end
# https://0xacab.org/schleuder/schleuder/issues/248
it "recognizes a sudo message with 'Auto-Submitted'-header NOT as automated message" do
list = create(:list)
mail = Mail.new
mail.header['Auto-submitted'] = 'auto-generated'
mail.subject = '*** SECURITY information for host.example.com ***'
# Trigger the setting of mandatory headers.
mail.to_s
mail = Mail.create_message_to_list(mail.to_s, 'something@localhost', list).setup
expect(mail.automated_message?).to be(false)
end
context '#add_subject_prefix!' do
it 'adds a configured subject prefix' do
list = create(:list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment