Copyq: Blacklist to exclude selected applications

Created on 8 May 2014  路  36Comments  路  Source: hluk/CopyQ

Would it be possible to add blacklist functionality in order to exclude selected applications from being monitored i.e. password managers etc.?

Thanks.

Most helpful comment

@hluk None of the above seems to work reliably.

While CopyQ is excellent, the password issue (in combo with password managers such as the ones mentioned above) seems to create a security risk linked to the dat files containing the passwords. The dat files can be permissioned 600 but it still leaves the passwords in plain text inside those files which is not ideal.

CopyQ needs a definitive solution to interact with the password manager's "clearing" of the clipboard after x seconds (for example) in order to minimize this risk.

Also, can you please reopen this issue?

All 36 comments

This is already possible. You can use the predefined command with the name Ignore Password window as template. You just have to change the window title.

The command only disables clipboard storing to the item list.

I just fixed it so CopyQ window title and tray doesn't show the clipboard content too (87bef29c74dea6cdbb4cabfc8b3fd3a29b840579).

Thanks m4r71n

Ok, I have CopyQ ignoring KeePass now, but KeePass is unable to auto-clear the clipboard (after a preset period or at shutdown if so configured) if CopyQ is running. So I have adapted the Ignore Password window command as follows...

[Command]
Name=Ignore KeePass
Window=.\\kdbx - KeePass
Command=copyq ignore\nsleep 10\ncopyq copy\ncopyq remove 0
Automatic=true
Remove=true
Icon=\xf084

Oh, yes that's true. CopyQ will reset the clipboard to last content if it is emptied -- this usually happens if the application which sets the clipboard is closed -- in this case keeping the clipboard content can be quite handy.

The copyq remove 0 in your command shouldn't be required. Automatic command is applied on clipboard content before it's added to the list (if "Remove" check box is active, the clipboard content is simply not added).

I've fixed that an empty item is added to list after the clipboard is reset using copyq copy. So now you really shouldn't need the copyq remove 0 part.

Fix: 4efd5127dbbb1d9c0bc1b4752a541c59283b6f1a

Right, I've now replaced copyq remove 0 with copyq select 0, the net result is - I can copy and paste from KeePass without any trace remaining in the clipboard or CopyQ's history, and CopyQ remains in the same state it was before running KeePass - just how I wanted it.

Hi,
I also want CopyQ to ignore items, that I copied from KeePass. But I'm a beginner, so I don't understand the posts above.

I found the "commands -> Ignore _"Password"_ window"-page in the preferences, but entering the name of the KeePass-Window in the "window" field had no effect.

Can anybody try to explain it to me?

Thanks

Ignoramibus

Changing KeePass in the "Window" field should be enough to ignore clipboard if it's copied from window with title containing KeePass.

I was actually fixing this some more. You can test it with new beta version:
https://dl.dropboxusercontent.com/u/70670839/copyq-2.2.0-beta-7e4f520-windows.zip
https://dl.dropboxusercontent.com/u/70670839/copyq-2.2.0-beta-7e4f520-setup.exe

You'll have to re-add the example command Ignore "Password" window since it changed a bit.

Thank you for your answer, hluk. But I already tried with "KeePass" in the "Window"-field. It doesn't work. I checked "Automatic" and "Remove Item", all other fields I left free.

Maybe I should have mentioned that I use Ubuntu 14.04, not Windows .... Is there a new version for Ubuntu?

Regards

Ignoramibus

Now it works (version 2.2.0), thank you.

But now KeePass doesn't forget the copied item after the predefined time. I guess, that's a KeePass-Problem, isn't it?

Ignoramibus

As mentioned above, when clipboard is emptied CopyQ resets it to the last content. Use following command mentioned by @fade2gray to fix it.

[Command]
Name=Ignore KeePass
Window=KeePass
Command=copyq ignore\nsleep 10\ncopyq copy\ncopyq select 0
Automatic=true
Remove=true
Icon=\xf084

It still doesn't work. I took exactly the commands above ... The item is stored in CopyQ and stays there. I have no doubt, that the command is the right one. So I see only two possible reasons:

  1. the window-title is wrong. But when I take the exact title (in my case: KeePassDB.kdbx - KeePass", I get an error message immediatly after copying ("CopyQ client error: Name "ignore sleep" doesn't refer to a function".
  2. or there is some other setting in the preferences, I have to change. But I have no idea.

Ignoramibus

Copy the whole code above to command list in "Commands" configuration tab in CopyQ.
Field "Command" should then contain:

copyq ignore
sleep 10
copyq copy
copyq select 0

Oh, I'm so stupid!
I wrote (i.e. copied) "\n" instead of taking a new line! Of course it works now.

Thanks for your patience.

Ignoramibus

No, don't worry about that. It's not really obvious that the [Command] section can be copied into configuration dialog. Perhaps there should be some hint telling you that command is in clipboard -- though I don't want to make it too easy to copy and use foreign commands -- that sounds quite dangerous.

This does not work for me, using Xubuntu 14.04, Copyq 2.4.0, KeePass 2.25.

The ignore command works, applied to other applications, but when I set the window title to "KeePass" it does not work as expected.

  • It works when selecting an entry in KeePass, right click -> clipboard -> copy entries.
  • It does not work when copying username/password (ctrl-b/ctrl-c/double click) of an entry.

This works for me when copying from KeePassX. Can you try it with the newest version?

I am using KeePass, not KeePassX.

image

You check if the window title is correctly recognized using following command (copy/paste to command list in Command dialog [F6]).

[Command]
Name=Show Window Title for Clipboard
Command="
    copyq:
    popup(\"Window Title\", data(\"application/x-copyq-owner-window-title\"), 4000)"
Automatic=true
Icon=\xf016
GlobalShortcut=DISABLED

Copy the content again and popup should show which window title the clipboard is from (you can copy the popup content with mouse right-click).

(Cool, one can copy the command into the dialog.)

This is the problem: When copying username/password by double click, KeePass puts itself into background (minimizes) and the window title shown by copyq is the title of the (then) currently active window (not KeePass).

If I disable the "drop to background after copy" option in KeePass, it works as expected.

Thank you.

A comment on the clearing of the clipboard after a certain delay. What I observe is the following.

I setup copyq to ignore stuff copied from KeePass, but at the moment when KeePass clears the clipboard, the clipboard content is captured by copyq. I do not really understand why actually. copyq listens for clipboard changes and captures the new values, right? Now, when a password is copied to the clipboard from KeePass, then this is ignord. OK. But when now KeePass clears the clipboard, the new value shoud be "nothing", but copyq picks up the old content, the password. Why?

If the extend the ignore action command to

copyq ignore
sleep 10
copyq copy
copyq select 0

The I get an infinite loop, because

copyq copy

does not set the clipboard content to something empty, but instead it issues a Ctrl+C, which copies what ever is currently selected and in focus. If this is an entry in KeePass, this goes on forever.

Well, the scripting functionality is powerful enough to break the app. I could try to add some guards so the instance that does the Ctrl+C will not run automatic commands on that new content -- on the other hand this could be bad if Ctrl+C is done on an active window is the one that should be ignored (with an automatic command).

I noticed that clipboard is kept even if the clipboard owner is closed or clipboard content reset (on X11). I'm not entirely sure why but this happens even if CopyQ is not running. I should be probably solved by checking in clipboard monitor if the clipboard content has really changed.

See: #319

The problem in (at least Linux) is that CopyQ sends a Crtl-C. So if I'm working on the commandline and copy a password from Keepass, it sends a ctrl-c after 10 seconds.

I (may) have fixed it by using this command:

copyq ignore
sleep 10
copyq copy('this is a test')
copyq select 0

Not sure what kind of side effects it has but for now it seems to work in that it doesn't store my password in CopyQ and it doesn't send a ctrl-c to my GUI (command line)

Yes, copyq copy without further parameters invokes Ctrl+C in currently focused application. Command copyq copy "TEXT" copies "TEXT". to clipboard.

Funny thing is that running copyq copy in terminal interrupts the process (because that's what Ctrl+C usually does there).

Anyway, if window title filtering doesn't work, you can also check copy clipboard "?" if there are any interesting data formats which can be used to ignore the clipboard.

On Linux you also might need to filter mouse selections or disable storing items from selection in configuration dialog.

I can't seem to get this working with KeePassXC on Linux.
Should the above be applicable now as well?

I can't seem to get this working with KeePassXC on Linux.
Should the above be applicable now as well?

I use following command so as CopyQ doesn't store stuff copied from KeePassXC.

[Command]
Automatic=true
Command="
    copyq ignore"
Icon=\xf069
Name=Ignore *\"Password\"* window
Remove=true
Window=" - KeePass"

@roded How do you copy passwords from KeePassXC? Is - KeePass part of the window title of the app?

@hluk, disabling the "minimize on copy" option for KeePassXC solves the issue.
Is my understanding correct that there's no current solution to this for CopyQ?

Did anyone get this working with 1password popup window?

disabling the "minimize on copy" option for KeePassXC solves the issue.
Is my understanding correct that there's no current solution to this for CopyQ?

Except checking current window title, there is no other way CopyQ would know that the copied content is a secret and should be ignored.

Did anyone get this working with 1password popup window?

I'm guessing, it's the same problem as with KeePassXC and minimizing the window after copying the password.

If you can figure out a regular expression matching your passwords, you can use following command.

[Command]
Automatic=true
Command="
    copyq notification \\
      .id password_notification \\
      .time 2000 \\
      .title 'Secret Copied'
Icon=\xf084
Input=text/plain
Match=^\\S*[a-zA-Z]+\\S*[0-9]+\\S*[a-zA-Z]+\\S*$
Name=Ignore Passwords and Secrets
Remove=true

It uses ^\S*[a-zA-Z]+\S*[0-9]+\S*[a-zA-Z]+\S*$ to match a series of non-whitespace characters with some digits in between bunch of letters. But obviously there could be false positives.

@hluk None of the above seems to work reliably.

While CopyQ is excellent, the password issue (in combo with password managers such as the ones mentioned above) seems to create a security risk linked to the dat files containing the passwords. The dat files can be permissioned 600 but it still leaves the passwords in plain text inside those files which is not ideal.

CopyQ needs a definitive solution to interact with the password manager's "clearing" of the clipboard after x seconds (for example) in order to minimize this risk.

Also, can you please reopen this issue?

Hi, could not find the option to blacklist the Bitwarden firefox extension - is the blacklist option only available for apps and not for the said Firefox extension.

Thank you for reply and time.

@fyanchev Maybe this can help? There is also #1068 with some ideas how to solve it. I'll try to update FAQ.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

beefeater7 picture beefeater7  路  8Comments

m4r71n picture m4r71n  路  5Comments

bsucker98 picture bsucker98  路  4Comments

Gitoffthelawn picture Gitoffthelawn  路  8Comments

reagle picture reagle  路  4Comments