Skip to content

VBC-117: block-paste

error

Category: ux-dx
Analysis: Regex (line by line)
File types: .js, .ts, .tsx, .html, .astro
Scope: source code only, ignoring anything inside strings and comments
Tags: ux security

What it reports

Blocking paste in input fields harms both UX and security (password managers).

Flagged

js
input.addEventListener('paste', e => e.preventDefault());

Not flagged

js
input.addEventListener('paste', e => normalise(e));

Pattern

regex
onPaste=['"]return false['"]|\.addEventListener\(['"]paste['"],.*?\.preventDefault\(

Released under the MIT License.