Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Jump to content

Clipboard (computing)

From Wikipedia, the free encyclopedia

The clipboard is a buffer that some operating systems provide for short-term storage and transfer within and between application programs. The clipboard is usually temporary and unnamed, and its contents reside in the computer's RAM.[1]

The clipboard provides an application programming interface by which programs can specify cut, copy and paste operations. It is left to the program to define methods for the user to command these operations, which may include keybindings and menu selections. When an element is copied or cut, the clipboard must store enough information to enable a sensible result no matter where the element is pasted. Application programs may extend the clipboard functions that the operating system provides. A clipboard manager may give the user additional control over the clipboard. Specific clipboard semantics vary among operating systems, can also vary between versions of the same system, and can sometimes be changed by programs and by user preferences.

Windows, Linux and macOS support a single clipboard transaction.[2][3]

History

[edit]

Clipboards as buffers for small text snippets were first used by Pentti Kanerva when he used it to store deleted texts in order to restore them.[4] Since one could delete a text in one place and restore it in another, the term "delete" wasn't what one would expect in this case. Larry Tesler renamed this in 1973 as cut, copy, and paste and coined the term "clipboard" for this buffer, since these techniques need a clipboard for temporary saving the copied or cut data.[5]

Data formats

[edit]

Applications communicate through the clipboard by providing either serialized representations of an object, or a promise (for larger objects).[6] In some circumstances, the transfer of certain common data formats may be achieved opaquely through the use of an abstract factory; for example, Mac OS X uses a class called NSImage to provide access to image data stored on the clipboard, though the actual format of the image data backing the object is hidden. The sending and receiving application negotiate the formats which can be transferred in between them, oftentimes with the active GUI widget responsible for providing acceptable type transformations. The pasteboard allows for transfer of common items such as URLs, colors, images, strings, attributed strings (Rich text), and sounds. The operating system and GUI toolkit may provide some common conversions, for example converting from rich text to plain text and vice versa. Various type identifiers for data transfer are supported by modern operating systems, which may automatically provide acceptable mappings between type systems, such as between MIME and Uniform Type Identifier.[7][8]

Computer security

[edit]

Clipboard hijacking or clipboard injection is an exploit in which a person's clipboard's content is replaced by malicious data, such as a link to a malicious web site.[9] For example, if a user copies a cryptocurrency receiving address into the clipboard, a hijacking program can overwrite it with an address controlled by the hijacker, so that when the user pastes the address their cryptocurrency is transmitted to the hijacker instead of the intended recipient.[10] While some security-holes were patched, JavaScript can still be used to modify clipboard content via an attack dubbed 'pastejacking'.[11][12] Dylan Ayrey who developed the attack set up a website that demonstrates how this exploit can be used to trick a user into running commands they didn't want to run.[13]

There have been exploits where web pages grab clipboard data. In early 2013 researchers exposed risks stemming from Android-based password managers and documented how passwords in 21 of the most popular of these apps could be accessed by any other app on an Android device including those with extremely low-level privileges.[14] Joe Siegrist notes that this is an "OS-level issue that impacts everything running on Android".[15][1]

Clipboard management and extensions

[edit]
Glipper, an example of a clipboard management program

Clipboard manager extensions add functionality to the integrated clipboard functions of an operating system. They are applications that enable the user to manipulate the clipboard. On platforms such as Linux that use multiple incompatible GUI toolkits, clipboard managers are often used to transfer data between applications using different such frameworks.

When a clipboard manager provides multiple cut and paste transactions, the clipboard is treated as a stack or scrap book, with new cuts and copies being placed on a list of recent transactions. The standard paste operation copies the most recent transaction, while specialized pastes provide access to the other stored transactions. These managers generally also provide a window that displays the transaction history and allows the user to select earlier copies, edit them, change their format and even search amongst them.

Since most operating systems (e.g. Windows, macOS, Linux, X11, Android, iOS) do not save the clipboard contents to any persistent storage – when a user logs out or reboots the system the clipboard contents are deleted – an added functionality is to save the clipboard persistently. Another example is making the local clipboard work with online applications by saving the clipboard data to the online location upon a copy or cut event, making this data available to online applications for pasting. Clipboard managers can also serve as tools to overcome the limitation of software not supporting copying and pasting (for example, while logging into remote Windows server, one cannot copy and paste their user name and password).

Operating system-specific clipboards

[edit]

AmigaOS

[edit]

The Amiga operating system uses 256 units, so one has multiple clipboards at the same time.[16]

Android

[edit]

Android provides a clipboard that can hold up to one clip object and is accessible system-wide. Simple text is stored directly in the clipboard; complex data are stored by reference. The clip object has one of three formats: text string, URI object, or intent.[17]

To interact with the clipboard, an app uses the class ClipboardManager[18] and system calls to cut, copy, and paste objects.

In Android 8.0, the clipboard first appears in the user interface: In a situation where the user prepares to paste from the clipboard, a "Clipboard" option appears that gives the user access to many objects copied or cut to the clipboard in the past. Apart from that, and in earlier versions, the user has no access to the clipboard except in apps that make it available to the user.

iOS

[edit]

The clipboard is called "pasteboard" in iOS similar to OS X. Apps on this operating system can create additional pasteboards, called instances of the UIPasteboard class, which can be public or private. One instance can hold a single item or multiple items in different formats.[19]

The formats are identified by Uniform Type Identifiers (UTI).[20]

The data contained in the pasteboard cannot be accessed via the GUI but only from the system and applications

macOS

[edit]

The clipboard in macOS holds one item in multiple available formats.

The contents of the clipboard can be viewed by selecting the Show Clipboard menu item from the Finder's Edit menu. The raw data and the stored formats can be seen using the ClipboardViewer.[21]

Using the following commands the clipboard can be accessed from the command line:[22][23]

$ # to copy data into the clipboard:
$ echo 'hello world' | pbcopy
$ # to paste from the clipboard:
$ pbpaste
hello world

Microsoft Windows and ReactOS

[edit]
clip
Developer(s)Microsoft, ReactOS Contributors
Operating systemWindows, ReactOS
TypeCommand
LicenseWindows: Proprietary commercial software
ReactOS: GNU General Public License
Websitedocs.microsoft.com/en-us/windows-server/administration/windows-commands/clip

The clipboard in Microsoft Windows and ReactOS holds one item in multiple available formats.

Every item has at least one clipboard format, but can have different types of format of the same data. The three different types of possible formats are:[24]

  • standard formats[25] (e.g. CF_BITMAP, or CF_UNICODETEXT),
  • registered formats[26] (e.g. CF_HTML)
  • private formats for internal use

Up to and including Windows XP the clipboard could be accessed via the ClipBook Viewer application.[27] In newer versions of Windows the content can be accessed via clipboard managers.

Data can be stored to the Windows[28] and ReactOS[29] clipboard via command line using the clip command:[30]

$ # to paste the content of a folder to the clipboard:
$ dir | clip

The clipboard can also be accessed via PowerShell:[31][32]

# to paste the content of a directory to the clipboard
Set-Clipboard -Path "C:\directory\"
# to get the content of the clipboard
Get-Clipboard

Windows 10 and Windows 11 include the Clipboard application, allowing for the storage of multiple text-based clipboard items. It can be accessed by pressing Windows+V.

Symbian

[edit]

Symbian S60 (Series 60), depending on edition, has a built-in clipboard with image and richtext storing support.[33][34][35]

To copy and paste text, while pressing and holding #, scroll left or right to highlight text. To copy the text to the clipboard, while still holding #, select Copy. To insert the text into a document, press and hold #, and select Paste.

— Nokia, Nokia N82 User Guide, Messaging: Edit text and lists

In S60v3 (S60 3rd Edition, Symbian 9.1-9.2) examples of clipboard provided with the SDK: ..\Examples\SysLibs\Clipboard\Basics. To read and write clipboard used CPlainText Class:

CPlainText could be very nice solution. But in Symbian reality, let read the manual. There is one small but important phrase which can figure out CPlainText as non-acceptable solution in your case:

“…all line feeds are converted into paragraph delimiters…”

— Yury Schkatula, Integrate with Symbian clipboard, https://symbianic-life.blogspot.com/2010/03/integrate-with-symbian-clipboard.html

In Symbian Belle, clipboard support defined with CClipboard Class in the Basic Application Framework Library (BAFL).[36][37]

There was a number of free and commercial third party clipboard managing applications with multi-item clipboard support created for different Symbian editions.[38][39][40][41]

X Window System

[edit]

The X Window System commonly used on Unix and Linux systems provides three clipboards, which are named "CLIPBOARD", "PRIMARY" and "SECONDARY".[42] The usage and handling of various selections is not standardized. However, most modern toolkits and desktop environments, such as GNOME or KDE, follow a widely accepted convention, outlined in the freedesktop.org specification.[43] One selection, CLIPBOARD, is used for traditional clipboard semantics, with shortcuts identical to Windows. Another selection, PRIMARY, is an X11-specific mechanism. Data is "copied" immediately upon highlighting and pasted with the third (middle) mouse button.[44] This copied data is usually separated from the CLIPBOARD selection and does not change its contents.[45] SECONDARY was planned as an alternative to PRIMARY but is only used inconsistently.[42]

There are two command line tools (xsel and xclip) which can access the clipboard:[46]

$ # to paste standard output to the clipboard using xclip
$ echo text | xclip -in -selection clipboard
$ # to paste standard output to the clipboard using xsel
$ echo text | xsel --clipboard

The main difference to OS X and Windows is that no data is actually stored in the CLIPBOARD-clipboard but only the reference to the copied or cut data. The application claims the ownership of the CLIPBOARD selection and communicates its ownership to the X Server.[44] When pasting this data, the data and its available formats are requested from the application that owns the CLIPBOARD selection.[47]

APIs

[edit]

Applications can access the clipboard or its data via APIs.

JavaScript

[edit]

In JavaScript a class which detects changes in the users clipboard data (ClipboardEvent)[48] and functions to alter the content of a clipboard or read from it (clipboardData.getData(), clipboardData.setData())[49] exist, but aren't supported by every browser since altering the clipboard of a user can represent a security issue.

Qt

[edit]

In Qt a wrapper for every supported platform[50] exists. It provides access to window system clipboards with the use of the class QClipboard. This class facilitates access to common data types by functions.[51] The data type of the element stored in the clipboard is indicated via MIME and MIME data can also be put in the clipboard with help of functions from this class.

See also

[edit]

References

[edit]
  1. ^ a b "What is a Clipboard in Computing? - Definition from Techopedia". Techopedia.com. Archived from the original on 2018-02-02. Retrieved 2018-02-01.
  2. ^ Kimmatkar, Sarang B. (2014). "Extending functionalities of default clipboard". (IJCSIT) International Journal of Computer Science and Information Technologies 5. 6.
  3. ^ Stephens, Rod (2010). Visual Basic 2010 : programmer's reference. Library Genesis. Indianapolis, IN : Wiley Pub., Inc. ISBN 978-0-470-49983-2.
  4. ^ Moggridge, Bill (2007). Designing interactions. Cambridge, Massachusetts: MIT Press. p. 65ff. ISBN 9780262134743.
  5. ^ Larry Tesler. "A User Experience Retrospective". Archived from the original on 2018-02-02. Retrieved 23 January 2018.
  6. ^ "Dragging Files". developer.apple.com. Retrieved 9 December 2018.
  7. ^ "NSPasteboard - AppKit | Apple Developer Documentation". developer.apple.com. Archived from the original on 2018-05-26. Retrieved 9 December 2018.
  8. ^ "Adopting Uniform Type Identifiers". developer.apple.com. Archived from the original on 2018-07-21. Retrieved 9 December 2018.
  9. ^ "What is clipboard hijack attack? - Definition from WhatIs.com". WhatIs.com. Archived from the original on 2017-01-05. Retrieved 4 January 2017.
  10. ^ "Clipboard injector distributed under the guise of Tor Browser". securelist.com. 2023-03-28. Retrieved 2024-05-15.
  11. ^ Chirgwin, Richard. "Pastejack attack turns your clipboard into a threat". The Register. Archived from the original on 2017-01-04. Retrieved 4 January 2017.
  12. ^ "Researcher warns of 'pastejacking' hack attacks targeting users' clipboards". Graham Cluley. 26 May 2016. Archived from the original on 2017-01-05. Retrieved 4 January 2017.
  13. ^ "dxa4481/Pastejacking". GitHub. Archived from the original on 2017-01-04. Retrieved 4 January 2017.
  14. ^ Fahl, Sascha; Harbach, Marian; Oltrogge, Marten; Muders, Thomas; Smith, Matthew (2013). "Hey, You, Get Off of My Clipboard" (PDF). Financial Cryptography and Data Security. Lecture Notes in Computer Science. Vol. 7859. pp. 144–161. doi:10.1007/978-3-642-39884-1_12. ISBN 978-3-642-39883-4. Archived (PDF) from the original on 2017-09-19. Retrieved 4 January 2017.
  15. ^ "Using a password manager on Android? It may be wide open to sniffing attacks". Ars Technica. 21 November 2014. Archived from the original on 2017-01-04. Retrieved 4 January 2017.
  16. ^ "Clipboard Device - AmigaOS Documentation Wiki". wiki.amigaos.net. Archived from the original on 2018-02-05. Retrieved 2018-02-03.
  17. ^ "Copy and Paste | Android Developers". developer.android.com. Archived from the original on 2018-02-07. Retrieved 2018-02-06.
  18. ^ "ClipboardManager | Android Developers". developer.android.com. Archived from the original on 2018-02-07. Retrieved 2018-02-02.
  19. ^ "Pasteboard". developer.apple.com. Archived from the original on 2018-02-07. Retrieved 2018-02-01.
  20. ^ "Uniform Type Identifier". developer.apple.com. Archived from the original on 2018-02-07. Retrieved 2018-02-06.
  21. ^ "ClipboardViewer". developer.apple.com. Archived from the original on 2018-02-07. Retrieved 2018-02-06.
  22. ^ "Copy to clipboard from terminal in OS X". rogeriopvl.com. Archived from the original on 2013-08-15. Retrieved 2013-07-02.
  23. ^ "pbcopy(1) Mac OS X Manual Page". apple.com. Archived from the original on 2014-03-28. Retrieved 2013-07-02.
  24. ^ "Clipboard Formats (Windows)". msdn.microsoft.com. Archived from the original on 2018-02-07. Retrieved 2018-02-03.
  25. ^ "Standard Clipboard Formats (Windows)". msdn.microsoft.com. Archived from the original on 2018-02-07. Retrieved 2018-02-03.
  26. ^ "HTML Clipboard Format (Internet Explorer)". msdn.microsoft.com. Archived from the original on 2018-02-07. Retrieved 2018-02-03.
  27. ^ "View & Manage Clipboard In Windows 10/8/7". The Windows Club. 2013-04-12. Archived from the original on 2018-02-12. Retrieved 2018-02-06.
  28. ^ "clip | Microsoft Docs". Docs.microsoft.com. 2017-10-16. Retrieved 2019-09-26.
  29. ^ "reactos/base/applications/cmdutils/clip at master · reactos/reactos · GitHub". Github.com. Retrieved 2019-09-26.
  30. ^ "How to Copy Command Line Output to the Windows Clipboard". www.labnol.org. Archived from the original on 2018-02-07. Retrieved 2018-02-06.
  31. ^ sdwheeler. "Get-Clipboard (Microsoft.PowerShell.Management)". docs.microsoft.com. Archived from the original on 2018-01-26. Retrieved 2018-02-06.
  32. ^ sdwheeler. "Set-Clipboard (Microsoft.PowerShell.Management)". docs.microsoft.com. Archived from the original on 2018-02-07. Retrieved 2018-02-06.
  33. ^ "Files and clipboard in Text content". docs.huihoo.com. Retrieved 2024-10-23.
  34. ^ Schkatula, Yury (2010-03-28). "Symbianic life: Integrate with Symbian clipboard". Symbianic life. Retrieved 2024-10-23.
  35. ^ Fiodar (2019-03-06), fedor4ever/symbianClipboard, retrieved 2024-10-23
  36. ^ "Basic Application Framework Library". devlib.symbian.slions.net. Retrieved 2024-10-23.
  37. ^ "Basics: Store and Restore Object using Clipboard". devlib.symbian.slions.net. Retrieved 2024-10-23.
  38. ^ "ClipBook, the multi-item Symbian clipboard manager". All About Symbian. 2014-04-08. Retrieved 2024-10-23.
  39. ^ Litchfield, Steve. "Curated Symbian application store". stevelitchfield.com. ClipBook: ClipBoard Manager (free)
  40. ^ "Mclip V1.4 Symbian App - Download for free on PHONEKY". phoneky.com. Retrieved 2024-10-23.
  41. ^ "Download MagicKeys 2.12 for Symbian". magickeys.soft32.com. Retrieved 2024-10-23.
  42. ^ a b "Clipboard - ArchWiki". wiki.archlinux.org. Archived from the original on 2018-02-17. Retrieved 2018-02-16.
  43. ^ "clipboards-spec". freedesktop.org. Archived from the original on 2014-12-24. Retrieved 2014-08-16.
  44. ^ a b "Copy & Paste, Drag & Drop [MI Wiki]". wiki.mi.ur.de (in German). Archived from the original on 2018-02-16. Retrieved 2018-02-16.
  45. ^ "gnu.org". www.gnu.org. Archived from the original on 2017-12-24. Retrieved 2018-02-16.
  46. ^ "Copying and Pasting To and From the System Clipboard On The Command Line — Fernando Basso". fernandobasso.github.io. Archived from the original on 2018-02-07. Retrieved 2018-02-06.
  47. ^ "X Selections, X Cut Buffers, and Emacs Kill Rings". www.jwz.org. Archived from the original on 2018-03-04. Retrieved 2018-02-02.
  48. ^ "Clipboard API and events – ClipboardEvent". www.w3.org. Archived from the original on 2018-01-28. Retrieved 2018-02-08.
  49. ^ "Clipboard API and events – Synchronous Clipboard API". www.w3.org. Archived from the original on 2018-01-28. Retrieved 2018-02-08.
  50. ^ "platforms\plugins\src - qt/qtbase.git - Qt Base (Core, Gui, Widgets, Network, ...)". code.qt.io. Archived from the original on 2018-02-09. Retrieved 2018-02-02.
  51. ^ "QClipboard Class | Qt GUI 5.10". doc.qt.io. Archived from the original on 2018-02-02. Retrieved 2018-02-02.

Further reading

[edit]
[edit]