mailauth 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/mailauth/arc.rb +1 -1
- data/lib/mailauth/dkim.rb +18 -3
- data/lib/mailauth/version.rb +1 -1
- data/mailauth.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49dfab12d1bcd9e138fd09d613b66d5ffa150cbd4d73ce381e10a07a6aa3e3f2
|
|
4
|
+
data.tar.gz: 99e7290474ee3fe5054e05b23041cdf93b9f91d174f7d7ed23dd7ded0743b9e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5381265ba7b84d464781bbca0428c1ceec111b93eea103095545301d381a4b4bfbfc55fb34bf47e5ffd8921700a531bb83d965dc3c3d087739a72452e53a7e3b
|
|
7
|
+
data.tar.gz: '06093aba36c61e9a818afc9c82749416cee178345136cc3473877d5bc5354dd460189bfa02963d82354e38a4ce168b8a07412421c7b78f7c19cf2d826a8835e5'
|
data/CHANGELOG.md
CHANGED
data/lib/mailauth/arc.rb
CHANGED
|
@@ -44,7 +44,7 @@ module MailAuth
|
|
|
44
44
|
Dkim.parse_tags(value_of(field).to_s)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
#
|
|
47
|
+
# RFC 8617 never registered sha1; DKIM's list matches only since retiring it.
|
|
48
48
|
def self.signing_algorithm?(algorithm)
|
|
49
49
|
SIGNING_ALGORITHMS.include?(signing_algorithm(algorithm)) && HASHES.include?(hash_algorithm(algorithm))
|
|
50
50
|
end
|
data/lib/mailauth/dkim.rb
CHANGED
|
@@ -17,7 +17,8 @@ module MailAuth
|
|
|
17
17
|
# the algorithm is unsupported, or the key is unreadable.
|
|
18
18
|
class Malformed < StandardError; end
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
# RFC 8301 §3.1 retired rsa-sha1: a verifier must not consider one valid.
|
|
21
|
+
HASHES = { "sha256" => OpenSSL::Digest::SHA256 }.freeze
|
|
21
22
|
SIGNING_ALGORITHMS = %w[ rsa ed25519 ].freeze
|
|
22
23
|
|
|
23
24
|
# What OpenSSL calls a key, mapped to what a= calls it.
|
|
@@ -29,6 +30,10 @@ module MailAuth
|
|
|
29
30
|
# RFC 6376 §3.2: ALPHA *ALNUMPUNC.
|
|
30
31
|
TAG_NAME = /\A[a-zA-Z][a-zA-Z0-9_]*\z/n
|
|
31
32
|
|
|
33
|
+
# RFC 6376 §8.4. Each signature costs a lookup for a key its sender named,
|
|
34
|
+
# and headers are cheap to write, so only the first so many are answered.
|
|
35
|
+
MAXIMUM_SIGNATURES = 10
|
|
36
|
+
|
|
32
37
|
# Shorter RSA keys are factorable cheaply enough to prove nothing.
|
|
33
38
|
MINIMUM_RSA_BITS = 1024
|
|
34
39
|
|
|
@@ -37,10 +42,20 @@ module MailAuth
|
|
|
37
42
|
ED25519_SPKI_PREFIX = [ "302a300506032b6570032100" ].pack("H*")
|
|
38
43
|
|
|
39
44
|
def self.verify(message, resolver: Resolver.new, now: Time.now)
|
|
40
|
-
|
|
45
|
+
fields = message.fields_named("dkim-signature")
|
|
46
|
+
|
|
47
|
+
signatures = fields.first(MAXIMUM_SIGNATURES).map do |field|
|
|
41
48
|
Verification.new(message, field, resolver:, now:).result
|
|
42
49
|
end
|
|
43
|
-
|
|
50
|
+
|
|
51
|
+
# The ones left over are reported rather than dropped: a verifier that
|
|
52
|
+
# quietly ignores a signature says a message carried fewer than it did.
|
|
53
|
+
if fields.empty?
|
|
54
|
+
signatures << Signature.new(status: Status::NONE, comment: "message not signed")
|
|
55
|
+
elsif fields.length > MAXIMUM_SIGNATURES
|
|
56
|
+
signatures << Signature.new(status: Status::PERMERROR,
|
|
57
|
+
comment: "#{fields.length - MAXIMUM_SIGNATURES} more signatures not evaluated")
|
|
58
|
+
end
|
|
44
59
|
|
|
45
60
|
DkimResult.new(signatures:)
|
|
46
61
|
end
|
data/lib/mailauth/version.rb
CHANGED
data/mailauth.gemspec
CHANGED
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
|
9
9
|
spec.authors = [ "Simon Lev" ]
|
|
10
10
|
|
|
11
11
|
spec.summary = "Email authentication for Ruby."
|
|
12
|
-
spec.description = "Answers one question about a received message: is it really from who it says it's from?"
|
|
12
|
+
spec.description = "Answers one question about a received message: is it really from who it says it's from? Implements DKIM signing and verification, SPF, DMARC, and ARC."
|
|
13
13
|
|
|
14
14
|
spec.homepage = "https://github.com/mailpiece/mailauth"
|
|
15
15
|
spec.license = "MIT"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mailauth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Simon Lev
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0.2'
|
|
54
54
|
description: 'Answers one question about a received message: is it really from who
|
|
55
|
-
it says it''s from?'
|
|
55
|
+
it says it''s from? Implements DKIM signing and verification, SPF, DMARC, and ARC.'
|
|
56
56
|
executables: []
|
|
57
57
|
extensions: []
|
|
58
58
|
extra_rdoc_files: []
|