@redsocs/spam-warden 1.3.4 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -109,7 +109,19 @@ Explicit opt-in protection. No data leaves the browser. Simply include the scrip
109
109
 
110
110
  Report blocked payloads to a central SOC, SIEM, or custom logging server. Use the `siems` attribute to define your receiving endpoint(s). You can provide a single URL or a comma-separated list of multiple URLs to broadcast the telemetry to several destinations simultaneously.
111
111
 
112
- Add `data-sd="1"` to enable built-in Data Loss Prevention (DLP), which automatically masks Credit Cards, Phone Numbers, and Emails (`[CARD_MASKED]`) before network transmission.
112
+ #### Data Protection & Privacy (DLP / SD Flag)
113
+
114
+ When telemetry is sent to a central SIEM, you might inadvertently transmit Personally Identifiable Information (PII) if the user typed it into the field.
115
+
116
+ To ensure compliance with PDPA/GDPR, enable the **Sanitize Data (SD)** flag by adding `data-sd="1"` to the script tag, or setting `reportSD: true` in the programmatic config.
117
+
118
+ When activated, SpamWarden's built-in DLP engine intercepts the payload _before_ it leaves the browser and aggressively masks:
119
+
120
+ - **Credit Cards:** Replaces 16-digit patterns with `[CARD_MASKED]`
121
+ - **Emails:** Replaces standard email formats with `[EMAIL_MASKED]`
122
+ - **Phone Numbers:** Replaces standard Thai/International formats with `[PHONE_MASKED]`
123
+
124
+ This guarantees that PII is scrubbed from the threat intelligence telemetry without requiring any backend processing.
113
125
 
114
126
  **Single Endpoint:**
115
127
 
@@ -146,17 +158,65 @@ if (result.isSpam) {
146
158
  }
147
159
  ```
148
160
 
149
- ---
161
+ ### 4. Programmatic Configuration (Advanced)
150
162
 
151
- ## Scope & Backend Requirements
163
+ If you are using a modern framework (React, Vue) or Node.js, you can configure SpamWarden programmatically instead of relying on HTML script attributes.
152
164
 
153
- SpamWarden is designed for **interactive web elements**: Contact Forms, Comment Sections, and Chat Inputs.
165
+ ```javascript
166
+ // Example: Customizing behavior
167
+ window.spamwarden.configure({
168
+ // Telemetry Destinations
169
+ endpoint: "https://siem.yourdomain.com/logs",
170
+ siemEndpoint: "https://backup-siem.yourdomain.com/logs",
171
+ autoReport: true,
172
+ isTrusted: true,
173
+
174
+ // Data Protection (DLP)
175
+ reportSD: true, // Same as data-sd="1"
176
+ payloadLimit: 250, // Max length of the reported payload text
177
+
178
+ // Custom Intercepts
179
+ onSpam: function (result) {
180
+ // Override the default alert() trap with your own UI behavior
181
+ console.warn("Spam detected with confidence: " + result.prob);
182
+ // showCustomModal("Blocked due to policy violation.");
183
+ },
184
+
185
+ customReporter: function (payload) {
186
+ // Override the default HTTP POST and handle the SIEM payload manually
187
+ // myCustomLogger.send(payload);
188
+ },
189
+ });
190
+ ```
191
+
192
+ ### 5. Developer Mode & Debugging
193
+
194
+ Because SpamWarden utilizes Hostile Active Defense (Phantom Cores, Traps, etc.), debugging it in the console can be difficult by design.
195
+
196
+ If you are actively developing your UI and need to bypass the security traps or inspect the engine natively, append `data-sw-dev="true"` to your script tag:
197
+
198
+ ```html
199
+ <script src="..." data-sw-dev="true"></script>
200
+ ```
154
201
 
155
202
  > [!WARNING]
156
- > **Client-Side Limits:** All client-side code is inherently bypassable by a sufficiently motivated, manual human attacker. If you require absolute security, you **must** validate payloads on your backend.
203
+ > **Never deploy to production with `data-sw-dev="true"`.** This completely disables the decoy traps and exposes the global `window.spamwarden` object, making it easier for automated botnets to bypass the system.
204
+
205
+ ---
206
+
207
+ ## Scope & Independent Integrity Auditing
208
+
209
+ SpamWarden.js is built exclusively to evaluate the live, fully rendered Document Object Model (DOM) right inside the browser.
210
+
211
+ > [!IMPORTANT]
212
+ > **Client-Side Compliance & Integrity Testing:**
213
+ > While standard backend firewalls check incoming traffic patterns, they are completely blind to data injected directly into compromised template columns or static database rows. If your server has already been breached, backend validation will fail to detect the hidden output being served to search engine crawlers
214
+ >
215
+ > To audit existing compromise footprints, we use our private **[`badlinks`](https://redsocs.com/badlinks)** engine running within the internal **RedSocs Inspector** tools for our EASM platform. This specialized configuration allows auditors and security teams to:
157
216
  >
158
- > - **For WordPress:** Use our [SpamWarden WP Plugin](https://redsocs.com/spam-warden) to protect your server at the PHP layer.
159
- > - **For Custom Stacks (Node):** Grab this NPM package directly, bundle it internally, and run the `spamcheck()` function on your backend server before hitting your database.
217
+ > - **Expose Stealth SEO Hijacking:** Automatically unmask hidden tags, hidden layout nodes (`display: none`, `opacity: 0`), and malicious cross-domain tracking assets designed to cheat search engine indices.
218
+ > - **Run Local Compliance Sandboxing:** Evaluate target pages on the fly exactly as an NCSA integrity inspector or external search crawler experiences them, without altering a single line of production code on the target server.
219
+ > - **Generate Deterministic Audit Telemetry:** Stream immediate, non-disruptive compliance indicators back to your secure C2 infrastructure or central SOC to document legal alignment with the [NCSA Web Standard 1.0 framework](https://cdn.redsocs.com/html/ncsa-check.html) - Thailand.
160
220
 
161
221
  ---
162
222
 
@@ -187,7 +247,7 @@ Sanitized: "Win [CARD_MASKED] now! [at]TUNA_FISH"
187
247
  ================================================
188
248
  ```
189
249
 
190
- **_And if it no config or attribute script at `endpoint` this tool send nothing to the outside._**
250
+ **And if it no config or attribute script at `siems` endpoint (like `siems="https://siem-log.youdomain.co.th/spam"`) when initial page; this tool send nothing to the outside.**
191
251
 
192
252
  ---
193
253
 
@@ -197,14 +257,16 @@ About
197
257
  - **License:** MIT
198
258
  - **Inquiries & Enterprise Support:** [pichit[at]redsocs.com](https://www.google.com/search?q=mailto%3Apichit%40redsocs.com)
199
259
  - **Sponsor:** [Buy Me a Coffee](https://buymeacoffee.com/redsocs?new=1)
200
-
201
- ---
260
+ [![Sponsor](https://img.shields.io/badge/Sponsor-Buy%20Me%20a%20Coffee-ffdd00?style=flat&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/redsocs?new=1)
202
261
 
203
262
  ### Technical Specs
204
263
 
205
- | Property | Value |
206
- | ------------------- | --------------------------------- |
207
- | **Minified Size** | ~2.0 MB (including model weights) |
208
- | **Gzipped Size** | **~341 KB** |
209
- | **Dependencies** | 0 (Vanilla JS) |
210
- | **Vocabulary**1.3.0 | 28,106 features |
264
+ | Property | Value |
265
+ | ----------------- | --------------------------------- |
266
+ | **Minified Size** | ~2.0 MB (including model weights) |
267
+ | **Gzipped Size** | **~341 KB** |
268
+ | **Dependencies** | 0 (Vanilla JS) |
269
+ | **Vocabulary** | 28,106 features |
270
+
271
+ ---
272
+ **Disclaimer:** This tool is not endorsed by the National Cyber Security Agency (NCSA) or any government security sector unit. You can validate your judgment at the Standard & Action Security Policy Audit at [https://www.ncsa.or.th/standards](https://www.ncsa.or.th/standards).