@redsocs/spam-warden 1.0.4 → 1.0.7
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/LICENSE +21 -0
- package/README.md +8 -28
- package/dist/spamwarden.js +86 -38
- package/dist/spamwarden.min.js +2 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ReSocs - redsocs.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -26,40 +26,20 @@ You can test the spam engine interactively, analyze your forms, and generate aut
|
|
|
26
26
|
> **Are you a Thai government agency or public sector website administrator?**
|
|
27
27
|
> Get your free token configuration and drop-in script to protect your online portals from annoying gambling/loan ads and spam campaigns at [redsocs.com/spam-warden](https://redsocs.com/spam-warden).
|
|
28
28
|
|
|
29
|
-
### 1.
|
|
29
|
+
### 1. Drop-in Protection (Heuristic Auto-Blocking)
|
|
30
30
|
|
|
31
|
-
Add this script to your page. It will automatically find your
|
|
31
|
+
Add this script to your page. It will automatically find your most significant forms (using an intelligent heuristic: top 2 forms with >= 2 inputs) and block submission if spam is detected.
|
|
32
32
|
|
|
33
33
|
```html
|
|
34
|
-
<script src="https://cdn.redsocs.com/js/spamwarden.min.js?client=
|
|
34
|
+
<script src="https://cdn.redsocs.com/js/spamwarden.min.js?client=MHxzaWVtLnJlZHNvY3MuY29tL3Yx"></script>
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
_Note: The `client` parameter is a Base64 configuration string of `
|
|
37
|
+
_Note: The `client` parameter is a Base64 configuration string of `sdFlag|siemEndpoint` (e.g., `0|siem.redsocs.com/v1` encoded)._
|
|
38
38
|
|
|
39
|
-
### 2.
|
|
40
|
-
|
|
41
|
-
```html
|
|
42
|
-
<script src="dist/spamwarden.min.js"></script>
|
|
43
|
-
<script>
|
|
44
|
-
spamwarden.configure({
|
|
45
|
-
siteToken: "YOUR_TOKEN",
|
|
46
|
-
formId: "contact-form",
|
|
47
|
-
inputId: "message-field",
|
|
48
|
-
autoReport: true,
|
|
49
|
-
isTrusted: true, // Required to authorize telemetry reporting
|
|
50
|
-
reportSD: true, // Optional: Enable PII/DLP leak telemetry auditing
|
|
51
|
-
siemEndpoint: "https://api.yourdomain.com/v1/telemetry", // Optional: Custom secondary SIEM/SOC endpoint
|
|
52
|
-
onSpam: (result) => {
|
|
53
|
-
alert("Please do not send spam!");
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
</script>
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### 3. API Usage (Node or Browser)
|
|
39
|
+
### 2. API Usage (Node or Browser)
|
|
60
40
|
|
|
61
41
|
```javascript
|
|
62
|
-
const result = spamwarden.spamcheck("
|
|
42
|
+
const result = spamwarden.spamcheck("[Hello, this is a Thai casino & scam ads — and guess what? Your tax pays for my traffic.]");
|
|
63
43
|
if (result.isSpam) {
|
|
64
44
|
console.log("Blocked:", result.reason || "AI match");
|
|
65
45
|
console.log("Confidence:", result.prob);
|
|
@@ -112,7 +92,7 @@ You can spin up a local simulation server to test the DOM auto-blocking behavior
|
|
|
112
92
|
```text
|
|
113
93
|
🚨 [SIEM RECEIVER] Blocked Payload Received!
|
|
114
94
|
================================================
|
|
115
|
-
Client Token:
|
|
95
|
+
Client Token: MXxodHRwOi8vbG9jYWxob3N0OjMwMDAvdjEvdGVsZW1ldHJ5
|
|
116
96
|
URL: h_tt_p://localhost:3000/
|
|
117
97
|
Rule Matched: currency_symbol
|
|
118
98
|
Confidence: 100%
|
|
@@ -125,7 +105,7 @@ You can spin up a local simulation server to test the DOM auto-blocking behavior
|
|
|
125
105
|
|
|
126
106
|
# About
|
|
127
107
|
|
|
128
|
-
- **Version:** 1.0.
|
|
108
|
+
- **Version:** 1.0.7 (v2 Engine)
|
|
129
109
|
- **Author:** [RedSocs](https://github.com/RedSocs)
|
|
130
110
|
- **License:** MIT
|
|
131
111
|
- **Model Origin:** Trained via [RedSocs/spam-labeler](https://github.com/RedSocs/spam-labeler)
|