keepasshttp icon indicating copy to clipboard operation
keepasshttp copied to clipboard

Enable use of regexp for matching sites

Open Skywalker-11 opened this issue 8 years ago • 3 comments

This PR enables the use of regular expressions to match the correct keepass entries for the provided url.

To use this add a string field for the keepass entries named KeePassHttp Settings and set the value to {"RegExp":"WHATEVER_URL_REGEXP"}.

In WHATEVER_URL_REGEXP (replace with the actual regexp you want to use) you have to escape every \ with an additional \ so that the regular expression for matching the character / for example would result in \\/ or for the character \ it would be \\\\. This is because the value is stored as a JSON string which itself uses \ for character escaping.

Example url matches for url https://example.org/this/is/a/path?with&parameters:

  • {"RegExp":"^https:\\/\\/example.org\\/this\\/is\\/a\\/path\?with&parameters$"} (exact match)
  • {"RegExp":"^https:\\/\\/example.org\\/this\\/is\\/a\\/path\?.*$"} (with&parameters can be anything)
  • {"RegExp":"^https:\\/\\/example.org\\/this\\/is\\/a\\/path\?"} (same: with&parameters can be anything)
  • {"RegExp":"^https:\\/\\/example.org\\/"} (all urls on example.org)
  • {"RegExp":"^https:\\/\\/.*\.example.org\\/"} (all urls on example.org including subdomains for example.org)
  • {"RegExp":"^https:\\/\\/example.(org|com)\\/"} (all urls on example.org and example.com)
  • {"RegExp":"example.org\\/"} (matches all protocols for example.org (https, http, ftp, etc.) BUT ALSO all urls that has ....example.org/.... in it

Skywalker-11 avatar Nov 05 '17 20:11 Skywalker-11

Could be used for #199, https://github.com/pfn/passifox/issues/633, https://github.com/pfn/passifox/issues/574, https://github.com/pfn/passifox/issues/312, https://github.com/pfn/passifox/issues/296, https://github.com/pfn/passifox/issues/172, https://github.com/pfn/passifox/issues/65

If this PR gets accepted I probably would also adjust the chromeIPass plugin to be able to edit the regexp in the gui

Skywalker-11 avatar Nov 05 '17 21:11 Skywalker-11

Hello, it's great to see there's finally an implementation targeting the original keepasshttp. I wonder if there's a possibility to add more features to this extension. For example, KeeFox supports 4 features: altURLs, regExURLs, blockedURLs, regExBlockedURLs, and all of them are arrays, so you can use multiple regular expressions via KeeFox. How about bringing this ability to KeePassHttp, too?

I have written a detailed description for KeeFox's protocol: https://github.com/keepassxreboot/keepassxc/issues/398#issuecomment-326755012

yan12125 avatar Nov 24 '17 19:11 yan12125

I've done almost exactly the same thing on my own. After i've done it and when i wanted to create a pull request, i saw this :) Nice work @Skywalker-11

Any news for PR accept from @pfn ?

Repo seems dead since a while, should the community fork it for a more active development?

brainfoolong avatar Feb 08 '18 09:02 brainfoolong