Paste Target Guard

Paste Target Guard is a copy-paste React component that stops helps catch a clipboard hijacker swapping the payee address before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/paste-target-guard
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsHelps catch a clipboard hijacker swapping the payee address

Was this component page useful?

How do I install Paste Target Guard?

pnpm dlx shadcn@latest add @bollard/paste-target-guard

The files land in your project. They're yours to edit.

How do I use Paste Target Guard in React?

paste-target-guard-usage.tsx
import { PasteTargetGuard } from "@/components/ui/paste-target-guard"

<PasteTargetGuard label="Payee IBAN" expected={INVOICE_IBAN} defaultValue={SWAPPED} placeholder="DE00 0000 0000 0000 0000 00" />

What input mistakes does Paste Target Guard catch?

  • Pasted address that differs from what was copied on the page
  • Address that differs from the expected one
  • Look-alikes of saved recipients
  • Matching start and end with a different middle (the clipper trick)

What props does Paste Target Guard accept?

PasteTargetGuard props
PropTypeDefault
label

Visible label.

string"Recipient"
value

Controlled value.

string—
defaultValue

Initial value when uncontrolled.

string""
onValueChange

Called with the value on every change.

(value: string) => void—
kind

Force the kind instead of detecting it.

PasteTargetKind—
expected

What the user typed or confirmed earlier (step 1, the invoice on file). Compared when nothing was copied on this page.

string—
watchCopy

Remember IBANs, UPI IDs and wallet addresses copied anywhere on this page, to compare with what gets pasted.

booleantrue
known

Saved recipients. A value that copies one's start and end but not its middle is flagged as a look-alike.

KnownTarget[][]
chunkSize

Characters per group in the comparison.

number4
edgeGroups

Groups shown at each end before the middle collapses.

number2
onMismatch

Called when a mismatch is shown.

(detail: { value: string; reference: string; source: "copied" | "expected" | "known" }) => void—
copiedTitle

Title when the paste differs from what was copied.

string"This isn't what you copied"
expectedTitle

Title when the value differs from the expected one.

string"This doesn't match what you entered earlier"
lookalikeTitle

`{label}` is filled in.

string"Looks like “{label}”, but it isn't"
copiedText

Explains the copied-vs-pasted mismatch.

string"It changed between copy and paste. Malware on this devic…
staleCopiedTitle

Title and text when the page lost focus after the copy, so the user may have copied something else since.

string"This isn't what you copied on this page"
staleCopiedText

Explains a mismatch with an older copy.

string"If you copied it from somewhere else since, check it aga…
expectedText

Explains the expected-vs-entered mismatch.

string"Check it against the original before you send anything."
differText

Screen reader summary of the comparison. `{count}` and `{total}` are filled in.

string"{count} of {total} groups differ."
endsMatchText

Warns that the ends match but the middle differs.

string"The start and end match, so a quick glance would pass. L…
copiedLabel

Row label for what was copied.

string"Copied"
expectedLabel

Row label for the expected value.

string"Earlier"
knownLabel

Row label for the saved recipient.

string"Saved"
pastedLabel

Row label for what was pasted.

string"Pasted"
middleLabel

`{count}` is filled in.

string"+{count}"
showAllLabel

Accessible label to show every group.

string"Show every group"
useLabel

`{label}` is filled in for saved recipients.

string"Use the original"
keepLabel

Button text to keep the pasted value.

string"Keep this one"
matchText

Shown when the paste matches what was copied.

string"Matches what you copied, every character."

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

How is Paste Target Guard accessible?

  • Visible label; input has aria-invalid on mismatch and is described by the check
  • Mismatches use role=alert; a match is announced politely
  • Show-all and keep buttons have aria-labels

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Confirm the payee with your provider and require step-up confirmation for new or changed recipients on the server.

  • Only sees copies made on this page (watchCopy) or the expected value you pass
  • Malware that also changes what the page shows can't be detected
  • Doesn't verify the payee; use Payee Check or your provider

What expensive mistakes does Paste Target Guard stop?

Helps catch a clipboard hijacker swapping the payee address

Also known as

clipboard hijacking · clipper · upi id · iban · wallet address · crypto · payee · send money

Field type

What dependencies does Paste Target Guard require?

Paste Target Guard facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component namePaste Target Guard
Registry identifier@bollard/paste-target-guard
Install commandnpx shadcn@latest add @bollard/paste-target-guard
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Paste Target Guard

How does Paste Target Guard validate Indian financial identifiers?

Paste Target Guard stops helps catch a clipboard hijacker swapping the payee address. Complies with national standards for Pasted address that differs from what was copied on the page, Address that differs from the expected one, Look-alikes of saved recipients, Matching start and end with a different middle (the clipper trick). Limitation: verify paste-target-guard with issuer gateway.

How do I install paste-target-guard with shadcn?

Run `npx shadcn@latest add @bollard/paste-target-guard`. Sources added: registry/default/paste-target-guard/paste-target-guard.tsx. Package requirements: lucide-react.

What props customize Paste Target Guard?

Paste Target Guard accepts `label`, `value`, `defaultValue`, `onValueChange`, `kind`. Configures clipboard hijacking, clipper, upi id behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of paste-target-guard?

Only sees copies made on this page (watchCopy) or the expected value you pass. Malware that also changes what the page shows can't be detected. Doesn't verify the payee; use Payee Check or your provider Server requirement: Confirm the payee with your provider and require step-up confirmation for new or changed recipients on the server.

How does Paste Target Guard meet accessibility guidelines?

Visible label; input has aria-invalid on mismatch and is described by the check. Mismatches use role=alert; a match is announced politely. Show-all and keep buttons have aria-labels. Minimizes errors: clipboard hijack upi, crypto address changed on paste.

Which components pair with Paste Target Guard?