@redsocs/spam-warden 1.1.13 → 1.2.2

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
@@ -1,6 +1,6 @@
1
1
  # SpamWarden.js
2
2
 
3
- Lightweight, client-side JavaScript library for real-time spam detection and automated form protection. Optimized for Thai text and high-performance browser environments.
3
+ Lightweight, universal JavaScript library for real-time spam detection and automated form protection. Optimized for Thai text and high-performance cross-platform environments.
4
4
 
5
5
  [![CI](https://gitlab.com/redsocs/spam-warden/badges/main/pipeline.svg)](https://gitlab.com/redsocs/spam-warden/-/pipelines)
6
6
  [![npm](https://img.shields.io/npm/v/%40redsocs%2Fspam-warden.svg)](https://www.npmjs.com/package/@redsocs/spam-warden)
@@ -8,9 +8,9 @@ Lightweight, client-side JavaScript library for real-time spam detection and aut
8
8
 
9
9
  # What is this?
10
10
 
11
- **SpamWarden.js** is a zero-dependency, client-side engine that detects spam directly in the user's browser. It uses a **Present-Only Naive Bayes** model (derived from Bernoulli Naive Bayes) trained specifically on Thai spam patterns (gambling, loans, "fast money" scams) and optimized with a dynamic, length-calibrated decision threshold to eliminate false positives on longer, clean text.
11
+ **SpamWarden.js** is a zero-dependency, universal engine that detects spam directly at the source. It uses a **Present-Only Naive Bayes** model (derived from Bernoulli Naive Bayes) trained specifically on Thai spam patterns (gambling, loans, "fast money" scams) and optimized with a dynamic, length-calibrated decision threshold to eliminate false positives on longer, clean text.
12
12
 
13
- By running in the browser, it allows you to **block spam before it ever hits your database**, saving server resources and keeping your data clean.
13
+ By running natively, it allows you to **block spam before it ever hits your database**, saving server resources and keeping your data clean.
14
14
 
15
15
  ![SIEM Endpoint & Spam Block Demo](https://cdn.redsocs.com/assets/siem-endpoint-spamblock-demo.gif)
16
16
 
@@ -33,23 +33,28 @@ Add this script to your page with the `data-auto-protect` attribute. It will aut
33
33
  By default, this mode also enables PII masking (DLP). To disable PII masking, add `data-sd="0"`.
34
34
 
35
35
  ```html
36
- <script src="https://cdn.redsocs.com/js/spamwarden.min.js" data-auto-protect></script>
36
+ <script
37
+ src="https://cdn.redsocs.com/js/spamwarden.min.js"
38
+ data-auto-protect
39
+ ></script>
37
40
  ```
38
41
 
39
42
  ### 2. Enterprise Telemetry (SIEM Integration)
40
43
 
41
- If you need to report blocked spam payloads to a central SIEM/SOC, provide a Base64 configuration string via the `client` parameter.
44
+ If you need to report blocked spam payloads to a central SIEM/SOC, provide a Base64 configuration string via the `endpoint` parameter.
42
45
 
43
46
  ```html
44
- <script src="https://cdn.redsocs.com/js/spamwarden.min.js?client=MHxzaWVtLnJlZHNvY3MuY29tL3Yx"></script>
47
+ <script src="https://cdn.redsocs.com/js/spamwarden.min.js?endpoint=MHxzaWVtLnJlZHNvY3MuY29tL3Yx"></script>
45
48
  ```
46
49
 
47
- _Note: The `client` parameter is a Base64 encoded string of `sdFlag|siemEndpoint` (e.g., `0|siem.redsocs.com/v1`)._
50
+ _Note: The `endpoint` parameter is a Base64 encoded string of `sdFlag|siemEndpoint` (e.g., `0|siem.redsocs.com/v1`)._
48
51
 
49
52
  ### 3. API Usage (Node Only)
50
53
 
51
54
  ```javascript
52
- const result = spamwarden.spamcheck("[Hello, this is a Thai casino & scam ads — and guess what? Your tax pays for my traffic.]");
55
+ const result = spamwarden.spamcheck(
56
+ "[Hello, this is a Thai casino & scam ads — and guess what? Your tax pays for my traffic.]",
57
+ );
53
58
  if (result.isSpam) {
54
59
  console.log("Blocked:", result.reason || "AI match");
55
60
  console.log("Confidence:", result.prob);
@@ -98,6 +103,7 @@ We do not rely solely on "Security through Obscurity." SpamWarden employs a **Ho
98
103
  4. **Aggressive Obfuscation:** The final distribution is run through proprietary, high-entropy obfuscation routines to protect the model weights and heavily penalize reverse engineering attempts.
99
104
 
100
105
  If you require absolute, mathematically unbroken security, client-side protection will never be enough. You **must** validate payloads on your backend:
106
+
101
107
  - **For WordPress:** Use our [SpamWarden WP Plugin](https://redsocs.com/spam-warden) to protect your server at the PHP layer (Paid).
102
108
  - **For Node.js/Custom Stacks:** Grab this NPM package directly, bundle it internally, and run the `spamcheck()` function on your backend server before hitting your database (Free).
103
109
 
@@ -118,7 +124,7 @@ You can spin up a local simulation server to test the DOM auto-blocking behavior
118
124
  ```text
119
125
  🚨 [SIEM RECEIVER] Blocked Payload Received!
120
126
  ================================================
121
- Client Token: MXxodHRwOi8vbG9jYWxob3N0OjMwMDAvdjEvdGVsZW1ldHJ5
127
+ Endpoint Token: MXxodHRwOi8vbG9jYWxob3N0OjMwMDAvdjEvdGVsZW1ldHJ5
122
128
  URL: h_tt_p://localhost:3000/
123
129
  Rule Matched: currency_symbol
124
130
  Confidence: 100%
@@ -147,4 +153,4 @@ You can spin up a local simulation server to test the DOM auto-blocking behavior
147
153
  | **Minified Size** | ~2.0 MB (including model) |
148
154
  | **Gzipped Size** | **~341 KB** |
149
155
  | **Dependencies** | 0 (Vanilla JS) |
150
- | **Vocabulary** | 28106 features |
156
+ | **Vocabulary** | 28106 features |