Skip to content

feat: rule engine + tripwires + wd_clearance forwarding (#2 #3 #5) - #20

Merged
cport1 merged 2 commits into
mainfrom
feat/rules-tripwires-clearance
Jul 19, 2026
Merged

feat: rule engine + tripwires + wd_clearance forwarding (#2 #3 #5)#20
cport1 merged 2 commits into
mainfrom
feat/rules-tripwires-clearance

Conversation

@cport1

@cport1 cport1 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

First P0 bundle of the v2.2 parity milestone. Brings the plugin's deterministic deception layer to parity with @webdecoy/node and wires the WordPress half of the clearance enforcement loop. (Supersedes #18, which auto-closed when its stacked base branch was deleted after #17 merged.)

What's here

  • Rule engine (Rule engine core — ordered rules, ALLOW/DENY/THROTTLE, dry-run, violation recording #2)WebDecoy\Rules\RuleEngine, a faithful PHP port of node's rule-engine.ts. Rules evaluate in order; first non-dry-run DENY/THROTTLE wins; every non-ALLOW result records a ViolationEvent; dry-run logs without blocking. Runs in early_check() before heuristic scoring.
  • Tripwires (Tripwire rules — deterministic scanner-bait paths (zero-FP DENY) #3)WebDecoy\Rules\TripwireRule, deterministic zero-false-positive blocking of honeypot paths. Ships node's 18 DEFAULT_TRIPWIRE_PATHS verbatim; custom exact paths, prefixes, and fail-open regex patterns. On by default (built-in bait paths carry no false-positive risk). New Settings → Tripwires tab.
  • wd_clearance forwarding (wd_clearance server half — cookie capture + forwarding on tripwire violations #5) — the engine attaches the wd_clearance cookie only to tripwire violations, so the unspoofable deception signal drives the backend's durable device-fingerprint deny-list (WP half of WebDecoy/app#136).
  • Violation transportWebDecoy_Violation_Reporter buffers per request, flushes once on shutdown with a non-blocking POST to /api/v1/sdk/violations/batch. Cloud-gated; local-only installs still enforce.

Tests

tests/ is a dependency-free PHP runner porting node's rule-engine.test.ts and tripwire-rule.test.ts vectors — 17 assertions, all green (php tests/run.php). Build strips tests/.

Closes #2, closes #3, closes #5. Part of #16.

cport1 and others added 2 commits July 19, 2026 14:22
Ports @webdecoy/node's rule engine to PHP and adds the deception layer the
plugin was missing despite the product name.

- WebDecoy\Rules\{RuleEngine,TripwireRule,RuleContext,RuleResult,
  ViolationEvent,...}: pure, framework-agnostic SDK classes mirroring node's
  rules engine. First non-dry-run DENY/THROTTLE wins; every non-ALLOW result
  records a violation; dry-run logs without blocking.
- TripwireRule: deterministic, zero-FP blocking of honeypot paths. Ships
  node's 18 DEFAULT_TRIPWIRE_PATHS verbatim; supports custom exact paths,
  prefixes, and (fail-open) regex patterns.
- Clearance forwarding (#136 WP half): the wd_clearance cookie is attached
  ONLY to tripwire violations, so the deception signal — not heuristics —
  drives the durable device-fingerprint deny-list.
- WebDecoy_Violation_Reporter: per-request buffer flushed once on shutdown
  via a non-blocking POST to /api/v1/sdk/violations/batch. Cloud-gated
  (needs an API key); local-only installs still enforce, just don't report.
- Wired into early_check() before heuristic scoring (matches node's
  protect() flow). New Settings -> Tripwires tab. Violations always logged
  locally (visible in Detections, incl. dry-run).
- tests/: dependency-free PHP runner porting node's rule-engine and
  tripwire test vectors (17 assertions, green).

Closes #2, #3, #5. Part of #16.
Co-authored-by: Claude <noreply@anthropic.com>
The built-in scanner-bait paths carry no false-positive risk for real
visitors, so protection is active out of the box (no users yet — no
migration concern).
@cport1
cport1 merged commit e80c12f into main Jul 19, 2026
3 checks passed
@cport1
cport1 deleted the feat/rules-tripwires-clearance branch July 19, 2026 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant