Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SPF parsing and IP evaluation #203

Merged
merged 5 commits into from
Jan 3, 2024
Merged

Conversation

MattIPv4
Copy link
Member

@MattIPv4 MattIPv4 commented Jan 3, 2024

Type of Change

  • Tool Source: SPF parsing

What issue does this relate to?

Fixes #201

What should this PR do?

Fixes the parsing issue with quotes in SPF records not being handled correctly.

Fixes the IP evaluation logic to properly understand CIDR blocks.

What are the acceptance criteria?

When loading the SPF records for facebook.com, the returned data for _spf.facebook.com does not include quotation marks.

When loading the SPF records for facebook.com, 66.220.144.129 evaluates successfully, and 123.456.123.456 does not.

@mikeyp
Copy link

mikeyp commented Jan 3, 2024

Looks like facebook.com is passing, but I tried a few others including digitalocean.com and got a runtime error:

Uncaught runtime errors:
×
ERROR
Invalid argument: <addr>/<prefix> expected
    at new m (http://localhost:8001/mount.js:2:376993)
    at Object.createCIDR (http://localhost:8001/mount.js:2:383228)
    at o.addNetworkClass (http://localhost:8001/mount.js:2:280829)
    at new o (http://localhost:8001/mount.js:2:280758)
    at new s (http://localhost:8001/mount.js:2:561705)
    at Object.import (http://localhost:8001/mount.js:2:561957)
    at Proxy.init (http://localhost:8001/mount.js:2:479474)
    at Proxy.mounted (http://localhost:8001/mount.js:2:477464)
    at http://localhost:8001/mount.js:2:128880
    at f (http://localhost:8001/mount.js:2:103443)
ERROR
Invalid argument: <addr>/<prefix> expected
    at new m (http://localhost:8001/mount.js:2:376993)
    at Object.createCIDR (http://localhost:8001/mount.js:2:383228)
    at o.addNetworkClass (http://localhost:8001/mount.js:2:280829)
    at new o (http://localhost:8001/mount.js:2:280758)
    at new s (http://localhost:8001/mount.js:2:561705)
    at Object.import (http://localhost:8001/mount.js:2:561957)
    at Proxy.init (http://localhost:8001/mount.js:2:479474)
    at Proxy.mounted (http://localhost:8001/mount.js:2:477464)
    at http://localhost:8001/mount.js:2:128880
    at f (http://localhost:8001/mount.js:2:103443)

@MattIPv4
Copy link
Member Author

MattIPv4 commented Jan 3, 2024

Good spot, I forgot that ip4 and ip6 also allow for bare IPs, rather than ranges.

Copy link

@mikeyp mikeyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MattIPv4 MattIPv4 merged commit a050b42 into master Jan 3, 2024
2 checks passed
@MattIPv4 MattIPv4 deleted the MattIPv4/fix-spf-parsing branch January 3, 2024 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IP Evaluate does not work for certain subnets
2 participants