News for hackers. Stuff that matters.
Re:The weight of the clipboard by myself248 on Wednesday January 05, 2022 @11:19AM (#29810918)
I have always wanted a "clipboard firewall", such that apps on List A can never copy and paste between apps on List B. Basically two separate clipboards.

If I want to move things between them, I should open the clipboard manager and manually move an individual item, or bridge the two clipboards for a specified time, after which they go back to being isolated.

Is that sensible/practical?

Re:The weight of the clipboard by hateful on Wednesday January 05, 2022 @02:24PM (#29813646)
I wonder if it could be done with AutoHotKey. Perhaps having a global script variable for each List. AutoHotKey already supports interacting with the clipboard and targeting different Apps/Windows based on a number of criteria (class, title, exe, pid). So when you hit Ctrl+c or Ctrl+v you would hit logic to direct the clipboard contents to one of your list variables, then when you hit Ctrl+v it would do a similar check. You could even map a different key for a "global" clipboard (e.g. Ctrl+Shift+v or the rightCtrl+v).

All of my AutoHotKey triggers are off of the right control since I noticed a long time ago that I never use it regularly. In the old days (~2004) I would use it to write HTML. Hitting right Control+a for example would surround the text with an <a> and have logic for @ or http: etc - or hitting right Control+l would surround a list of items with <ol><li>. These days I have very few macros, the most useful one being code that will "type" what's on my clipboard rather than paste it which is useful for places that don't allow pasting.

>^v:: SendRaw %clipboard% Return

Re:The weight of the clipboard by CyberShadow on Wednesday January 05, 2022 @11:36AM (#29811181)
From a security perspective, I don't think it's possible to do with the standard OS APIs.

When an application makes data available in the clipboard, it's a free-for-all for every other application. The clipboard manager would have to race other applications to make a copy of the data, and then empty the OS clipboard.

APIs also may not allow making decisions based on which application requested the clipboard. It's possible to do in X11, but not Windows.

This goal could be achievable by intercepting the OS clipboard API. On X11, this can be done by MITM-ing the connection to the X server - https://github.com/CyberShadow/hax11 does this, and already has one clipboard-related security feature (disabling the selection mechanism). On Windows, the best bet is probably global DLL injection and API hooks, but applications can "opt out" by running as a different user or requesting a higher integrity level.