Bitwarden picks wrong credentials with a unique regex? #375

Closed
opened 2026-02-04 20:05:05 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @testeron7 on GitHub (Aug 13, 2019).

Regulair Expression:
^https://\b(\wtest1\w)\b.demo.com/wp-login.php

Tested on:https://regex101.com

https://test.demo.com/wp-login.php (no match)
https://test1.demo.com/wp-login.php (match)
https://test2.demo.com/wp-login.php (no match

I would expect that it fills the unique URI https://test1.demo.com/wp-login.php
and not the credentials from https://test.demo.com/wp-login.php?

Any thoughts why?

Originally created by @testeron7 on GitHub (Aug 13, 2019). Regulair Expression: ^https:\/\/\b(\w*test1\w*)\b\.demo\.com\/wp-login.php Tested on:https://regex101.com https://test.demo.com/wp-login.php (no match) https://test1.demo.com/wp-login.php (match) https://test2.demo.com/wp-login.php (no match I would expect that it fills the unique URI https://test1.demo.com/wp-login.php and not the credentials from https://test.demo.com/wp-login.php? Any thoughts why?
Author
Owner

@mprasil commented on GitHub (Aug 14, 2019):

I'm not entirely sure what you want to achieve. If you want to match the test1 URL, you probably need to write the regexp like this:

^https://\b(test1)\b.demo.com/wp-login.php

(Note the missing \w)

Although I'm not sure what you're trying to achieve here. Most of the complexity of the regexp is completely unnecessary, you don't need \b (word boudary) as you're matching explicit character sequence anyways. You don't need to use the brackets as you're not going to use the capturing group. If you want to match any testN site but not the "plain" test.demo.com you could just use something like:

^https://test[0-9]+.demo.com/wp-login.php

This will match test1.demo.com, test2.demo.com or even test34.demo.com but not test.demo.com. ([0-9]+ stands for one or more numbers)

@mprasil commented on GitHub (Aug 14, 2019): I'm not entirely sure what you want to achieve. If you want to match the test1 URL, you probably need to write the regexp like this: ``` ^https://\b(test1)\b.demo.com/wp-login.php ``` (Note the missing `\w`) Although I'm not sure what you're trying to achieve here. Most of the complexity of the regexp is completely unnecessary, you don't need `\b` (word boudary) as you're matching explicit character sequence anyways. You don't need to use the brackets as you're not going to use the capturing group. If you want to match any `testN` site but not the "plain" `test.demo.com` you could just use something like: ``` ^https://test[0-9]+.demo.com/wp-login.php ``` This will match `test1.demo.com`, `test2.demo.com` or even `test34.demo.com` but not `test.demo.com`. (`[0-9]+` stands for one or more numbers)
Author
Owner

@testeron7 commented on GitHub (Aug 14, 2019):

mprasil thanks fro the reply,

I was on the wrong foot because default bitwarden is not set to exact match so tryed to solve it with a regex. Default on exact matching is for new users a better option in my opinion.
Oh and your regex is better then mine, thanks for the explanation.

I run bitwarden_rs (self-compiled) and it works great this far.

@testeron7 commented on GitHub (Aug 14, 2019): mprasil thanks fro the reply, I was on the wrong foot because default bitwarden is not set to exact match so tryed to solve it with a regex. Default on exact matching is for new users a better option in my opinion. Oh and your regex is better then mine, thanks for the explanation. I run bitwarden_rs (self-compiled) and it works great this far.
Author
Owner

@mprasil commented on GitHub (Aug 15, 2019):

Great to hear the exact match works for you. I think the default is what it is as this was the only option way back when. Going to close this now.

@mprasil commented on GitHub (Aug 15, 2019): Great to hear the exact match works for you. I think the default is what it is as this was the only option way back when. Going to close this now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#375