-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add option for ignoring specific mime type #170
Conversation
Addresses SUPERCILEX#92 Every time something is copied, this checks whether the clipboard is marked to contain the user-specified mime-type. This is useful, because some password-managers, like KeePassXC provide an additional MIME-Type ("x-kde-passwordManagerHint") to tell clipboard-managers about the sensitivity of the data.
Gut reaction is me no likey, but taking a step back this actually seems pretty reasonable. I guess my main concern is that this isn't applicable to other password managers. Would you mind either figuring out if something like 1Password does the mime type hint or asking folks on the issue to try copying a saved password and then check The settings should probably be a comma separated list. Or maybe we don't need a setting and can just hardcode ignoring entries with known password manager mime types? I'm also not convinced by the notification... why do we need it?
Nah, you're good. I made a big ol mess, so I'll figure out how to patch this into the various gnome versions. |
We surely don't need it, it was nice for testing, and I thought it wouldn't hurt, but it doesn't really matter. I did some further digging into the adoption of the x-kde-passwordManagerHint and it is not widely adopted.
This seems to have its origin at klipper (the kde clipboard history tool) original commit here and the issue on phabricator-kde introducing this change. Many other clipboard-managers have open issues about this:
Actually as i notice now, they all set the value to "secret". This change just checks if the MIME-Type is present at all right now. I am no sure whether this should be just a toggle switch and not support any other MIME-Types, because this seems to be the standard way (even though the name is a little bit obscure containing "kde"). |
This is phenomenal research, thank you! To me, it sounds like we should just hardcode the kde mime and have a "Try to avoid password managers" option with a more detailed explanation of what it does and why "try" is in there. As for checking for the value secret, if we can't do that I think it's fine? Or at least it sounds like the mime hint will always have the value secret when present. |
I'd say cut for the production release. |
Introduced check that x-kde-passwordManagerHint matches secret bytes. This seems to be part of the standard procedure Change "ignore" naming to "discard" Remove notification Hardcode single mimetype and change to toggle
I added a check for the content of the x-kde-passwordManagerHint. I was not sure how to do this properly, because the content of the callback has to influence the control flow. I am not sure if Promises are the right thing/we want something asynchronus there, but the call to check for the contents of x-kde-passwordManagerHint is only executed if the mime-type is even there. I found another problem: To reproduce do this fast(-er than the keepassxc-countdown): At some point, something adds a text/plain;charset=utf-8 at least to the xWayland-clipboard, maybe earlier (displayed with |
Ah, that's unfortunate. I was going to suggest saving the password to a variable and checking to see if the new clipboard entry matches, but that breaks if you copy two passwords in a row. I think we might just have to ignore that problem and say that applications which don't update TARGETS are broken. A more complicated solution that could be interesting is to activate and deactivate private mode when we see |
I believe so too, but I am not sure how this agrees with the conventions (where and why the
Yes, I think this would be a very good solution, because manual overrides are always nice. It also communicates to the user that the password wasn't copied by greying the icon, without generating a disturbing notification. I see a tiny issue with that approach: But just looking at it isolated, if private mode was enabled (because of copying somethin with the MIME), the user could believe to be in proper private-mode and have something saved to the history, despite that private mode was enabled before. I would suggest to add a third state (a temporary private mode), that displays something like a little clock. |
I also just realized that the asynchronus stuff doesnt seem to work at all with the promise. I got something wrong there. Edit: It works again :) |
I screwed something with the async stuff up and didn't notice it, because it still seemed to work. Now it has a proper timeout.
Hey, just wanted to let you know I'm still taking a look at this but will be busy until next week. Thanks for being patient. :) |
I like the idea of the mime recognition a lot (probably as I'm using KeepassXC as well). I am not keen of the idea to activate/deactivate private mode automatically though as I think that would be rather confusing to the user and adds complexity. Often, If I have copied a password I still want to be able to open the clipboard history to select another entry. Alternatively, if I have activated private mode before hand and copy a password then, the manager should not switch to any other mode. Maybe we could simply add a special entry to top of the history entry menu with type "redacted" as a placeholder that hints to the user that the current clipboard content is not saved to history. To make this persistent as well, the entry could be saved to the database with empty content and is only shown if it's the last entry in the list. I'd like this behavior: 1 Normal: 2 After copy of password: 3A After copy of a new string: 3B Or after selection of Entry A: |
I second this motion, this seems unnecessarily complicated from my perspective as a user, plus I don't see an issue which could be solved by a "manual override" or toggling private mode automatically. Windows uses |
TLDR; nothing at all I am not sure if I get what you mean correctly, but interacting with the clipboard is very OS dependent. Windows uses their Registered Clipboard Formats for that and on linux the Xserver/Compositor implements some kind of other protocol that uses MIME-Types (like in Emails) to advertise data formats. |
Sorry for dropping the ball here. Some context: I've been working on Ringboard, which is a replacement for this extension. As such, the extension is going to enter maintenance mode, meaning I won't be using it anymore and won't work on any of its issues. That said, I'll still be accepting PRs with small improvements (like this one!) or bug fixes. Back to this PR: since I'm winding this extension down, I don't want to add any code that could break stuff which means we need to keep things as simple as possible. Here's what I'd like to see:
To all the people in this thread: would this simplification still meet people's needs? |
Signed-off-by: Alex Saveau <[email protected]>
Can one of you confirm that my commit works? |
Signed-off-by: Alex Saveau <[email protected]>
I tested your commit and it seems to work fine. |
Signed-off-by: Alex Saveau <[email protected]>
Good point, done. |
Addresses #92
Some Password-managers like KeePassXC just pin on an additional MIME-Type (the type "x-kde-passwordManagerHint") to mark the current clipboard-content as sensitive.
I quickly created a small mockup of a setting that allows the user to specify such a type, which is to be ignored.
In short it just calls get_mimetypes on the clipboard and checks if the returned array contains the user-specified type.
It works for me in this state.
It is still very unpolished yet, and the hard work (like translations, testing) is still missing.
I would like to add a button to overwrite the decision to ignore the clipboard to the notification as well.
What do you think about the approach of filtering MIME-Types in general?
I am also a little bit unsure about the repo structure and the way the pre-45-branch is handled in contrast to master, please tell me if I did something wrong ^^