dmarcator 1.2.0 → 1.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48797112128c5187471c9c2ad1f907c73450cf8ef0f6910e2a22815d74221222
4
- data.tar.gz: 89727b4555cc67beddbcb53dbbfb4845dc69e6cb8c66e37b8549fa7a4ec2ec36
3
+ metadata.gz: c588b9e28df99c70cd55c29c83854064092e2ff74436c9be680afc2b2a77824c
4
+ data.tar.gz: 3e6692aa15ea2aa28fa451dc847c3cadbd0cb36cdaf237e8bcb6e591206f92d0
5
5
  SHA512:
6
- metadata.gz: b6305c8a45f78711592f6a68b61236241d68a45410de08eaeeaa8e158b6337421e9b5d6c78b21ace4b0b38109fa74f3eec198ba4b5bbe6c2a49e5127ff2e69ff
7
- data.tar.gz: 20111fdcf9bd38ff20f48a2be10ffdf4aa946850643fca2a48696fa10c041f5b3a4d49d37f6deed32f9767ed758828fce1ade967a8c12fc52cd0c1adc2ede6a2
6
+ metadata.gz: 890fe93593dd8ae6cc2888910070d73606f2700ce3e6548b09cbfcca29f86067788894dbdd23d984a23a7662059514564f955ffdf476656d94110289603b8d4c
7
+ data.tar.gz: b3357457dbeb21bcd40dee7a412eacc9df9d60b148eae9b0f753c2ca6534d299f4ff6bd7585fcfcf67d4482eabc4f6227ac0878af1d839721de1e2cd7334853f
data/ChangeLog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 1.2.1 / 2026-10-30
2
+
3
+ * Add a record-parser corpus regression net: 143 records (published real-world records plus edge cases) with their accepted outcomes in lenient and strict mode, replayed by the test suite. A parser change that alters how any record parses now fails with a diff. Regenerate with `script/generate_record_corpus.rb`.
4
+ * Report a TCP response body shorter than its declared length as `short DNS response (expected N bytes, got M)`, instead of the opaque `malformed DNS response: limit exceeded`.
5
+
6
+ No public API changes.
7
+
1
8
  ### 1.2.0 / 2026-10-30
2
9
 
3
10
  * Plaintext lookups now use DNS over TCP (`DMARCator::Resolver::Plain`) instead of `Resolv::DNS`. `Resolv` reads UDP replies into a 512-byte buffer, so a larger answer cannot be decoded, is discarded, and the resulting timeout is swallowed. Any TXT set over 512 bytes — common for SPF and for domains with several DKIM keys — was therefore returned as an empty array, which is indistinguishable from "no records published". TCP has no such limit, and failures raise `ResolutionError`.
data/README.md CHANGED
@@ -367,6 +367,21 @@ To run the RSpec tests:
367
367
  rake spec
368
368
  ```
369
369
 
370
+ ### Record parser corpus
371
+
372
+ `spec/support/record_corpus.txt` holds representative records — real-world
373
+ published records and edge cases — and `spec/support/record_corpus.json` the
374
+ outcomes they produced when the corpus was last accepted. The suite replays both
375
+ in lenient and strict mode, so a parser change that alters how any of them parses
376
+ fails with a diff.
377
+
378
+ If such a change is intentional, regenerate the file and review the JSON diff in
379
+ the commit:
380
+
381
+ ```sh
382
+ ruby -Ilib script/generate_record_corpus.rb
383
+ ```
384
+
370
385
  ## Releasing
371
386
 
372
387
  Every published version must have an annotated tag pointing at the commit that
@@ -107,8 +107,13 @@ module DMARCator
107
107
  header = socket.read(2)
108
108
  raise ResolutionError, 'short DNS response' if header.nil? || header.bytesize < 2
109
109
 
110
- body = socket.read(header.unpack1('n'))
111
- raise ResolutionError, 'short DNS response' if body.nil?
110
+ length = header.unpack1('n')
111
+ body = socket.read(length)
112
+
113
+ if body.nil? || body.bytesize != length
114
+ raise ResolutionError,
115
+ "short DNS response (expected #{length} bytes, got #{body&.bytesize || 0})"
116
+ end
112
117
 
113
118
  body
114
119
  ensure
@@ -2,5 +2,5 @@
2
2
 
3
3
  module DMARCator
4
4
  # dmarcator version
5
- VERSION = '1.2.0'
5
+ VERSION = '1.2.1'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dmarcator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Berman