Bypassing the paste restriction on the browser

Bypassing the paste restriction with simple automation tools on Mac OS X

Banking sites and Mac OS Keychain makes you intentionally type in your credentials. These can be usually bypassed with help of browser specific extensions using Password Managers like 1Password or LastPass. Its also important to note that have their own downsides aka bugs.

Being a developer using a keyboard for hours every day since 10+ years, being productive will become a mandatory requirement for me personally. By unblocking websites and Mac from restricting me to use the bypassed paste, I feel invincible on the keyboard. Although you need to think through of other security implications of using the clipboard to store sensitive data.

The advantages for me were

  1. Bypassing the paste restrictions
  2. Pasting text from the browser without styles into existing notes / cheatsheets.

The paste has been both an important and tough to bypass. The bank websites stop you to use the Paste option in all possible ways with the help of Javascript and they do not work without Javascript (which is sad)

Old Solution

I used an Alfred Workflow called Type to achieve that till it became unusable when I upgraded to Sierra (10.12). The workflow has become buggy, I think its part of the OS itself or something I did not spend time figuring out.

New Solution

While struggling with this problem for about a week and avoiding to type where ever possible, I came across “HammerSpoon”, a desktop automation tool . A desktop automation tools helps you script/automate tasks. Its written in Lua.

What can HammerSpoon do?

You can write Lua code that interacts with OS X APIs for applications, windows, mouse pointers, filesystem objects, audio devices, batteries, screens, low-level keyboard/mouse events, clipboards, location services, wifi, and more.

It is simple to script out what you need with the help of the exhaustive documentation

Find the script for Paste bypass

Here is my current configuration. I can now right click with my keyboard or even scroll without going to the arrow keys on the browser.

 Share!