cbrowser 16.1.0 → 16.3.0
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/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/stealth/index.d.ts +1 -0
- package/dist/stealth/index.d.ts.map +1 -1
- package/dist/stealth/index.js +2 -0
- package/dist/stealth/index.js.map +1 -1
- package/dist/stealth/loader.d.ts +60 -0
- package/dist/stealth/loader.d.ts.map +1 -0
- package/dist/stealth/loader.js +139 -0
- package/dist/stealth/loader.js.map +1 -0
- package/docs/ENTERPRISE-INTEGRATION.md +244 -0
- package/package.json +6 -1
package/dist/stealth/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export { DEFAULT_STEALTH_CONFIG, MINIMUM_RATE_LIMITS, STEALTH_TERMS_OF_SERVICE, matchesDomainPattern, isProhibitedDomain, validateAcknowledgment, mergeStealthConfig, BaseConstitutionalEnforcer, NoOpConstitutionalEnforcer, } from "./framework.js";
|
|
20
20
|
export type { StealthConfig, StealthAuthorization, StealthAcknowledgment, StealthRateLimits, StealthAuditEntry, StealthCheckResult, IConstitutionalEnforcer, } from "./framework.js";
|
|
21
|
+
export { getEnforcer, getEnforcerSync, isEnterpriseAvailable, getEnterpriseVersion, printEnterpriseStatus, } from "./loader.js";
|
|
21
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stealth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stealth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
|
package/dist/stealth/index.js
CHANGED
|
@@ -17,4 +17,6 @@
|
|
|
17
17
|
* Full implementation available in cbrowser-enterprise.
|
|
18
18
|
*/
|
|
19
19
|
export { DEFAULT_STEALTH_CONFIG, MINIMUM_RATE_LIMITS, STEALTH_TERMS_OF_SERVICE, matchesDomainPattern, isProhibitedDomain, validateAcknowledgment, mergeStealthConfig, BaseConstitutionalEnforcer, NoOpConstitutionalEnforcer, } from "./framework.js";
|
|
20
|
+
// Enterprise loader (v15.0.0)
|
|
21
|
+
export { getEnforcer, getEnforcerSync, isEnterpriseAvailable, getEnterpriseVersion, printEnterpriseStatus, } from "./loader.js";
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stealth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stealth/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;;;;GAKG;AAEH,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAYxB,8BAA8B;AAC9B,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBrowser - Cognitive Browser Automation
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 WF Media (Alexandria Eden)
|
|
5
|
+
* Email: alexandria.shai.eden@gmail.com
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the Business Source License 1.1
|
|
8
|
+
* found in the LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Enterprise Loader (v15.0.0)
|
|
12
|
+
*
|
|
13
|
+
* Dynamically loads cbrowser-enterprise if installed.
|
|
14
|
+
* Falls back to NoOpConstitutionalEnforcer for public-only users.
|
|
15
|
+
*/
|
|
16
|
+
import type { IConstitutionalEnforcer, StealthConfig } from "../types.js";
|
|
17
|
+
/**
|
|
18
|
+
* Check if enterprise module is available
|
|
19
|
+
*/
|
|
20
|
+
export declare function isEnterpriseAvailable(): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Get enterprise version if available
|
|
23
|
+
*/
|
|
24
|
+
export declare function getEnterpriseVersion(): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Get the appropriate constitutional enforcer
|
|
27
|
+
*
|
|
28
|
+
* Returns EnterpriseConstitutionalEnforcer if cbrowser-enterprise is installed,
|
|
29
|
+
* otherwise returns NoOpConstitutionalEnforcer.
|
|
30
|
+
*
|
|
31
|
+
* @param config - Optional stealth configuration
|
|
32
|
+
* @returns Constitutional enforcer instance
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // Auto-detect enterprise
|
|
37
|
+
* const enforcer = await getEnforcer();
|
|
38
|
+
*
|
|
39
|
+
* // With custom config
|
|
40
|
+
* const enforcer = await getEnforcer({
|
|
41
|
+
* enabled: true,
|
|
42
|
+
* authorization: {
|
|
43
|
+
* authorizedDomains: ["*.mycompany.com"],
|
|
44
|
+
* },
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function getEnforcer(config?: Partial<StealthConfig>): Promise<IConstitutionalEnforcer>;
|
|
49
|
+
/**
|
|
50
|
+
* Create enforcer synchronously (uses cached module)
|
|
51
|
+
*
|
|
52
|
+
* Must call isEnterpriseAvailable() first to load module.
|
|
53
|
+
* If called before loading, returns NoOp enforcer.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getEnforcerSync(config?: Partial<StealthConfig>): IConstitutionalEnforcer;
|
|
56
|
+
/**
|
|
57
|
+
* Print enterprise status for diagnostics
|
|
58
|
+
*/
|
|
59
|
+
export declare function printEnterpriseStatus(): Promise<void>;
|
|
60
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/stealth/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAa1E;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC,CAW9D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,IAAI,CAEpD;AA4CD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,WAAW,CAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC9B,OAAO,CAAC,uBAAuB,CAAC,CASlC;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAC9B,uBAAuB,CAMzB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoB3D"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CBrowser - Cognitive Browser Automation
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 WF Media (Alexandria Eden)
|
|
5
|
+
* Email: alexandria.shai.eden@gmail.com
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the Business Source License 1.1
|
|
8
|
+
* found in the LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
import { NoOpConstitutionalEnforcer } from "./framework.js";
|
|
11
|
+
/** Cache the loaded module */
|
|
12
|
+
let enterpriseModule = null;
|
|
13
|
+
let loadAttempted = false;
|
|
14
|
+
/**
|
|
15
|
+
* Check if enterprise module is available
|
|
16
|
+
*/
|
|
17
|
+
export async function isEnterpriseAvailable() {
|
|
18
|
+
if (loadAttempted) {
|
|
19
|
+
return enterpriseModule !== null;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
await loadEnterpriseModule();
|
|
23
|
+
return enterpriseModule !== null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get enterprise version if available
|
|
31
|
+
*/
|
|
32
|
+
export function getEnterpriseVersion() {
|
|
33
|
+
return enterpriseModule?.version ?? null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Attempt to load enterprise module
|
|
37
|
+
*/
|
|
38
|
+
async function loadEnterpriseModule() {
|
|
39
|
+
if (loadAttempted) {
|
|
40
|
+
return enterpriseModule;
|
|
41
|
+
}
|
|
42
|
+
loadAttempted = true;
|
|
43
|
+
try {
|
|
44
|
+
// Dynamic import of enterprise package
|
|
45
|
+
// This will fail gracefully if not installed
|
|
46
|
+
// Use string variable to prevent TypeScript from resolving at compile time
|
|
47
|
+
const enterprisePackage = "cbrowser-enterprise";
|
|
48
|
+
const module = await import(/* webpackIgnore: true */ enterprisePackage);
|
|
49
|
+
// Validate module shape
|
|
50
|
+
if (module.EnterpriseConstitutionalEnforcer &&
|
|
51
|
+
typeof module.EnterpriseConstitutionalEnforcer === "function") {
|
|
52
|
+
enterpriseModule = module;
|
|
53
|
+
console.log(`[CBrowser] Enterprise module loaded (v${module.version || "unknown"})`);
|
|
54
|
+
return enterpriseModule;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.warn("[CBrowser] Enterprise module found but invalid shape");
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
// Not installed - this is expected for public-only users
|
|
63
|
+
if (error.code === "ERR_MODULE_NOT_FOUND") {
|
|
64
|
+
// Silent - enterprise not installed
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
// Unexpected error
|
|
68
|
+
console.warn("[CBrowser] Failed to load enterprise module:", error);
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get the appropriate constitutional enforcer
|
|
74
|
+
*
|
|
75
|
+
* Returns EnterpriseConstitutionalEnforcer if cbrowser-enterprise is installed,
|
|
76
|
+
* otherwise returns NoOpConstitutionalEnforcer.
|
|
77
|
+
*
|
|
78
|
+
* @param config - Optional stealth configuration
|
|
79
|
+
* @returns Constitutional enforcer instance
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // Auto-detect enterprise
|
|
84
|
+
* const enforcer = await getEnforcer();
|
|
85
|
+
*
|
|
86
|
+
* // With custom config
|
|
87
|
+
* const enforcer = await getEnforcer({
|
|
88
|
+
* enabled: true,
|
|
89
|
+
* authorization: {
|
|
90
|
+
* authorizedDomains: ["*.mycompany.com"],
|
|
91
|
+
* },
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export async function getEnforcer(config) {
|
|
96
|
+
const enterprise = await loadEnterpriseModule();
|
|
97
|
+
if (enterprise) {
|
|
98
|
+
return new enterprise.EnterpriseConstitutionalEnforcer(config);
|
|
99
|
+
}
|
|
100
|
+
// Fall back to NoOp
|
|
101
|
+
return new NoOpConstitutionalEnforcer(config);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create enforcer synchronously (uses cached module)
|
|
105
|
+
*
|
|
106
|
+
* Must call isEnterpriseAvailable() first to load module.
|
|
107
|
+
* If called before loading, returns NoOp enforcer.
|
|
108
|
+
*/
|
|
109
|
+
export function getEnforcerSync(config) {
|
|
110
|
+
if (enterpriseModule) {
|
|
111
|
+
return new enterpriseModule.EnterpriseConstitutionalEnforcer(config);
|
|
112
|
+
}
|
|
113
|
+
return new NoOpConstitutionalEnforcer(config);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Print enterprise status for diagnostics
|
|
117
|
+
*/
|
|
118
|
+
export async function printEnterpriseStatus() {
|
|
119
|
+
const available = await isEnterpriseAvailable();
|
|
120
|
+
if (available) {
|
|
121
|
+
console.log("╔══════════════════════════════════════════════════════════╗");
|
|
122
|
+
console.log("║ CBrowser Enterprise: ACTIVE ║");
|
|
123
|
+
console.log(`║ Version: ${(getEnterpriseVersion() || "unknown").padEnd(47)}║`);
|
|
124
|
+
console.log("║ Stealth capabilities: ENABLED ║");
|
|
125
|
+
console.log("╚══════════════════════════════════════════════════════════╝");
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
console.log("╔══════════════════════════════════════════════════════════╗");
|
|
129
|
+
console.log("║ CBrowser Enterprise: NOT INSTALLED ║");
|
|
130
|
+
console.log("║ Stealth capabilities: DISABLED (NoOp mode) ║");
|
|
131
|
+
console.log("║ ║");
|
|
132
|
+
console.log("║ To enable enterprise features: ║");
|
|
133
|
+
console.log("║ npm install cbrowser-enterprise --registry <private> ║");
|
|
134
|
+
console.log("║ ║");
|
|
135
|
+
console.log("║ Contact: alexandria.shai.eden@gmail.com ║");
|
|
136
|
+
console.log("╚══════════════════════════════════════════════════════════╝");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/stealth/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAQ5D,8BAA8B;AAC9B,IAAI,gBAAgB,GAA4B,IAAI,CAAC;AACrD,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACzC,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,gBAAgB,KAAK,IAAI,CAAC;IACnC,CAAC;IAED,IAAI,CAAC;QACH,MAAM,oBAAoB,EAAE,CAAC;QAC7B,OAAO,gBAAgB,KAAK,IAAI,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,gBAAgB,EAAE,OAAO,IAAI,IAAI,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,oBAAoB;IACjC,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,gBAA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
|
|
3
|
+
This document explains how to integrate the private `cbrowser-enterprise` package with the public `cbrowser` package.
|
|
4
|
+
|
|
5
|
+
## Architecture Overview
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
9
|
+
│ cbrowser (public npm) │
|
|
10
|
+
│ ├── IConstitutionalEnforcer (interface) │
|
|
11
|
+
│ ├── BaseConstitutionalEnforcer (abstract base class) │
|
|
12
|
+
│ ├── NoOpConstitutionalEnforcer (fallback) │
|
|
13
|
+
│ └── getEnforcer() → dynamic loader │
|
|
14
|
+
└─────────────────────────────────────────────────────────────┘
|
|
15
|
+
│
|
|
16
|
+
│ dynamic import (optional)
|
|
17
|
+
▼
|
|
18
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
19
|
+
│ cbrowser-enterprise (private npm/GitHub Packages) │
|
|
20
|
+
│ ├── EnterpriseConstitutionalEnforcer │
|
|
21
|
+
│ │ ├── applyStealthMeasures() — real implementation │
|
|
22
|
+
│ │ ├── persistAuditEntry() — database logging │
|
|
23
|
+
│ │ └── Full fingerprint evasion suite │
|
|
24
|
+
│ └── exports { EnterpriseConstitutionalEnforcer, version } │
|
|
25
|
+
└─────────────────────────────────────────────────────────────┘
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Enterprise Package Structure
|
|
29
|
+
|
|
30
|
+
Create a private repository `cbrowser-enterprise`:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
cbrowser-enterprise/
|
|
34
|
+
├── package.json
|
|
35
|
+
├── tsconfig.json
|
|
36
|
+
├── src/
|
|
37
|
+
│ ├── index.ts # Main exports
|
|
38
|
+
│ ├── enforcer.ts # EnterpriseConstitutionalEnforcer
|
|
39
|
+
│ ├── stealth/
|
|
40
|
+
│ │ ├── fingerprint.ts # Browser fingerprint normalization
|
|
41
|
+
│ │ ├── webdriver.ts # WebDriver flag patching
|
|
42
|
+
│ │ ├── timing.ts # Human-like timing injection
|
|
43
|
+
│ │ └── canvas.ts # Canvas/WebGL normalization
|
|
44
|
+
│ └── audit/
|
|
45
|
+
│ └── persistence.ts # Audit log database
|
|
46
|
+
└── dist/ # Compiled output
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### package.json (Enterprise)
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"name": "cbrowser-enterprise",
|
|
54
|
+
"version": "1.0.0",
|
|
55
|
+
"type": "module",
|
|
56
|
+
"main": "dist/index.js",
|
|
57
|
+
"types": "dist/index.d.ts",
|
|
58
|
+
"private": true,
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"cbrowser": ">=15.0.0"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"registry": "https://npm.pkg.github.com"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### src/index.ts (Enterprise)
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
export { EnterpriseConstitutionalEnforcer } from "./enforcer.js";
|
|
72
|
+
export const version = "1.0.0";
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### src/enforcer.ts (Enterprise Template)
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import {
|
|
79
|
+
BaseConstitutionalEnforcer,
|
|
80
|
+
type StealthConfig,
|
|
81
|
+
type StealthAuditEntry,
|
|
82
|
+
} from "cbrowser";
|
|
83
|
+
import type { Page } from "playwright";
|
|
84
|
+
|
|
85
|
+
export class EnterpriseConstitutionalEnforcer extends BaseConstitutionalEnforcer {
|
|
86
|
+
constructor(config?: Partial<StealthConfig>) {
|
|
87
|
+
super(config);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Persist audit entries to database
|
|
92
|
+
*/
|
|
93
|
+
protected async persistAuditEntry(entry: StealthAuditEntry): Promise<void> {
|
|
94
|
+
// TODO: Implement database persistence
|
|
95
|
+
// - SQLite for local
|
|
96
|
+
// - PostgreSQL for production
|
|
97
|
+
console.log("[Enterprise] Audit:", JSON.stringify(entry));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Apply stealth measures to page
|
|
102
|
+
*/
|
|
103
|
+
async applyStealthMeasures(page: Page): Promise<void> {
|
|
104
|
+
// 1. Patch navigator.webdriver
|
|
105
|
+
await page.addInitScript(() => {
|
|
106
|
+
Object.defineProperty(navigator, "webdriver", {
|
|
107
|
+
get: () => undefined,
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// 2. Inject realistic plugins
|
|
112
|
+
await page.addInitScript(() => {
|
|
113
|
+
Object.defineProperty(navigator, "plugins", {
|
|
114
|
+
get: () => [
|
|
115
|
+
{ name: "Chrome PDF Plugin" },
|
|
116
|
+
{ name: "Chrome PDF Viewer" },
|
|
117
|
+
{ name: "Native Client" },
|
|
118
|
+
],
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// 3. Patch chrome object
|
|
123
|
+
await page.addInitScript(() => {
|
|
124
|
+
(window as any).chrome = {
|
|
125
|
+
runtime: {},
|
|
126
|
+
loadTimes: () => {},
|
|
127
|
+
csi: () => {},
|
|
128
|
+
};
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// 4. Normalize WebGL fingerprint
|
|
132
|
+
await this.normalizeWebGL(page);
|
|
133
|
+
|
|
134
|
+
// 5. Add human-like mouse movement patterns
|
|
135
|
+
// (Injected via persona's humanBehavior traits)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private async normalizeWebGL(page: Page): Promise<void> {
|
|
139
|
+
await page.addInitScript(() => {
|
|
140
|
+
const getParameterProxy = new Proxy(
|
|
141
|
+
WebGLRenderingContext.prototype.getParameter,
|
|
142
|
+
{
|
|
143
|
+
apply(target, thisArg, args) {
|
|
144
|
+
const param = args[0];
|
|
145
|
+
// Normalize common fingerprint vectors
|
|
146
|
+
if (param === 37445) return "Intel Inc."; // UNMASKED_VENDOR
|
|
147
|
+
if (param === 37446) return "Intel Iris OpenGL Engine"; // UNMASKED_RENDERER
|
|
148
|
+
return Reflect.apply(target, thisArg, args);
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
WebGLRenderingContext.prototype.getParameter = getParameterProxy;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Publishing Enterprise Package
|
|
159
|
+
|
|
160
|
+
### Option 1: GitHub Packages (Recommended)
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# In cbrowser-enterprise repo
|
|
164
|
+
npm login --registry=https://npm.pkg.github.com --scope=@yourorg
|
|
165
|
+
npm publish
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Option 2: Private npm Registry
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Using Verdaccio or npm Enterprise
|
|
172
|
+
npm publish --registry https://your-private-registry.com
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Option 3: Git Dependency
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"dependencies": {
|
|
180
|
+
"cbrowser-enterprise": "git+ssh://git@github.com:yourorg/cbrowser-enterprise.git"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Installing Enterprise for MCP Server
|
|
186
|
+
|
|
187
|
+
On your MCP server host:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Install public package
|
|
191
|
+
npm install cbrowser
|
|
192
|
+
|
|
193
|
+
# Install enterprise (with auth)
|
|
194
|
+
npm install cbrowser-enterprise --registry https://npm.pkg.github.com
|
|
195
|
+
|
|
196
|
+
# Or with .npmrc
|
|
197
|
+
echo "@yourorg:registry=https://npm.pkg.github.com" >> .npmrc
|
|
198
|
+
echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" >> .npmrc
|
|
199
|
+
npm install @yourorg/cbrowser-enterprise
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Usage in MCP Server
|
|
203
|
+
|
|
204
|
+
The MCP server automatically detects enterprise:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
import { getEnforcer, printEnterpriseStatus } from "cbrowser";
|
|
208
|
+
|
|
209
|
+
// On startup
|
|
210
|
+
await printEnterpriseStatus();
|
|
211
|
+
|
|
212
|
+
// When creating browser with stealth
|
|
213
|
+
const enforcer = await getEnforcer({
|
|
214
|
+
enabled: true,
|
|
215
|
+
authorization: {
|
|
216
|
+
authorizedDomains: ["*.yourdomain.com"],
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// Use enforcer with browser
|
|
221
|
+
const browser = new CBrowser({ enforcer });
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Verification
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Check if enterprise is detected
|
|
228
|
+
npx cbrowser status
|
|
229
|
+
|
|
230
|
+
# Output with enterprise:
|
|
231
|
+
# ╔══════════════════════════════════════════════════════════╗
|
|
232
|
+
# ║ CBrowser Enterprise: ACTIVE ║
|
|
233
|
+
# ║ Version: 1.0.0 ║
|
|
234
|
+
# ║ Stealth capabilities: ENABLED ║
|
|
235
|
+
# ╚══════════════════════════════════════════════════════════╝
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Security Notes
|
|
239
|
+
|
|
240
|
+
1. **Never commit enterprise to public repo** - It's a separate private package
|
|
241
|
+
2. **Use GitHub Packages or private npm** - Not public npm registry
|
|
242
|
+
3. **Rotate access tokens** - Use short-lived tokens for CI/CD
|
|
243
|
+
4. **Audit logs are immutable** - Cannot be disabled or cleared
|
|
244
|
+
5. **Rate limits enforced** - Minimum limits cannot be lowered
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cbrowser",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cognitive browser automation that thinks like your users. Simulate real user cognition with abandonment detection, constitutional safety, chaos engineering, and UX friction discovery.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,6 +33,11 @@
|
|
|
33
33
|
"types": "./dist/performance/index.d.ts",
|
|
34
34
|
"import": "./dist/performance/index.js",
|
|
35
35
|
"require": "./dist/performance/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./stealth": {
|
|
38
|
+
"types": "./dist/stealth/index.d.ts",
|
|
39
|
+
"import": "./dist/stealth/index.js",
|
|
40
|
+
"require": "./dist/stealth/index.js"
|
|
36
41
|
}
|
|
37
42
|
},
|
|
38
43
|
"scripts": {
|