-
-
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
Prevent screen capture on Windows and macOS #6030
Prevent screen capture on Windows and macOS #6030
Conversation
Didn't have time to test this, but on the macOS the same could possible be achieved via undocumented API function |
this would be good to have |
7189ba6
to
1421dfb
Compare
I greatly simplified your code and made it far less Windows centric. Will see if the macOS implementation can be added as well. |
1421dfb
to
1965b72
Compare
1965b72
to
b992e93
Compare
Got it! macOS screenshot protection enabled :-D |
Awesome! |
I've tested your changes and I found 1 problem. On windows, the modal windows of system file dialogs are not hidden from being captured by the screen recorder. For example when you browse for DB file or key file. I don't know if this is also the problem on macOS. This was the reason why I decided to handle prevention of app's screen being captured via native event filter. On Windows, I couldn't find any other way to do this through Qt framework and capture the native modal dialog belonging to the app being displayed. You don't get any signal or event whatsoever to notify you that another system dialog has opened that belongs to your app. So, the only solution I saw was to capture the native event WM_ENTERIDLE (WinUtils.cpp#L105) and hide the dialog that made the app idle. It's also possible there is some better solution to this problem, and I just didn't find it. |
Because of this feature, screensharing for example using Teams or Skype and co is no more possible as the Keeshare Window is also shown as a black window only in those cases so there should be a way to disable and enable it. |
Just discovered --allow-screencapture option from above, which also works in those cases |
Just tried 2.7.0 on macOS and wanted to make a screen capture to report a display issue and had a what the heck moment. I can't make a screen capture. Poking around and searching here I found this PR. Can/should there be an option in KPXC to allow screen captures instead of using terminal to start KPXC with --allow-screencapture? Won't this confuse users who want to make screen captures for training, documentation, whatever? How will users know to use --allow-screencapture from terminal? |
I just added it to our documentation so that's how. |
Just upgraded to 2.7 and had to spend a while trying to work out why this wasn't visible on any remote machines. Is there a setting to always open with "--allow-screencapture" without having to edit the auto-start entries / shortcuts? |
You add the flag to KeePassXC's auto-start entry. |
Or preferably, make a separate shortcut for only when that switch is actually needed. |
Create your own shortcuts, we aren't in the business of making it easy to circumvent a security feature. Actually wanting to screen record your database is very rare. |
I don't want to screen record the database. That probably is a rare thing. I just want to use it over a remote desktop connection. I can edit the shortcuts if that is the only option. I was just hoping there was a easier option. |
Thanks for working hard to make this feature available. |
Hello, how do you use the --allow-screencapture command on a windows shortcut. I use keepass via team wiever but with this option set up it is impossible for me to use it |
On Windows this PR makes KeePassXC main window and all it's child windows invisible for screen recording and screen shooting.
This is done by capturing native events
WM_NCCREATE
&WM_ENTERIDLE
, and setWDA_EXCLUDEFROMCAPTURE
display affinity flag via SetWindowDisplayAffinity to the window in action or modal dialog. If for any reason the screen capturing of an app is desired i.e. demonstration, app should be run with--allow-screencapture
argument.When screen capturing for the app is enabled a persistent warning is displayed to the user, and title bar text of every displayed window is modified to contain textIn-app warning is displayed in case of an error occurs during the call to SetWindowDisplayAffinity function.[Screen Capture Allowed]
. The title bar text is also modified to contain the same textfix #5859
Screenshots
Demonstration of stealth mode vs running with
--allow-screencapture
arg:Testing strategy
The implementation was tested using
Snipping Tool
app, making print screen via keyboard shortcut and using ScreenToGif screen recording app.Type of change