mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 20:36:39 +08:00
always strip s/mime signatures in incoming emails
This commit is contained in:
parent
32b22996d0
commit
376881845c
|
@ -429,6 +429,9 @@ module Email
|
|||
def create_post_with_attachments(options={})
|
||||
# deal with attachments
|
||||
@mail.attachments.each do |attachment|
|
||||
# always strip S/MIME signatures
|
||||
next if attachment.content_type == "application/pkcs7-mime".freeze
|
||||
|
||||
tmp = Tempfile.new("discourse-email-attachment")
|
||||
begin
|
||||
# read attachment
|
||||
|
|
|
@ -5,7 +5,11 @@ module Validators; end
|
|||
class Validators::UploadValidator < ActiveModel::Validator
|
||||
|
||||
def validate(upload)
|
||||
return true if upload.is_attachment_for_group_message && SiteSetting.allow_all_attachments_for_group_messages
|
||||
# allow all attachments except S/MIME signatures
|
||||
# cf. https://meta.discourse.org/t/strip-s-mime-signatures/46371
|
||||
if upload.is_attachment_for_group_message && SiteSetting.allow_all_attachments_for_group_messages
|
||||
return upload.original_filename != "smime.p7s".freeze
|
||||
end
|
||||
|
||||
extension = File.extname(upload.original_filename)[1..-1] || ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user