Skip to content

Commit

Permalink
Correct DNS bug (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhilto authored Jan 29, 2024
1 parent 412c83d commit ec23054
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 331 deletions.
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

0 comments on commit ec23054

Please sign in to comment.