@anonympins/fingerprint 0.4.2 β†’ 0.4.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## Version 0.4.3
2
+
3
+ ### πŸ”’ Rotation Score Hardening (Anti-Spoofing & No-JS Parity)
4
+ - **Server-Only Rotation Analysis**: Completely removed all client-side telemetry (`X-Device-Fingerprint`, canvas, gpu, hardware concurrency) from the `rotationScore` computation across all engines (Node.js, PHP, Python).
5
+ - **Zero-Trust Client Inputs**: Fixed a vulnerability where client-side fingerprint spoofing or the absence of JS headers on static/API requests could trick the engines into triggering false-positive rotation alerts. The stable part analysis now relies exclusively on server-side signatures (`ua`, `ja3`, `ja4`, `h2`, `tcp`).
6
+
7
+ ### 🐍 Python Engine Parity & uPoW
8
+ - **Useful Proof-of-Work (uPoW) in Python**: Fully implemented uPoW support in Python, bringing complete parity to task dispatching and solution integration with the Node.js and PHP versions.
9
+ - **Dry Run & Score Matching**: Added robust Dry Run mode and suspicion score calculations in the Python engine, allowing passive security evaluation without request interruption.
10
+
11
+ ### 🐘 PHP Engine Enhancements
12
+ - **PHP uPoW Coverage**: Greatly expanded test coverage for the PHP `ProblemManager` and useful work integrations, ensuring reliability under heavy workloads.
13
+
14
+ ### πŸ›‘οΈ Challenge Routing & Better Re-challenge
15
+ - **Refined Challenge Router**: Restructured challenge routing and solution validation pipelines for direct, consistent handling of cryptographic results.
16
+ - **Smarter Re-challenging**: Improved re-challenge behavior across all engines. If an already cleared device's score spikes above the high threshold again, the existing clearance ticket is bypassed, instantly prompting a fresh security challenge.
17
+
1
18
  ## Version 0.4.2 (Hotfix)
2
19
 
3
20
  ### 🧬 Auto-Tuner Rework & Sanity Guardrails
package/README.md CHANGED
@@ -1,61 +1,67 @@
1
- # Fingerprint anti-bot protection
2
-
3
- NodeJS tests : [![Test NodeJS](https://img.shields.io/github/actions/workflow/status/anonympins/fingerprint/ci-nodejs.yml)](https://github.com/anonympins/fingerprint/actions/workflows/ci.yml) / PHP tests : [![PHP](https://img.shields.io/github/actions/workflow/status/anonympins/fingerprint/ci-php.yml)](https://github.com/anonympins/fingerprint/actions/workflows/ci-php.yml) / Python tests : [![PHP](https://img.shields.io/github/actions/workflow/status/anonympins/fingerprint/ci-php.yml)](https://github.com/anonympins/fingerprint/actions/workflows/ci-python.yml)
4
-
5
- [![Release](https://img.shields.io/github/v/release/anonympins/fingerprint)](https://github.com/anonympins/fingerprint/releases)
6
- [![License](https://img.shields.io/github/license/anonympins/fingerprint)](https://github.com/anonympins/fingerprint/blob/main/LICENSE)
7
- ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/anonympins/fingerprint)
8
-
9
- A multi-layered behavioral, cryptographic, and network analysis engine designed to identify and mitigate malicious requests (bots, scrapers, session hijacking) in real-time. Supports both **Node.js** and **PHP** environments.
10
-
11
- ![illustration](https://i.ibb.co/fV1QT6Mf/image-c6e10859baae53bb595112ec08fc9e27.png)
12
-
13
- ## Key Features
14
-
15
- - **Multi-Layered Detection**: Combines TLS/JA3/JA4 analysis, HTTP header consistency checks, IP reputation, and behavioral tracking (mouse movements, keystrokes).
16
- - **Adaptive Mitigation**: Imposes progressive cryptographic Proof-of-Work (PoW) challenges to block automated clients without impacting legitimate human users.
17
- - **Predefined Profiles**: Ready-to-use security profiles (`balanced`, `strict`, `api`, `blog`, `ecommerce`) tailored to your specific use case.
18
-
19
- ## Quick Start
20
-
21
- ### Node.js
22
-
23
- ```bash
24
- npm install @anonympins/fingerprint
25
- ```
26
-
27
- ### PHP
28
-
29
- ```bash
30
- composer require anonympins/fingerprint
31
- ```
32
-
33
- ## Documentation
34
-
35
- To prevent documentation drift, all detailed guides and reference materials are maintained in the `doc/` directory. Please refer to [these resources](https://github.com/anonympins/fingerprint/wiki/home) to configure and integrate the engine:
36
-
37
- 1. **[Key Concepts & Suspicion Vectors](https://github.com/anonympins/fingerprint/wiki/concepts)**: Learn how the engine calculates suspicion scores across the 15 distinct vectors and manages the Proof-of-Work mitigation layers.
38
- 2. **[Node.js Integration Guide](https://github.com/anonympins/fingerprint/wiki/nodejs_integration)**: Step-by-step instructions for Express.js middleware and raw HTTP server integrations.
39
- 3. **[PHP Integration Guide](https://github.com/anonympins/fingerprint/wiki/php_integration)**: Configuration details for direct PHP integration, TLS fingerprinting forwarding via Nginx/Apache, and securing Prometheus metrics.
40
- 4. **[Full Configuration Options](https://github.com/anonympins/fingerprint/wiki/full_options)**: Complete parameter list for fine-tuning weights, custom honeypots, and security profile overrides.
41
- 5. **[API Reference](https://github.com/anonympins/fingerprint/wiki/api_reference)**: Public API signatures and guides on substituting the in-memory datastore with Redis or MongoDB.
42
-
43
- Start with the **[Documentation Portal](https://github.com/anonympins/fingerprint/wiki/home)** for a complete index.
44
-
45
- ## Contributing
46
-
47
- We welcome community contributions! Please read our **[Contributing Guidelines](https://github.com/anonympins/fingerprint/blob/main/CONTRIBUTING.md)** for information on:
48
- - Setting up your local environment (Node.js and PHP).
49
- - Running the test suites (`Vitest` and `PHPUnit`).
50
- - Coding and pull request standards.
51
-
52
- Thanks to our contributors :
53
- - [anonympins](https://github.com/anonympins)
54
-
55
- ## Used actively on
56
-
57
- - https://primals.net and sub-sites
58
-
59
- ## License
60
-
1
+ # Fingerprint anti-bot protection
2
+
3
+ NodeJS tests : [![Test NodeJS](https://img.shields.io/github/actions/workflow/status/anonympins/fingerprint/ci-nodejs.yml)](https://github.com/anonympins/fingerprint/actions/workflows/ci.yml) / PHP tests : [![PHP](https://img.shields.io/github/actions/workflow/status/anonympins/fingerprint/ci-php.yml)](https://github.com/anonympins/fingerprint/actions/workflows/ci-php.yml) / Python tests : [![PHP](https://img.shields.io/github/actions/workflow/status/anonympins/fingerprint/ci-php.yml)](https://github.com/anonympins/fingerprint/actions/workflows/ci-python.yml)
4
+
5
+ [![Release](https://img.shields.io/github/v/release/anonympins/fingerprint)](https://github.com/anonympins/fingerprint/releases)
6
+ [![License](https://img.shields.io/github/license/anonympins/fingerprint)](https://github.com/anonympins/fingerprint/blob/main/LICENSE)
7
+ ![GitHub commit activity](https://img.shields.io/github/commit-activity/w/anonympins/fingerprint)
8
+
9
+ A multi-layered behavioral, cryptographic, and network analysis engine designed to identify and mitigate malicious requests (bots, scrapers, session hijacking) in real-time. Supports both **Node.js** and **PHP** environments.
10
+
11
+ ![illustration](https://i.ibb.co/fV1QT6Mf/image-c6e10859baae53bb595112ec08fc9e27.png)
12
+
13
+ ## Key Features
14
+
15
+ - **Multi-Layered Detection**: Combines TLS/JA3/JA4 analysis, HTTP header consistency checks, IP reputation, and behavioral tracking (mouse movements, keystrokes).
16
+ - **Adaptive Mitigation**: Imposes progressive cryptographic Proof-of-Work (PoW) challenges to block automated clients without impacting legitimate human users.
17
+ - **Predefined Profiles**: Ready-to-use security profiles (`balanced`, `strict`, `api`, `blog`, `ecommerce`) tailored to your specific use case.
18
+
19
+ ## Quick Start
20
+
21
+ ### Node.js
22
+
23
+ ```bash
24
+ npm install @anonympins/fingerprint
25
+ ```
26
+
27
+ ### PHP
28
+
29
+ ```bash
30
+ composer require anonympins/fingerprint
31
+ ```
32
+
33
+ ### Python
34
+ ```bash
35
+ pip install fingerprint-engine
36
+ ```
37
+
38
+ ## Documentation
39
+
40
+ To prevent documentation drift, all detailed guides and reference materials are maintained in the `doc/` directory. Please refer to [these resources](https://github.com/anonympins/fingerprint/wiki/home) to configure and integrate the engine:
41
+
42
+ 1. **[Key Concepts & Suspicion Vectors](https://github.com/anonympins/fingerprint/wiki/concepts)**: Learn how the engine calculates suspicion scores across the 15 distinct vectors and manages the Proof-of-Work mitigation layers.
43
+ 2. **[Node.js Integration Guide](https://github.com/anonympins/fingerprint/wiki/nodejs_integration)**: Step-by-step instructions for Express.js middleware and raw HTTP server integrations.
44
+ 3. **[PHP Integration Guide](https://github.com/anonympins/fingerprint/wiki/php_integration)**: Configuration details for direct PHP integration, TLS fingerprinting forwarding via Nginx/Apache, and securing Prometheus metrics.
45
+ 3. **[Python Integration Guide](https://github.com/anonympins/fingerprint/wiki/python_integration)**: Python middleware for ASGI and WSGI integration.
46
+ 4. **[Full Configuration Options](https://github.com/anonympins/fingerprint/wiki/full_options)**: Complete parameter list for fine-tuning weights, custom honeypots, and security profile overrides.
47
+ 5. **[API Reference](https://github.com/anonympins/fingerprint/wiki/api_reference)**: Public API signatures and guides on substituting the in-memory datastore with Redis or MongoDB.
48
+
49
+ Start with the **[Documentation Portal](https://github.com/anonympins/fingerprint/wiki/home)** for a complete index.
50
+
51
+ ## Contributing
52
+
53
+ We welcome community contributions! Please read our **[Contributing Guidelines](https://github.com/anonympins/fingerprint/blob/main/CONTRIBUTING.md)** for information on:
54
+ - Setting up your local environment (Node.js and PHP).
55
+ - Running the test suites (`Vitest` and `PHPUnit`).
56
+ - Coding and pull request standards.
57
+
58
+ Thanks to our contributors :
59
+ - [anonympins](https://github.com/anonympins)
60
+
61
+ ## Used actively on
62
+
63
+ - https://primals.net and sub-sites
64
+
65
+ ## License
66
+
61
67
  This project is licensed under the MIT License.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anonympins/fingerprint",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Advanced anti-bot library for Node.js using multi-layer fingerprinting (JA3, client-side, headers), behavioral analysis, and adaptive Proof-of-Work (PoW) challenges to mitigate scraping, scalping, and automated threats.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -263,7 +263,7 @@ function extractStablePart(fpString) {
263
263
  if (!fpString) {
264
264
  return '';
265
265
  }
266
- const stableKeys = ['cvs', 'gpu', 'hw', 'client_fp_hash', 'os', 'scr'];
266
+ const stableKeys = ['ua', 'ja3', 'ja4', 'h2', 'tcp'];
267
267
  const parts = fpString.split('|');
268
268
  const stableParts = [];
269
269
  for (const part of parts) {
@@ -3421,7 +3421,15 @@ export class FingerprintEngine {
3421
3421
  }
3422
3422
 
3423
3423
  if (isSuspicious && usefulWorkDispatched) {
3424
- return { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404, body: challengePayload };
3424
+ const isApi = requestContext.rawReq && this.securityConfig?.isApiRequest?.(requestContext.rawReq);
3425
+ if (isApi) {
3426
+ return { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404, body: challengePayload };
3427
+ } else {
3428
+ const html = `<html><body><script>
3429
+ window.location.href = "${path}?pow_type=useful_work_task&pow_nonce=${nonce}&pow_problem_id=${challengePayload.challenge.usefulWorkTask.problemId}&pow_solution_work_result=" + encodeURIComponent(JSON.stringify({ solution: [], energy: 0 }));
3430
+ </script></body></html>`;
3431
+ return { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404, body: html };
3432
+ }
3425
3433
  } else if (isSuspicious) { // Pour les scores bas/moyens ou si le travail utile n'est pas choisi / a Γ©chouΓ©
3426
3434
  const decision = { action: 'challenge', score: finalScore, vector: suspicionVector, status: 404 };
3427
3435
  if (this.dryRun) {