Skip to content

feat: WooCommerce honeytoken coupons (#14)#30

Merged
cport1 merged 1 commit into
mainfrom
feat/woocommerce-deception
Jul 19, 2026
Merged

feat: WooCommerce honeytoken coupons (#14)#30
cport1 merged 1 commit into
mainfrom
feat/woocommerce-deception

Conversation

@cport1

@cport1 cport1 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Adds deception to the WooCommerce carding defense: a honeytoken coupon — a fake promo code no human ever sees, whose application is a zero-false-positive bot signal.

How it works

  • honeytoken_coupon() — a per-site fake code (WD + 8 hex), deterministic from a stored secret, with optional daily rotation.
  • render_coupon_bait() — plants the code on cart and checkout pages in an HTML comment plus an offscreen aria-hidden node: exactly where coupon-scraping bots and browser coupon extensions look, invisible to human shoppers and the accessibility tree.
  • catch_coupon() — hooks woocommerce_get_shop_coupon_data, which fires for both classic checkout and the Store API / Blocks (both load coupons through WC_Coupon). Applying the canary (case-insensitive, and yesterday's code during rotation grace) records a detection, blocks the IP per your block_action, and returns it as a non-existent coupon — indistinguishable from a typo.

Existing velocity / card-testing detection is unchanged; this is purely additive. On by default (new WooCommerce settings toggle).

Zero false positives

A human can't apply a code they can never see. Real coupons pass straight through — verified.

Tests

16 checks: code determinism, hidden bait markup (offscreen + aria-hidden + HTML comment), catch→record→block on the canary, case-insensitivity, rotation grace window, log-mode (record without block), disabled passthrough, and real-coupon passthrough (not recorded, data preserved). SDK suite still green (41).

Closes #14. Part of #16.

Note on the issue's carding-tripwire idea (a decoy gift-card-balance endpoint): that's now expressible directly through the Tripwires/Rules UI (add a custom tripwire path), so this PR focuses on the coupon honeytoken, which needed WC-specific hooks.

Extends the WooCommerce carding defense with a deterministic deception signal.

- honeytoken_coupon(): a per-site fake promo code (WD + 8 hex, deterministic
  from a stored secret, optional daily rotation with grace).
- render_coupon_bait(): plants the code on cart/checkout in an HTML comment +
  an offscreen aria-hidden node — where coupon-scraping bots look, invisible
  to humans and the accessibility tree.
- catch_coupon(): hooks woocommerce_get_shop_coupon_data, so it fires for both
  classic checkout and the Store API / Blocks (both load coupons via
  WC_Coupon). Applying the canary (case-insensitive, incl. yesterday's during
  rotation) records a detection, optionally blocks the IP per block_action,
  and returns it as a non-existent coupon. Real coupons pass through
  untouched.
- Existing velocity / card-testing detection is unchanged; this is additive.
  New WooCommerce settings toggle (on by default).

Verified: code determinism, hidden bait markup, catch+record+block on the
canary, case-insensitivity, rotation grace, log-mode (record no block),
disabled passthrough, and real-coupon passthrough (16 checks).

Closes #14. Part of #16.
Co-authored-by: Claude <noreply@anthropic.com>
@cport1
cport1 merged commit ba5674e into main Jul 19, 2026
3 checks passed
@cport1
cport1 deleted the feat/woocommerce-deception branch July 19, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WooCommerce deception — honeytoken coupons + carding tripwires

1 participant