Skip to content
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 a warning about the inter-qube clipboard maximum character limit #9296

Assignees
Labels
C: core good first issue This is a recommended issue for first-time contributors. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. ux User experience

Comments

@qwrd
Copy link

qwrd commented Jun 11, 2024

The problem you're addressing (if any)

The inter-qube clipboard system appears to have a 65000 character limit, which means that any text longer than this limit that is copied between individual qubes by using the ctrl+shift+c and ctrl+shift+v shortcuts will be silently truncated to 65000 characters. I noticed this in Q4.2 while trying to copy over some config files from one GUI text editor to another in a different qube, and then some syntax errors appeared in the program log. Upon inspection, I noticed that a portion of the config file in the new qube was missing.

The solution you'd like

Please add some sort of warning message on the screen. When a user tries to copy a text section that is longer than this limit then a message should pop up notifying the user that not all text has been copied over.

The value to a user, and who that user might be

Any user who copies large portions of text won't wonder why some of it has disappeared.

Completion criteria checklist

(This section is for developer use only. Please do not modify it.)

@qwrd qwrd added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. labels Jun 11, 2024
@Solomon1732
Copy link

Solomon1732 commented Jun 11, 2024

I offer that the warning also suggest the user instead copy files between qubes. Not that it will present a popup, but rather say the likes of "you can use use qvm-copy to copy large files between qubes."

@andrewdavidwong andrewdavidwong added C: core ux User experience labels Jun 12, 2024
@marmarta marmarta added the good first issue This is a recommended issue for first-time contributors. label Oct 2, 2024
@alimirjamali
Copy link

alimirjamali commented Oct 4, 2024

@marmarek I am looking at commit history to qubes-gui-daemon and in this specific commit from 2012, I can not find where the MAX_CLIPBOARD_SIZE is defined. Searching the repo does not provide any clue.

@marmarek
Copy link
Member

marmarek commented Oct 4, 2024

@alimirjamali
Copy link

https://github.com/QubesOS/qubes-gui-common/blob/main/include/qubes-gui-protocol.h#L86

Thanks for the hint. Regardless of the OP, 65KB sound a little bit low (maybe even 12 years ago). This is less than 1000 at 40 chars width. Was there any security concern?

@alimirjamali
Copy link

alimirjamali commented Oct 5, 2024

After some consideration and study about this issue, it is not be simple. I could divide it to 4 (+1) individual sub-tasks:

  • The 65000 character limit set 11 years ago by Rafal Wojtczuk should had been most probably due to X86 real-mode memory segmentation concerns. Which is no problem on X86-64 and is solved long ago. X11 could easily handle chunks of 256KiB or even higher nowadays before any necessity to switch to INCR. I guess it would be OK to increase the MAX_CLIPBOARD_SIZE to 256KiB. The current limit is too low.
  • A patch to qubes-gui-daemon is necessary to raise proper errors instead of truncating the buffer.
  • A patch to qubes-gui-agent-linux is necessary for protocol upgrade.
  • An additional patch to Qubes Clipboard Widget is necessary for visual notification of error raised by GUI daemon.

alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 6, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 6, 2024
@andrewdavidwong andrewdavidwong added the pr submitted A pull request has been submitted for this issue. label Oct 6, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 6, 2024
@alimirjamali
Copy link

alimirjamali commented Oct 6, 2024

I offer that the warning also suggest the user instead copy files between qubes. Not that it will present a popup, but rather say the likes of "you can use use qvm-copy to copy large files between qubes."

For the task 2 & 3, instead of truncation which might result in data loss and corruption, a proper message could be raised as suggested above. But why not a popup? It could be a popup with this text:

Global Clipboard
Failed to fetch clipboard contents from qube: <b> {vmname> </b> !
Source content too big to fit in Global clipboard buffer.
Use `qvm-copy/qvm-move` to transfer large amount of data between qubes.
Global clipboard is wiped.

alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 6, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 6, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 6, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 6, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 6, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 6, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 6, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 6, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 6, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 6, 2024
alimirjamali added a commit to alimirjamali/qubes-desktop-linux-manager that referenced this issue Oct 6, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 7, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 7, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-desktop-linux-manager that referenced this issue Oct 7, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 7, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 7, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Supplements: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 7, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Oct 7, 2024
alimirjamali added a commit to alimirjamali/qubes-core-admin-client that referenced this issue Oct 7, 2024
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 7, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Fixes: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 7, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

fixes: QubesOS/qubes-issues#9296
@alimirjamali
Copy link

PRs submitted (total of 5)

Review priority: Medium (since bug involves data loss)

Users could set the global clipboard limit via max_clipboard_size key within /etc/qubes/guid.conf. or via gui-default-max-clipboard-size feature of GUIVM (or dom0). Or can set limit per vm via gui-max-clipboard-size of individual qubes. The accepted values are between 256 characters to 256000 characters. Default is 64000 characters. Trying to copy sizes over it will trigger a Global Clipboard widget warning message and wipe the global clipboard. See video below:

clipboard.mp4

alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 8, 2024
Users will be able to set gloab and/or per qube clipboard limit size by
setting `max_clipboard_size` feature of GUIVM or individual qubes

Clipboard sizes over the limit will trigger special event for a pop-up

fixes: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 9, 2024
Also making the clipboard buffer size to be user configurable on the GUI
daemon side (xside).

Fixes: QubesOS/qubes-issues#9296
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Oct 13, 2024
Check if copying 64k also works. And then try copying 200kb, both
with default settings (should be refused) and with limit raised. This
test assume already modified behavior on over the limit copy (truncate
to 0 instead of truncating to the limit).

QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-common that referenced this issue Oct 13, 2024
Also making the clipboard max size user configurable per vm on the GUI
daemon side (xside).

Fixes: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-daemon that referenced this issue Oct 13, 2024
Users will be able to set global and/or per qube clipboard limit size by
setting `max_clipboard_size` feature of GUIVM or individual qubes

Clipboard sizes over the limit will trigger special event for a pop-up

fixes: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 13, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

fixes: QubesOS/qubes-issues#9296
alimirjamali added a commit to alimirjamali/qubes-gui-agent-linux that referenced this issue Oct 14, 2024
If vmside clipboard is over the maximum limit, sending one byte over
maximum limit should trigger inter-vm clipboard rejection instead of
truncation.

fixes: QubesOS/qubes-issues#9296
marmarek added a commit to marmarek/qubes-core-admin that referenced this issue Oct 15, 2024
Check if copying 64k also works. And then try copying 200kb, both
with default settings (should be refused) and with limit raised. This
test assume already modified behavior on over the limit copy (truncate
to 0 instead of truncating to the limit).
Finally, test copying 300k, which should be rejected regardless of the
limit.

QubesOS/qubes-issues#9296
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: core good first issue This is a recommended issue for first-time contributors. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: enhancement Type: enhancement. A new feature that does not yet exist or improvement of existing functionality. ux User experience
Projects
None yet
6 participants