-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
335 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Build CLI Docker Image | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image | ||
run: docker build . --file Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Run OPA Tests | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup OPA | ||
uses: open-policy-agent/setup-opa@v2 | ||
with: | ||
version: latest | ||
|
||
- name: Run OPA Tests | ||
run: opa test classification/rego/*.rego -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,63 @@ | ||
package classifier_address | ||
|
||
test_no_label { | ||
output.column == "UNLABELED" with input as {"column":"invalid"} | ||
import rego.v1 | ||
|
||
test_no_label if { | ||
output.column == false with input as {"column":"invalid"} | ||
} | ||
|
||
test_column_name_state { | ||
output.state == "ADDRESS" with input as {"state":"AZ"} | ||
test_column_name_state if { | ||
output.state == true with input as {"state":"AZ"} | ||
} | ||
|
||
test_insensitive_column_name_state { | ||
output.STATE == "ADDRESS" with input as {"STATE":"AZ"} | ||
test_insensitive_column_name_state if { | ||
output.STATE == true with input as {"STATE":"AZ"} | ||
} | ||
|
||
test_column_name_address { | ||
output.address == "ADDRESS" with input as {"address":"123 some street"} | ||
test_column_name_address if { | ||
output.address == true with input as {"address":"123 some street"} | ||
} | ||
|
||
test_insensitive_column_name_address { | ||
output.ADDRESS == "ADDRESS" with input as {"ADDRESS":"123 some street"} | ||
test_insensitive_column_name_address if { | ||
output.ADDRESS == true with input as {"ADDRESS":"123 some street"} | ||
} | ||
|
||
test_column_name_contains_address { | ||
output.some_address_here == "ADDRESS" with input as {"some_address_here":"123 some street"} | ||
test_column_name_contains_address if { | ||
output.some_address_here == true with input as {"some_address_here":"123 some street"} | ||
} | ||
|
||
test_insensitive_column_name_contains_address { | ||
output.some_ADDRESS_Here == "ADDRESS" with input as {"some_ADDRESS_Here":"123 some street"} | ||
test_insensitive_column_name_contains_address if { | ||
output.some_ADDRESS_Here == true with input as {"some_ADDRESS_Here":"123 some street"} | ||
} | ||
|
||
test_column_name_street { | ||
output.street == "ADDRESS" with input as {"street":"123 some street"} | ||
test_column_name_street if { | ||
output.street == true with input as {"street":"123 some street"} | ||
} | ||
|
||
test_insensitive_column_name_street { | ||
output.STREET == "ADDRESS" with input as {"STREET":"123 some street"} | ||
test_insensitive_column_name_street if { | ||
output.STREET == true with input as {"STREET":"123 some street"} | ||
} | ||
|
||
test_column_name_starts_with_street { | ||
output.street_name == "ADDRESS" with input as {"street_name":"123 some street"} | ||
test_column_name_starts_with_street if { | ||
output.street_name == true with input as {"street_name":"123 some street"} | ||
} | ||
|
||
test_insensitive_column_name_starts_with_street { | ||
output.STREET_Name == "ADDRESS" with input as {"STREET_Name":"123 some street"} | ||
test_insensitive_column_name_starts_with_street if { | ||
output.STREET_Name == true with input as {"STREET_Name":"123 some street"} | ||
} | ||
|
||
test_column_name_zip { | ||
output.zip == "ADDRESS" with input as {"zip":"11111"} | ||
test_column_name_zip if { | ||
output.zip == true with input as {"zip":"11111"} | ||
} | ||
|
||
test_insensitive_column_name_zip { | ||
output.ZIP == "ADDRESS" with input as {"ZIP":"11111"} | ||
test_insensitive_column_name_zip if { | ||
output.ZIP == true with input as {"ZIP":"11111"} | ||
} | ||
|
||
test_column_name_zipcode { | ||
output.zipcode == "ADDRESS" with input as {"zipcode":"11111"} | ||
test_column_name_zipcode if { | ||
output.zipcode == true with input as {"zipcode":"11111"} | ||
} | ||
|
||
test_insensitive_column_name_zipcode { | ||
output.ZIPCODE == "ADDRESS" with input as {"ZIPCODE":"11111"} | ||
test_insensitive_column_name_zipcode if { | ||
output.ZIPCODE == true with input as {"ZIPCODE":"11111"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,39 @@ | ||
package classifier_age | ||
|
||
test_no_label { | ||
output.column == "UNLABELED" with input as {"column":"invalid"} | ||
import rego.v1 | ||
|
||
test_no_label if { | ||
output.column == false with input as {"column":"invalid"} | ||
} | ||
|
||
test_column_name_age_invalid_age { | ||
output.age == "UNLABELED" with input as {"age":"120"} | ||
test_column_name_age_invalid_age if { | ||
output.age == false with input as {"age":"120"} | ||
} | ||
|
||
test_insensitive_column_name_age_invalid { | ||
output.AGE == "UNLABELED" with input as {"AGE":"120"} | ||
test_insensitive_column_name_age_invalid if { | ||
output.AGE == false with input as {"AGE":"120"} | ||
} | ||
|
||
test_column_name_age_single_digit { | ||
output.age == "AGE" with input as {"age":"1"} | ||
test_column_name_age_single_digit if { | ||
output.age == true with input as {"age":"1"} | ||
} | ||
|
||
test_insensitive_column_name_age_single_digit { | ||
output.AGE == "AGE" with input as {"AGE":"1"} | ||
test_insensitive_column_name_age_single_digit if { | ||
output.AGE == true with input as {"AGE":"1"} | ||
} | ||
|
||
test_column_name_age_double_digit { | ||
output.age == "AGE" with input as {"age":"10"} | ||
test_column_name_age_double_digit if { | ||
output.age == true with input as {"age":"10"} | ||
} | ||
|
||
test_insensitive_column_name_age_double_digit { | ||
output.AGE == "AGE" with input as {"AGE":"10"} | ||
test_insensitive_column_name_age_double_digit if { | ||
output.AGE == true with input as {"AGE":"10"} | ||
} | ||
|
||
test_column_name_age_triple_digit { | ||
output.age == "AGE" with input as {"age":"100"} | ||
test_column_name_age_triple_digit if { | ||
output.age == true with input as {"age":"100"} | ||
} | ||
|
||
test_insensitive_column_name_age_triple_digit { | ||
output.AGE == "AGE" with input as {"AGE":"100"} | ||
test_insensitive_column_name_age_triple_digit if { | ||
output.AGE == true with input as {"AGE":"100"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
package classifier_ccn | ||
|
||
test_no_label { | ||
output.column == "UNLABELED" with input as {"column":"invalid"} | ||
import rego.v1 | ||
|
||
test_no_label if { | ||
output.column == false with input as {"column":"invalid"} | ||
} | ||
|
||
test_valid_amex_ccn { | ||
output.message == "CCN" with input as {"message":"370136066365291"} | ||
test_valid_amex_ccn if { | ||
output.message == true with input as {"message":"370136066365291"} | ||
} | ||
|
||
test_valid_visa_ccn { | ||
output.message == "CCN" with input as {"message":"4613688275707134"} | ||
test_valid_visa_ccn if { | ||
output.message == true with input as {"message":"4613688275707134"} | ||
} | ||
|
||
test_valid_mastercard_ccn { | ||
output.message == "CCN" with input as {"message":"5423909386888564"} | ||
test_valid_mastercard_ccn if { | ||
output.message == true with input as {"message":"5423909386888564"} | ||
} | ||
|
||
# TODO : Fix pattern to match | ||
test_valid_mastercard_ccn { | ||
output.message == "CCN" with input as {"message":"2701306282695666"} | ||
test_valid_mastercard_ccn if { | ||
output.message == true with input as {"message":"2701306282695666"} | ||
} | ||
|
||
test_valid_discover_ccn { | ||
output.message == "CCN" with input as {"message":"6536673682309236"} | ||
test_valid_discover_ccn if { | ||
output.message == true with input as {"message":"6536673682309236"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
package classifier_cvv | ||
|
||
test_cvv_key { | ||
output.CVV == "CVV" with input as {"CVV":"test"} | ||
import rego.v1 | ||
|
||
test_cvv_key if { | ||
output.CVV == true with input as {"CVV":"test"} | ||
} | ||
|
||
test_cvv_key { | ||
output.cvv == "CVV" with input as {"cvv":"test"} | ||
test_cvv_key if { | ||
output.cvv == true with input as {"cvv":"test"} | ||
} | ||
|
||
test_cvv_key { | ||
output.CvV == "CVV" with input as {"CvV":"test"} | ||
test_cvv_key if { | ||
output.CvV == true with input as {"CvV":"test"} | ||
} | ||
|
||
test_cvv_pattern { | ||
output.message == "CVV" with input as {"message":"451"} | ||
test_cvv_pattern if { | ||
output.message == true with input as {"message":"451"} | ||
} | ||
|
||
test_cvv_pattern { | ||
output.message == "CVV" with input as {"message":"5061"} | ||
test_cvv_pattern if { | ||
output.message == true with input as {"message":"5061"} | ||
} | ||
|
||
test_cvv_pattern { | ||
output.message == "CVV" with input as {"message":"123"} | ||
test_cvv_pattern if { | ||
output.message == true with input as {"message":"123"} | ||
} | ||
|
||
test_cvv_pattern { | ||
output.message == "UNLABELED" with input as {"message":"12345"} | ||
test_cvv_pattern if { | ||
output.message == false with input as {"message":"12345"} | ||
} |
Oops, something went wrong.