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

Correct DNS False Negatives #160

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Testing/RegoTests/gmail/gmail02_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ test_DKIM_Correct_V1 if {
"domain": "test.name",
"rdata": ["v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaknWsKvtbTLAxtWSF5sDt"]
}
]
],
"domains": ["test.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand All @@ -37,7 +38,8 @@ test_DKIM_Correct_V2 if {
"domain": "test2.name",
"rdata": ["v=DKIM1;"]
}
]
],
"domains": ["test1.name", "test2.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand All @@ -60,7 +62,8 @@ test_DKIM_Incorrect_V1 if {
"domain": "test2.name",
"rdata": []
}
]
],
"domains": ["test1.name", "test2.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand All @@ -79,7 +82,8 @@ test_DKIM_Incorrect_V2 if {
"domain": "test.name",
"rdata": []
}
]
],
"domains": ["test.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand Down
44 changes: 8 additions & 36 deletions Testing/RegoTests/gmail/gmail03_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ test_SPF_Correct_V1 if {
# Test SPF when there's only one domain
PolicyId := "GWS.GMAIL.3.1v0.1"
Output := tests with input as {
"dkim_records": [
{
"domain": "test.name",
"rdata": ["v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaknWsKvtbTLAxtWSF5sDt+"]
}
],
"spf_records": [
{
"domain": "test.name",
"rdata": ["v=spf1 include:_spf.google.com ~all"]
}
]
],
"domains": ["test.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand All @@ -34,16 +29,6 @@ test_SPF_Correct_V2 if {
# Test SPF when there's multiple domains
PolicyId := "GWS.GMAIL.3.1v0.1"
Output := tests with input as {
"dkim_records": [
{
"domain": "test1.name",
"rdata": ["v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaknWsKvtbTLAxtWSF5sDt+"]
},
{
"domain": "test2.name",
"rdata": ["v=DKIM1;"]
}
],
"spf_records": [
{
"domain": "test1.name",
Expand All @@ -53,7 +38,8 @@ test_SPF_Correct_V2 if {
"domain": "test2.name",
"rdata": ["v=spf1 "]
}
]
],
"domains": ["test1.name", "test2.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand All @@ -67,16 +53,6 @@ test_SPF_Incorrect_V1 if {
# Test SPF when there's multiple domains and only one is correct
PolicyId := "GWS.GMAIL.3.1v0.1"
Output := tests with input as {
"dkim_records": [
{
"domain": "test1.name",
"rdata": ["v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaknWsKvtbTLAxtWSF5sDt+"]
},
{
"domain": "test2.name",
"rdata": ["v=DKIM1;"]
}
],
"spf_records": [
{
"domain": "test1.name",
Expand All @@ -86,7 +62,8 @@ test_SPF_Incorrect_V1 if {
"domain": "test2.name",
"rdata": []
}
]
],
"domains": ["test1.name", "test2.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand All @@ -100,18 +77,13 @@ test_SPF_Incorrect_V2 if {
# Test SPF when there's only one domain and it's wrong
PolicyId := "GWS.GMAIL.3.1v0.1"
Output := tests with input as {
"dkim_records": [
{
"domain": "test.name",
"rdata": ["v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlaknWsKvtbTLAxtWSF5sDt+"]
}
],
"spf_records": [
{
"domain": "test.name",
"rdata": []
}
]
],
"domains": ["test.name"]
}

RuleOutput := [Result | some Result in Output; Result.PolicyId == PolicyId]
Expand Down
Loading
Loading