Skip to content

Commit

Permalink
Merge pull request #74 from zkemail/dimidumo/fix-readme
Browse files Browse the repository at this point in the history
chore: fix readme for testing
  • Loading branch information
DimiDumo authored Oct 25, 2024
2 parents 3319327 + ab11997 commit 1affdca
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ The regular expressions supported by our compiler version 2.1.1 are **audited by
5. Regular expressions that, when converted to DFA, have multiple accepting states are not supported.
6. Decomposed regex defintions must alternate public and private states.

Note that all international characters are supported.
Note that all international characters are supported.

If you want to use this circuit in practice, we strongly recommend using [AssertZero](https://github.com/zkemail/zk-email-verify/blob/29d5c873161c30ebb98a00efb3a145275d0f0833/packages/circuits/utils/array.circom#L144) on the bytes before and after your match. This is because you likely have shift viaan unconstrained index passed in as the witnesss to represent the start of the regex match. Since that value can be arbitrarily manipulated, you need to manually constrain that there are no extra matches that can be used to exploit the circuit. You can see how we do this in [zk-email here](https://github.com/zkemail/zk-email-verify/blob/29d5c873161c30ebb98a00efb3a145275d0f0833/packages/circuits/email-verifier.circom#L99).

Expand Down Expand Up @@ -90,7 +90,7 @@ You can generate its regex circom as follows.
This command generates a regex circom from a raw string of the regex definition and a json file that defines state transitions in DFA to be revealed.
For example, to verify the regex `1=(a|b) (2=(b|c)+ )+d` and reveal its alphabets,
1. Visualize DFA of the regex using [this website](https://zkregex.com).
2. Find state transitions matching with the substrings to be revealed. In this case, they are `2->3` for the alphabets after `1=`, `6->7` and `7->7` for those after `2=`, and `8->9` for `d`.
2. Find state transitions matching with the substrings to be revealed. In this case, they are `2->3` for the alphabets after `1=`, `6->7` and `7->7` for those after `2=`, and `8->9` for `d`.
3. Make a json file at `./simple_regex_substrs.json` that defines the state transitions. For example,
```
{
Expand Down Expand Up @@ -122,7 +122,7 @@ For example, to verify the regex `1=(a|b) (2=(b|c)+ )+d` and reveal its alphabet
```
4. Run `zk-regex raw -r "1=(a|b) (2=(b|c)+ )+d" -s ./simple_regex_substrs.json -c ./simple_regex.circom -t SimpleRegex -g true`. It outputs a circom file at `./simple_regex.circom` that has a `SimpleRegex` template.
<!--
<!--
The CLI will generate the circuit file in the folder `./build`. For example, the following command
```
Expand Down Expand Up @@ -151,6 +151,12 @@ Welcome any questions, suggestions or PRs!
### Testing
You will need to have bun installed:
```bash
curl -fsSL https://bun.sh/install | bash
```

```bash
yarn test
```
Expand All @@ -177,4 +183,4 @@ Use this bibtex citation.
## Assumptions
Some email providers put not only the sender's email address but also their username to the From field.
ALthough its concrete formats differ among email providers, our FromAddrRegex template assumes that the email address appears at the end of the From field.
If this assumption does not hold, i.e., the username appears after the email address, an adversary can output an arbitrary email address from that template by including a dummy email address in the username.
If this assumption does not hold, i.e., the username appears after the email address, an adversary can output an arbitrary email address from that template by including a dummy email address in the username.

0 comments on commit 1affdca

Please sign in to comment.