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

Enable use of regexp for matching sites #340

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Skywalker-11
Copy link

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
Copy link
Author

Could be used for #199, pfn/passifox#633, pfn/passifox#574, pfn/passifox#312,
pfn/passifox#296, pfn/passifox#172, pfn/passifox#65

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

@yan12125
Copy link

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: keepassxreboot/keepassxc#398 (comment)

@ckotte ckotte mentioned this pull request Jan 28, 2018
3 tasks
@brainfoolong
Copy link

brainfoolong commented Feb 8, 2018

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?

Gallimathias referenced this pull request in Gallimathias/keepasshttp Feb 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants