Skip to content

Commit

Permalink
Adjust max domain length check from 63 to 255
Browse files Browse the repository at this point in the history
  • Loading branch information
titussanchez committed May 31, 2024
1 parent fd6b5f7 commit ce88c12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions resources/spf/basic.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# If the <domain> is malformed (e.g., label longer than 63 characters,
# If the <domain> is malformed (e.g., total length longer than 255 characters,
# zero-length label not at the end, etc.) or is not a multi-label
# domain name, or if the DNS lookup returns "Name Error" (RCODE 3, also
# known as "NXDOMAIN" [RFC2308]), check_host() immediately returns the
# result "none".

name: Malformed Domains
records:
spf: extremely.ridiculously.long.domain.name.that.should.fail.immediately.com v=spf1 +all
spf: this.domain.name.is.extremely.long.because.we.want.to.explicitly.show.that.the.maximum.length.of.a.domain.name.is.255.characters.so.this.one.will.definitely.fail.immediately.due.to.its.excessive.length.and.ridiculously.large.number.of.characters.which.makes.it.invalid.com v=spf1 +all
spf: nolabels v=spf1 +all
spf: none.test.org v=something-else not=spf for=sure
tests:
- domain: extremely.ridiculously.long.domain.name.that.should.fail.immediately.com
sender: sender@extremely.ridiculously.long.domain.name.that.should.fail.immediately.com
- domain: this.domain.name.is.extremely.long.because.we.want.to.explicitly.show.that.the.maximum.length.of.a.domain.name.is.255.characters.so.this.one.will.definitely.fail.immediately.due.to.its.excessive.length.and.ridiculously.large.number.of.characters.which.makes.it.invalid.com
sender: sender@this.domain.name.is.extremely.long.because.we.want.to.explicitly.show.that.the.maximum.length.of.a.domain.name.is.255.characters.so.this.one.will.definitely.fail.immediately.due.to.its.excessive.length.and.ridiculously.large.number.of.characters.which.makes.it.invalid.com
ip: 172.168.0.1
expect: none
- domain: nolabels
Expand Down
2 changes: 1 addition & 1 deletion src/spf/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl Resolver {
sender: &str,
) -> SpfOutput {
let output = SpfOutput::new(domain.to_string());
if domain.is_empty() || domain.len() > 63 || !domain.has_labels() {
if domain.is_empty() || domain.len() > 255 || !domain.has_labels() {
return output.with_result(SpfResult::None);
}
let mut vars = Variables::new();
Expand Down

0 comments on commit ce88c12

Please sign in to comment.