-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support multiple URLs in a single entry #1769
Conversation
I like this, but for "magic attributes" we would want a prefix of some kind like "URL_ALT" and "URL_REGEX" and stick with uppercase. I assume in future revisions you will add a gui dialog or similar to prompt the user for the values and the details will be handled by the gui. |
I was having an idea about implementing this in a different way. Just 1 additional attribute with a list of urlencoded urls separated with a Also I don't see the need of the blocked url, you either have a whitelist or a blacklist. Having both is a no sense. Can you explain the need of the |
Sorry for the late response. Was busy on other stuffs.
Sounds reasonable. Added to TODO
Here's an issue - how to know which is a regular expression and which is not?
Actually I don't know what's the purpose of |
The Only my 2cent about making it KISS |
Do you suggest that only strings with |
I am tackling this issue in my advanced search work. I'll be posting it as PR tonight. Check out what i did when posted, we can extract the regex logic i made into a static function if need be. |
Rebased after the code formatting branch merged. No changes in functionality yet. |
What about having a key:
|
Thinking about this a little more.. Just change the order. Check if there is a match when in regex mode. If there is all good. If there isn't fallback and check if the host is the same. if they are indeed the same you return true, if they aren't return false. This will require a little of validation with the url field but it's required now as well since I don't reallt like passing the raw url content as regex |
How does the implementation of your code currently handles punycode attacks? (Or an even better question, is it actually vulnerable to this?) For example, if you go to this link (it's a demo page, so apart from showing the attack, harmless), and the browser shows https://www.apple.com, the browser is 'vulnerable' by not disambiguating any unicode characters to non-unicode. More information -> https://thehackernews.com/2017/04/unicode-Punycode-phishing-attack.html |
We don't and there is also not really a reason for it. We are not a web browser, we only save whatever the user enters into the URL field and when the user wants us to open a URL, all we do is open a browser which hopefully has mitigations against this kind of attack. |
I added a commit to migrate altURLs and regExURLs to URL_ALT and URL_REGEX. Similar to implicit migration of KDBX 3 -> KDBX 4, such a migraion also occurs at database saving. |
Sorry to bother, but is there any workaround or alternative way to do this, that can be used before this is merged? |
@MightyPork: this might be useful: #398 (comment) |
I now create linked accounts. (Clone Entry -> Replace Username and Password with References) It's not quite the same with regards to expiry and such. OTOH, it works well enough for now. |
thanks @kronn, this is easy and actually works. I never tried cloning before! |
Whatever is chosen for value format, it must either be super simple, or specified in extreme detail. This because there are more applications that read kdbx files (for example, I also use Keepass2Android) and ideally, these will be able to work seamlessly on the same data. What about this idea: if a URL value contains one of these characters |
I also like the idea of storing things in a single advanced attribute. But why not just store the URL list as JSON or whatever existing serialization format rather than inventing some ad-hoc way to pack multiple strings together? A GUI can be implemented later to hide the complexity from users. It also has the bonus point that plain or regex url can be easily identified by adding an extra field to the store object. Something like [
{ "type": 1, "url": "https://example.com"},
{ "type": 2, "url": "https://regex\\.(com|org)"}
] |
@Aetf .kdbx files already supports multi-values so using json is not neccesary. |
@erikvanoosten I'm not sure if JSON parsing is expensive for this small scale... But I get your point. :) I just feel guessing the URL type from special characters isn't right. |
@erikvanoosten What are multi-values? Sounds like a good idea for this. BTW, I guess deserializing JSON values is much faster than decryption :) |
@yan12125 You are right. However, unless you cache the results of the json deserialization (again not nice on a low end mobile phone), it will have to be done for each and every URL lookup, while the decryption result is always cached. |
@erikvanoosten I may be missing your specific use case on mobile, but for me, as a user, that'd be totally negligible. I use the mobile app to find a password once a day, often even less. Even on the PC I need it just a few times a day. I think you're micro-optimizing here. |
Json parsing is how the internet works, it is by far the fastest ascii based syntax. The only thing better that I know of is protobuf (binary). You CAN store multiple values in kdbx (that is what attributes are) but then you have to uniquely name each key. That presents it's own issues. We are introducing "custom attributes" from kdbx4 in v2.4, that might be an even better option. Really this PR boils down to UX, everything else trivial. |
Not sure if this is accidental or not... But the main / normal attribute that the GUI shows on the normal side tab of 'Entry' (so not under 'Advanced') of simply 'URL'... it would appear that it does accept a semicolon So for Steam I have... https://store.steampowered.com;https://steamcommunity.com When I'm in the main screen of KeePassXC (not editing the entry) it no longer shows this text as a working underlined/blue hyperlink. But what is interesting is... KeePassXC-Browser can now understand this entry has two sites to prompt for permission on. I'm not sure if this is intended or not - but please don't fix it until you've got an alternative in mind for multi-URL entries!!! I've tried the above method (the altURLs advanced attribute thingy) and it just plain doesn't work (yes I'm on 2.3.4) |
Made a GitHub account just to say thanks to you. |
@yan12125 can you change this to conform with the suggestion in #2356 (comment). I personally do not think it is necessary to support regex and all the other features. That should be done by the supporting plugins (Browser) instead. Just like how the current URL field works. |
Sorry, but I don't have much time before 11/13. I can update this PR then. |
Ok I'll punt this to 2.4.1 or 2.5 |
I look forward to this PR! (I am very tired of making copies of records for different URLs) |
Rebased with manual tests
Inclusion of <QDebug> was dropped in d612cad
I am closing this because we will implement this in 2.5.0 as part of our templates push. |
Thanks for the info and sorry for lack of time and knowledge for finishing. It's great to hear there will be a more general feature. Is there an issue or a PR for that feature? |
Not yet, that is a 2.5.0 planned feature |
As part of 863 then? |
Yes |
Thank you both! I guess I got the idea of templates. |
For anyone else reading this in the future and especially the above comments on using a semicolon or pipe to seperate URLs on the one URL field. Don't - if you use KeePassXC-Browser. It really confuses it and ends up asking for permission for sites which have nothing to do with the site you're currently on. |
Now there is official support for multiple URLs in KeePassXC. In case anyone else is using my branch, here is a patch to migrate from |
WARNING: This work is far from complete. Use at your own risk.
Description
This patch adds several custom fields to an entry to support more complex features than the existing
URL
field, including regular expressions and URL blacklists, for URL matching with KeePassXC-Browser.There are 4 new fields:
Currently only the first two are implemented. To use them, add custom fields from the Advanced page of an entry. For example, in my Facebook entry, I have https://www.messenger.com/ in URL and the following additional fields:
With those settings, KeePassXC-Browser will match https://www.messenger.com/, https://www.facebookcorewwwi.onion/ and all HTTPS URLs ending with facebook.com, like https://www.facebook.com/ and https://zh-tw.facebook.com/.
Motivation and context
As described in #398, supporting multiple URLs in a single bring convenience and benefits over using references.
How has this been tested?
I've used this for months.
Screenshots (if appropriate):
N/A
Types of changes
Checklist:
-DWITH_ASAN=ON
. [REQUIRED]Discussions
I steal this idea from KeeFox as described in #398 (comment). Another implementation for similar purpose can be found at pfn/keepasshttp#340, which implements one additional field
RegExp
. Maybe there's a better design than the two existing implementations.KeePassHTTP is dying, and KeePassXC is a pioneer for a native-messaging-based protocol, but I think we should at least talk with the author of https://github.com/smorks/keepassnatmsg on the design.
Is it better to put additional URLs in
KeePassXC-Browser Settings
than put them in standalone custom attributes? Currently I choose the latter approach for easy hand-editing, which might not be an issue if a GUI is implemented.Extensions to the
Allow
key inKeePassXC-Browser Settings
? For regExURLs, users need to update theAllow
key whenever a new domain name is accepted (by checking "Remember this decision" in confirm access dialog). Maybe adding a regular expression toAllow
is a good choice?TODO
Known issues
<form>
s. As a result, TOTP does not work with those additional fields.