Skip to content

Commit

Permalink
Add regex example to "Match detection for URIs" that is not broken
Browse files Browse the repository at this point in the history
I find it important that examples actually follow best practices. The
current regex one is not for two reasons:

1. Not escaping dots in URIs when writing regex is a mistake that is
often made, even by advanced regex people. I think this comes from the
way we humans look at URIs. Dots are so common in there, aren’t they?
Yes, but we write proper regular expressions here, not something in
between.

2. `^https://.*google\.com$` is an improper regex (as already pointed out
because it also matches `malicious-site.com`) that is only there to show
the weaknesses of regular expressions for this use case. I find such an
example very good for this purpose but there should also be a "good
example" that complements it.

I found such a "good example" that I hope is more useful and has no
unwanted loopholes.

Updates: bitwarden#41
Replaces: bitwarden#160
  • Loading branch information
ypid committed Feb 10, 2021
1 parent 93d279f commit 2412958
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _articles/features/uri-match-detection.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Regular expressions are an advanced option and can be quite dangerous if used in

Selecting **Regular expression** will prompt Bitwarden to offer auto-fill when the detected resources matches a specified [regular expression](https://en.wikipedia.org/wiki/Regular_expression){:target="_blank"}. Regular expressions are always *case insensitive*.

For example, if the URI vault `^https://.*google.com$` uses regular expression match detection:
For example, if the URI vault `^https://\.*google\.com$` uses regular expression match detection:

- **Auto-fill offered** for `https://google.com`, `https://sub.google.com`, `https://malicious-site.com?q=google.com`
- **Auto-fill not offered** for `http://google.com` or `https://yahoo.com`
Expand Down

0 comments on commit 2412958

Please sign in to comment.