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

Fixing email address and domain regexes. #68

Merged
merged 5 commits into from
Sep 4, 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
2 changes: 1 addition & 1 deletion packages/apis/src/decomposed_defs/body_hash.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)dkim-signature:"
"regex_def": "(\r\n|^)dkim-signature:"
},
{
"is_public": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/apis/src/decomposed_defs/email_addr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parts": [
{
"is_public": true,
"regex_def": "[A-Za-z0-9!#$%&'*+=?^_`{|}~.]+@[A-Za-z0-9.-]+"
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\-\\^_`{|}~./@]+@[A-Za-z0-9.\\-]+"
}
]
}
}
4 changes: 2 additions & 2 deletions packages/apis/src/decomposed_defs/email_addr_with_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
},
{
"is_public": true,
"regex_def": "[a-zA-Z0-9!#$%&'*+-/=?^_`{\\|}~\\.]+@[a-zA-Z0-9_\\.-]+"
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\-\\^_`{|}~./@]+@[a-zA-Z0-9.\\-]+"
},
{
"is_public": false,
"regex_def": ">"
}
]
}
}
10 changes: 3 additions & 7 deletions packages/apis/src/decomposed_defs/email_domain.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
"parts": [
{
"is_public": false,
"regex_def": "[A-Za-z0-9!#$%&'*+-/=?^_`{\\|}~\\.]+"
},
{
"is_public": false,
"regex_def": "@"
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\-\\^_`{|}~./]+@"
},
{
"is_public": true,
"regex_def": "[A-Za-z0-9\\.-]+"
"regex_def": "[A-Za-z0-9.\\-@]+"
}
]
}
}
6 changes: 3 additions & 3 deletions packages/apis/src/decomposed_defs/from_addr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)from:"
"regex_def": "(\r\n|^)from:"
},
{
"is_public": false,
"regex_def": "([^\r\n]+<)?"
},
{
"is_public": true,
"regex_def": "[A-Za-z0-9!#$%&'\\*\\+-/=\\?^_`{\\|}~\\.]+@[A-Za-z0-9\\.-]+"
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\-\\^_`{|}~./@]+@[A-Za-z0-9.\\-]+"
},
{
"is_public": false,
"regex_def": ">?\r\n"
}
]
}
}
30 changes: 15 additions & 15 deletions packages/apis/src/decomposed_defs/from_all.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)from:"
},
{
"is_public": true,
"regex_def": "[^\r\n]+"
},
{
"is_public": false,
"regex_def": "\r\n"
}
]
}
"parts": [
{
"is_public": false,
"regex_def": "(\r\n|^)from:"
},
{
"is_public": true,
"regex_def": "[^\r\n]+"
},
{
"is_public": false,
"regex_def": "\r\n"
}
]
}
2 changes: 1 addition & 1 deletion packages/apis/src/decomposed_defs/message_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)message-id:"
"regex_def": "(\r\n|^)message-id:"
},
{
"is_public": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/apis/src/decomposed_defs/subject_all.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)subject:"
"regex_def": "(\r\n|^)subject:"
},
{
"is_public": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/apis/src/decomposed_defs/timestamp.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)dkim-signature:"
"regex_def": "(\r\n|^)dkim-signature:"
},
{
"is_public": false,
Expand Down
6 changes: 3 additions & 3 deletions packages/apis/src/decomposed_defs/to_addr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)to:"
"regex_def": "(\r\n|^)to:"
},
{
"is_public": false,
"regex_def": "([^\r\n]+<)?"
},
{
"is_public": true,
"regex_def": "[a-zA-Z0-9!#$%&'\\*\\+-/=\\?^_`{\\|}~\\.]+@[a-zA-Z0-9_\\.-]+"
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\-\\^_`{|}~./@]+@[a-zA-Z0-9.\\-]+"
},
{
"is_public": false,
"regex_def": ">?\r\n"
}
]
}
}
30 changes: 15 additions & 15 deletions packages/apis/src/decomposed_defs/to_all.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"parts": [
{
"is_public": false,
"regex_def": "((\r\n)|^)to:"
},
{
"is_public": true,
"regex_def": "[^\r\n]+"
},
{
"is_public": false,
"regex_def": "\r\n"
}
]
}
"parts": [
{
"is_public": false,
"regex_def": "(\r\n|^)to:"
},
{
"is_public": true,
"regex_def": "[^\r\n]+"
},
{
"is_public": false,
"regex_def": "\r\n"
}
]
}
4 changes: 3 additions & 1 deletion packages/circom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

Circom circuits for regex verification in [zk-regex](https://github.com/zkemail/zk-regex/tree/main).
This package contains circom circuits and decomposed regex definitions for common regexes in `./circuits/common` folder.


## Note
Our `email_domain_regex.circom` circuit cannot capture an email address that contains "@" in the name part before the domain part, e.g., "[email protected]@dummy.com", due to limitation of our circuit construction. For example, when "[email protected]@dummy.com" is given, that circuit outputs not "dummy.com" but "[email protected]" as an exposed substring for the domain. However, an adversary cannot exploit this feature to expose a fake domain since the true domain at the end will also be revealed along with it.
4 changes: 2 additions & 2 deletions packages/circom/circuits/common/email_addr.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"parts": [
{
"is_public": true,
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\^_`{|}~.]+@[A-Za-z0-9.-]+"
"regex_def": "[A-Za-z0-9!#$%&'*+=?\\-\\^_`{|}~./@]+@[A-Za-z0-9.\\-]+"
}
]
}
}
Loading
Loading