erosolar-cli 1.7.55 → 1.7.56
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/package.json +1 -1
- package/dist/active-stack-security.d.ts +0 -110
- package/dist/active-stack-security.js +0 -313
- package/dist/active-stack-security.js.map +0 -1
- package/dist/advanced-targeting.d.ts +0 -113
- package/dist/advanced-targeting.js +0 -252
- package/dist/advanced-targeting.js.map +0 -1
- package/dist/bin/adapters/node/index.js +0 -33
- package/dist/bin/adapters/types.js +0 -1
- package/dist/bin/alpha-zero/agentWrapper.js +0 -165
- package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
- package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
- package/dist/bin/alpha-zero/index.js +0 -98
- package/dist/bin/alpha-zero/introspection.js +0 -298
- package/dist/bin/alpha-zero/metricsTracker.js +0 -207
- package/dist/bin/alpha-zero/security/core.js +0 -269
- package/dist/bin/alpha-zero/security/google.js +0 -308
- package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
- package/dist/bin/alpha-zero/security/index.js +0 -31
- package/dist/bin/alpha-zero/security/simulation.js +0 -274
- package/dist/bin/alpha-zero/selfModification.js +0 -231
- package/dist/bin/alpha-zero/types.js +0 -30
- package/dist/bin/bin/erosolar-optimized.js +0 -205
- package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
- package/dist/bin/capabilities/bashCapability.js +0 -22
- package/dist/bin/capabilities/cloudCapability.js +0 -36
- package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
- package/dist/bin/capabilities/codeQualityCapability.js +0 -23
- package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
- package/dist/bin/capabilities/devCapability.js +0 -22
- package/dist/bin/capabilities/editCapability.js +0 -28
- package/dist/bin/capabilities/emailCapability.js +0 -20
- package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
- package/dist/bin/capabilities/filesystemCapability.js +0 -22
- package/dist/bin/capabilities/globCapability.js +0 -28
- package/dist/bin/capabilities/interactionCapability.js +0 -20
- package/dist/bin/capabilities/learnCapability.js +0 -22
- package/dist/bin/capabilities/mcpCapability.js +0 -20
- package/dist/bin/capabilities/notebookCapability.js +0 -28
- package/dist/bin/capabilities/planningCapability.js +0 -27
- package/dist/bin/capabilities/refactoringCapability.js +0 -23
- package/dist/bin/capabilities/repoChecksCapability.js +0 -22
- package/dist/bin/capabilities/searchCapability.js +0 -22
- package/dist/bin/capabilities/skillCapability.js +0 -76
- package/dist/bin/capabilities/taskManagementCapability.js +0 -20
- package/dist/bin/capabilities/testingCapability.js +0 -23
- package/dist/bin/capabilities/toolManifest.js +0 -159
- package/dist/bin/capabilities/toolRegistry.js +0 -114
- package/dist/bin/capabilities/webCapability.js +0 -20
- package/dist/bin/config.js +0 -139
- package/dist/bin/contracts/v1/agent.js +0 -7
- package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
- package/dist/bin/contracts/v1/agentRules.js +0 -9
- package/dist/bin/contracts/v1/toolAccess.js +0 -8
- package/dist/bin/erosolar-optimized.d.ts +0 -12
- package/dist/bin/erosolar-optimized.d.ts.map +0 -1
- package/dist/bin/erosolar-optimized.js +0 -239
- package/dist/bin/erosolar-optimized.js.map +0 -1
- package/dist/bin/headless/headlessApp.js +0 -172
- package/dist/bin/mcp/config.js +0 -202
- package/dist/bin/mcp/stdioClient.js +0 -172
- package/dist/bin/mcp/toolBridge.js +0 -104
- package/dist/bin/mcp/types.js +0 -1
- package/dist/bin/plugins/index.js +0 -113
- package/dist/bin/plugins/providers/anthropic/index.js +0 -25
- package/dist/bin/plugins/providers/deepseek/index.js +0 -24
- package/dist/bin/plugins/providers/google/index.js +0 -26
- package/dist/bin/plugins/providers/index.js +0 -19
- package/dist/bin/plugins/providers/ollama/index.js +0 -59
- package/dist/bin/plugins/providers/openai/index.js +0 -26
- package/dist/bin/plugins/providers/xai/index.js +0 -24
- package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
- package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
- package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
- package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
- package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
- package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
- package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
- package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
- package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
- package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
- package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
- package/dist/bin/plugins/tools/index.js +0 -2
- package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
- package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
- package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
- package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
- package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
- package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
- package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
- package/dist/bin/plugins/tools/registry.js +0 -57
- package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
- package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
- package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
- package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
- package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
- package/dist/bin/providers/anthropicProvider.js +0 -329
- package/dist/bin/providers/googleProvider.js +0 -203
- package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
- package/dist/bin/providers/openaiResponsesProvider.js +0 -249
- package/dist/bin/providers/providerFactory.js +0 -24
- package/dist/bin/runtime/agentController.js +0 -321
- package/dist/bin/runtime/agentHost.js +0 -153
- package/dist/bin/runtime/agentSession.js +0 -195
- package/dist/bin/runtime/node.js +0 -10
- package/dist/bin/runtime/universal.js +0 -28
- package/dist/bin/skills/skillRepository.js +0 -236
- package/dist/bin/skills/types.js +0 -1
- package/dist/bin/subagents/taskRunner.js +0 -269
- package/dist/bin/tools/backgroundBashTools.js +0 -211
- package/dist/bin/tools/bashTools.js +0 -159
- package/dist/bin/tools/cloudTools.js +0 -864
- package/dist/bin/tools/codeAnalysisTools.js +0 -641
- package/dist/bin/tools/codeQualityTools.js +0 -294
- package/dist/bin/tools/dependencyTools.js +0 -282
- package/dist/bin/tools/devTools.js +0 -238
- package/dist/bin/tools/diffUtils.js +0 -137
- package/dist/bin/tools/editTools.js +0 -134
- package/dist/bin/tools/emailTools.js +0 -448
- package/dist/bin/tools/fileTools.js +0 -282
- package/dist/bin/tools/globTools.js +0 -173
- package/dist/bin/tools/grepTools.js +0 -332
- package/dist/bin/tools/interactionTools.js +0 -170
- package/dist/bin/tools/learnTools.js +0 -1818
- package/dist/bin/tools/notebookEditTools.js +0 -196
- package/dist/bin/tools/planningTools.js +0 -46
- package/dist/bin/tools/refactoringTools.js +0 -293
- package/dist/bin/tools/repoChecksTools.js +0 -160
- package/dist/bin/tools/searchTools.js +0 -206
- package/dist/bin/tools/skillTools.js +0 -177
- package/dist/bin/tools/taskManagementTools.js +0 -156
- package/dist/bin/tools/testingTools.js +0 -232
- package/dist/bin/tools/webTools.js +0 -480
- package/dist/bin/workspace.js +0 -106
- package/dist/bin/workspace.validator.js +0 -213
- package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
- package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/offensiveSecurityCapability.js +0 -58
- package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
- package/dist/capabilities/realSecurityCapability.d.ts +0 -26
- package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/realSecurityCapability.js +0 -53
- package/dist/capabilities/realSecurityCapability.js.map +0 -1
- package/dist/capabilities/securityCapability.d.ts +0 -32
- package/dist/capabilities/securityCapability.d.ts.map +0 -1
- package/dist/capabilities/securityCapability.js +0 -57
- package/dist/capabilities/securityCapability.js.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
- package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.js +0 -96
- package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
- package/dist/core/designThoughtCheck.d.ts +0 -196
- package/dist/core/designThoughtCheck.d.ts.map +0 -1
- package/dist/core/designThoughtCheck.js +0 -287
- package/dist/core/designThoughtCheck.js.map +0 -1
- package/dist/core/designThoughtCheckEngine.d.ts +0 -58
- package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
- package/dist/core/designThoughtCheckEngine.js +0 -358
- package/dist/core/designThoughtCheckEngine.js.map +0 -1
- package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
- package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
- package/dist/core/designThoughtCheckIntegration.js +0 -207
- package/dist/core/designThoughtCheckIntegration.js.map +0 -1
- package/dist/core/intelligenceTools.d.ts +0 -19
- package/dist/core/intelligenceTools.d.ts.map +0 -1
- package/dist/core/intelligenceTools.js +0 -453
- package/dist/core/intelligenceTools.js.map +0 -1
- package/dist/core/operationalTools.d.ts +0 -19
- package/dist/core/operationalTools.d.ts.map +0 -1
- package/dist/core/operationalTools.js +0 -467
- package/dist/core/operationalTools.js.map +0 -1
- package/dist/offensive/core/offensive-engine.d.ts +0 -171
- package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
- package/dist/offensive/core/offensive-engine.js +0 -345
- package/dist/offensive/core/offensive-engine.js.map +0 -1
- package/dist/offensive/core/offensive-integration.d.ts +0 -129
- package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
- package/dist/offensive/core/offensive-integration.js +0 -364
- package/dist/offensive/core/offensive-integration.js.map +0 -1
- package/dist/offensive/core/offensive-tools.d.ts +0 -55
- package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
- package/dist/offensive/core/offensive-tools.js +0 -438
- package/dist/offensive/core/offensive-tools.js.map +0 -1
- package/dist/offensive/offensive-cli.d.ts +0 -48
- package/dist/offensive/offensive-cli.d.ts.map +0 -1
- package/dist/offensive/offensive-cli.js +0 -233
- package/dist/offensive/offensive-cli.js.map +0 -1
- package/dist/security/apt-simulation-cli.d.ts +0 -57
- package/dist/security/apt-simulation-cli.d.ts.map +0 -1
- package/dist/security/apt-simulation-cli.js +0 -278
- package/dist/security/apt-simulation-cli.js.map +0 -1
- package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
- package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine-complete.js +0 -441
- package/dist/security/apt-simulation-engine-complete.js.map +0 -1
- package/dist/security/apt-simulation-engine.d.ts +0 -97
- package/dist/security/apt-simulation-engine.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine.js +0 -441
- package/dist/security/apt-simulation-engine.js.map +0 -1
- package/dist/security/authorization.d.ts +0 -45
- package/dist/security/authorization.d.ts.map +0 -1
- package/dist/security/authorization.js +0 -128
- package/dist/security/authorization.js.map +0 -1
- package/dist/security/comprehensive-security-research.d.ts +0 -84
- package/dist/security/comprehensive-security-research.d.ts.map +0 -1
- package/dist/security/comprehensive-security-research.js +0 -211
- package/dist/security/comprehensive-security-research.js.map +0 -1
- package/dist/security/offensive/exploitationEngine.d.ts +0 -54
- package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
- package/dist/security/offensive/exploitationEngine.js +0 -263
- package/dist/security/offensive/exploitationEngine.js.map +0 -1
- package/dist/security/real/networkExploitation.d.ts +0 -92
- package/dist/security/real/networkExploitation.d.ts.map +0 -1
- package/dist/security/real/networkExploitation.js +0 -316
- package/dist/security/real/networkExploitation.js.map +0 -1
- package/dist/security/real/persistenceImplementation.d.ts +0 -62
- package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
- package/dist/security/real/persistenceImplementation.js +0 -323
- package/dist/security/real/persistenceImplementation.js.map +0 -1
- package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
- package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
- package/dist/security/real/vulnerabilityScanner.js +0 -341
- package/dist/security/real/vulnerabilityScanner.js.map +0 -1
- package/dist/shell/capturePastePatch.d.ts +0 -9
- package/dist/shell/capturePastePatch.d.ts.map +0 -1
- package/dist/shell/capturePastePatch.js +0 -98
- package/dist/shell/capturePastePatch.js.map +0 -1
- package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
- package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
- package/dist/shell/enhancedInteractiveShell.js +0 -248
- package/dist/shell/enhancedInteractiveShell.js.map +0 -1
- package/dist/shell/inputProcessor.d.ts +0 -56
- package/dist/shell/inputProcessor.d.ts.map +0 -1
- package/dist/shell/inputProcessor.js +0 -172
- package/dist/shell/inputProcessor.js.map +0 -1
- package/dist/shell/interactiveShell-patch.d.ts +0 -27
- package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
- package/dist/shell/interactiveShell-patch.js +0 -38
- package/dist/shell/interactiveShell-patch.js.map +0 -1
- package/dist/shell/interactiveShell-robust.d.ts +0 -26
- package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
- package/dist/shell/interactiveShell-robust.js +0 -34
- package/dist/shell/interactiveShell-robust.js.map +0 -1
- package/dist/shell/multiLinePasteManager.d.ts +0 -106
- package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
- package/dist/shell/multiLinePasteManager.js +0 -308
- package/dist/shell/multiLinePasteManager.js.map +0 -1
- package/dist/shell/processInputBlockPatch.d.ts +0 -8
- package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
- package/dist/shell/processInputBlockPatch.js +0 -133
- package/dist/shell/processInputBlockPatch.js.map +0 -1
- package/dist/shell/unifiedInputProcessor.d.ts +0 -23
- package/dist/shell/unifiedInputProcessor.d.ts.map +0 -1
- package/dist/shell/unifiedInputProcessor.js +0 -92
- package/dist/shell/unifiedInputProcessor.js.map +0 -1
- package/dist/tools/enhancedSecurityTools.d.ts +0 -19
- package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
- package/dist/tools/enhancedSecurityTools.js +0 -215
- package/dist/tools/enhancedSecurityTools.js.map +0 -1
- package/dist/tools/offensiveSecurityTools.d.ts +0 -16
- package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
- package/dist/tools/offensiveSecurityTools.js +0 -285
- package/dist/tools/offensiveSecurityTools.js.map +0 -1
- package/dist/tools/realSecurityTools.d.ts +0 -18
- package/dist/tools/realSecurityTools.d.ts.map +0 -1
- package/dist/tools/realSecurityTools.js +0 -468
- package/dist/tools/realSecurityTools.js.map +0 -1
- package/dist/tools/securityTools.d.ts +0 -20
- package/dist/tools/securityTools.d.ts.map +0 -1
- package/dist/tools/securityTools.js +0 -449
- package/dist/tools/securityTools.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "erosolar-cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.56",
|
|
4
4
|
"description": "Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning",
|
|
5
5
|
"main": "dist/bin/erosolar-optimized.js",
|
|
6
6
|
"type": "module",
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Active Stack Security Module
|
|
3
|
-
*
|
|
4
|
-
* Ensures Erosolar CLI only operates on the active stack and nothing else.
|
|
5
|
-
* Implements strict security rules to prevent vulnerabilities and unauthorized operations.
|
|
6
|
-
*
|
|
7
|
-
* @license MIT
|
|
8
|
-
* @author Bo Shang
|
|
9
|
-
*
|
|
10
|
-
* DISCLAIMER: This software is provided for security testing and defensive purposes only.
|
|
11
|
-
* Users are solely responsible for ensuring their use complies with applicable laws.
|
|
12
|
-
*/
|
|
13
|
-
export interface ActiveStackSecurityConfig {
|
|
14
|
-
/**
|
|
15
|
-
* Whether to enable strict active stack validation
|
|
16
|
-
*/
|
|
17
|
-
enabled: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Allowed target scopes for operations
|
|
20
|
-
*/
|
|
21
|
-
allowedScopes: {
|
|
22
|
-
/** Current working directory */
|
|
23
|
-
cwd: boolean;
|
|
24
|
-
/** Node.js project directories */
|
|
25
|
-
nodeProjects: boolean;
|
|
26
|
-
/** Git repositories */
|
|
27
|
-
gitRepos: boolean;
|
|
28
|
-
/** Temporary directories */
|
|
29
|
-
tempDirs: boolean;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Blocked operations
|
|
33
|
-
*/
|
|
34
|
-
blockedOperations: {
|
|
35
|
-
/** System file operations */
|
|
36
|
-
systemFiles: boolean;
|
|
37
|
-
/** Network operations to unauthorized targets */
|
|
38
|
-
unauthorizedNetworking: boolean;
|
|
39
|
-
/** File operations outside allowed scopes */
|
|
40
|
-
outOfScopeFiles: boolean;
|
|
41
|
-
/** Privileged operations */
|
|
42
|
-
privilegedOps: boolean;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Security validation rules
|
|
46
|
-
*/
|
|
47
|
-
validation: {
|
|
48
|
-
/** Require workspace context validation */
|
|
49
|
-
workspaceContext: boolean;
|
|
50
|
-
/** Validate file paths before operations */
|
|
51
|
-
pathValidation: boolean;
|
|
52
|
-
/** Check for suspicious patterns */
|
|
53
|
-
patternDetection: boolean;
|
|
54
|
-
/** Log security events */
|
|
55
|
-
securityLogging: boolean;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export interface SecurityValidationResult {
|
|
59
|
-
allowed: boolean;
|
|
60
|
-
reason?: string;
|
|
61
|
-
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
62
|
-
details?: Record<string, unknown>;
|
|
63
|
-
}
|
|
64
|
-
export declare class ActiveStackSecurity {
|
|
65
|
-
private config;
|
|
66
|
-
private securityLog;
|
|
67
|
-
constructor(config?: Partial<ActiveStackSecurityConfig>);
|
|
68
|
-
/**
|
|
69
|
-
* Validate a file operation
|
|
70
|
-
*/
|
|
71
|
-
validateFileOperation(filePath: string, operation: 'read' | 'write' | 'delete'): SecurityValidationResult;
|
|
72
|
-
/**
|
|
73
|
-
* Validate a network operation
|
|
74
|
-
*/
|
|
75
|
-
validateNetworkOperation(target: string, operation: 'fetch' | 'search' | 'extract'): SecurityValidationResult;
|
|
76
|
-
/**
|
|
77
|
-
* Validate a command execution
|
|
78
|
-
*/
|
|
79
|
-
validateCommandExecution(command: string): SecurityValidationResult;
|
|
80
|
-
/**
|
|
81
|
-
* Get security log
|
|
82
|
-
*/
|
|
83
|
-
getSecurityLog(): SecurityEvent[];
|
|
84
|
-
/**
|
|
85
|
-
* Clear security log
|
|
86
|
-
*/
|
|
87
|
-
clearSecurityLog(): void;
|
|
88
|
-
private validatePathScope;
|
|
89
|
-
private detectSuspiciousPatterns;
|
|
90
|
-
private validateSystemFileProtection;
|
|
91
|
-
private isLocalhost;
|
|
92
|
-
private validateDomain;
|
|
93
|
-
private validateCommandSafety;
|
|
94
|
-
private logSecurityEvent;
|
|
95
|
-
}
|
|
96
|
-
export interface SecurityEvent {
|
|
97
|
-
type: string;
|
|
98
|
-
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
99
|
-
operation: string;
|
|
100
|
-
timestamp: Date;
|
|
101
|
-
reason: string;
|
|
102
|
-
filePath?: string;
|
|
103
|
-
target?: string;
|
|
104
|
-
command?: string;
|
|
105
|
-
details?: Record<string, unknown>;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Global active stack security instance
|
|
109
|
-
*/
|
|
110
|
-
export declare const activeStackSecurity: ActiveStackSecurity;
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Active Stack Security Module
|
|
4
|
-
*
|
|
5
|
-
* Ensures Erosolar CLI only operates on the active stack and nothing else.
|
|
6
|
-
* Implements strict security rules to prevent vulnerabilities and unauthorized operations.
|
|
7
|
-
*
|
|
8
|
-
* @license MIT
|
|
9
|
-
* @author Bo Shang
|
|
10
|
-
*
|
|
11
|
-
* DISCLAIMER: This software is provided for security testing and defensive purposes only.
|
|
12
|
-
* Users are solely responsible for ensuring their use complies with applicable laws.
|
|
13
|
-
*/
|
|
14
|
-
var __assign = (this && this.__assign) || function () {
|
|
15
|
-
__assign = Object.assign || function(t) {
|
|
16
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
-
s = arguments[i];
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
return __assign.apply(this, arguments);
|
|
24
|
-
};
|
|
25
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
26
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
-
if (ar || !(i in from)) {
|
|
28
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
-
ar[i] = from[i];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.activeStackSecurity = exports.ActiveStackSecurity = void 0;
|
|
36
|
-
var node_path_1 = require("node:path");
|
|
37
|
-
var ActiveStackSecurity = /** @class */ (function () {
|
|
38
|
-
function ActiveStackSecurity(config) {
|
|
39
|
-
this.securityLog = [];
|
|
40
|
-
this.config = __assign({ enabled: true, allowedScopes: {
|
|
41
|
-
cwd: true,
|
|
42
|
-
nodeProjects: true,
|
|
43
|
-
gitRepos: true,
|
|
44
|
-
tempDirs: true,
|
|
45
|
-
}, blockedOperations: {
|
|
46
|
-
systemFiles: true,
|
|
47
|
-
unauthorizedNetworking: true,
|
|
48
|
-
outOfScopeFiles: true,
|
|
49
|
-
privilegedOps: true,
|
|
50
|
-
}, validation: {
|
|
51
|
-
workspaceContext: true,
|
|
52
|
-
pathValidation: true,
|
|
53
|
-
patternDetection: true,
|
|
54
|
-
securityLogging: true,
|
|
55
|
-
} }, config);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Validate a file operation
|
|
59
|
-
*/
|
|
60
|
-
ActiveStackSecurity.prototype.validateFileOperation = function (filePath, operation) {
|
|
61
|
-
if (!this.config.enabled) {
|
|
62
|
-
return { allowed: true, severity: 'low' };
|
|
63
|
-
}
|
|
64
|
-
var normalizedPath = (0, node_path_1.resolve)(filePath);
|
|
65
|
-
var cwd = process.cwd();
|
|
66
|
-
// Check if path is within allowed scopes
|
|
67
|
-
var scopeCheck = this.validatePathScope(normalizedPath, cwd);
|
|
68
|
-
if (!scopeCheck.allowed) {
|
|
69
|
-
this.logSecurityEvent({
|
|
70
|
-
type: 'file_operation_blocked',
|
|
71
|
-
severity: 'high',
|
|
72
|
-
operation: operation,
|
|
73
|
-
filePath: normalizedPath,
|
|
74
|
-
reason: scopeCheck.reason,
|
|
75
|
-
timestamp: new Date(),
|
|
76
|
-
});
|
|
77
|
-
return scopeCheck;
|
|
78
|
-
}
|
|
79
|
-
// Check for suspicious patterns
|
|
80
|
-
var patternCheck = this.detectSuspiciousPatterns(normalizedPath, operation);
|
|
81
|
-
if (!patternCheck.allowed) {
|
|
82
|
-
this.logSecurityEvent({
|
|
83
|
-
type: 'suspicious_pattern_detected',
|
|
84
|
-
severity: patternCheck.severity,
|
|
85
|
-
operation: operation,
|
|
86
|
-
filePath: normalizedPath,
|
|
87
|
-
reason: patternCheck.reason,
|
|
88
|
-
timestamp: new Date(),
|
|
89
|
-
});
|
|
90
|
-
return patternCheck;
|
|
91
|
-
}
|
|
92
|
-
// Check for system file protection
|
|
93
|
-
var systemCheck = this.validateSystemFileProtection(normalizedPath, operation);
|
|
94
|
-
if (!systemCheck.allowed) {
|
|
95
|
-
this.logSecurityEvent({
|
|
96
|
-
type: 'system_file_protection',
|
|
97
|
-
severity: systemCheck.severity,
|
|
98
|
-
operation: operation,
|
|
99
|
-
filePath: normalizedPath,
|
|
100
|
-
reason: systemCheck.reason,
|
|
101
|
-
timestamp: new Date(),
|
|
102
|
-
});
|
|
103
|
-
return systemCheck;
|
|
104
|
-
}
|
|
105
|
-
return { allowed: true, severity: 'low' };
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* Validate a network operation
|
|
109
|
-
*/
|
|
110
|
-
ActiveStackSecurity.prototype.validateNetworkOperation = function (target, operation) {
|
|
111
|
-
if (!this.config.enabled) {
|
|
112
|
-
return { allowed: true, severity: 'low' };
|
|
113
|
-
}
|
|
114
|
-
// Check for localhost/127.0.0.1 operations (allowed for development)
|
|
115
|
-
if (this.isLocalhost(target)) {
|
|
116
|
-
return { allowed: true, severity: 'low' };
|
|
117
|
-
}
|
|
118
|
-
// Check for suspicious domains
|
|
119
|
-
var domainCheck = this.validateDomain(target);
|
|
120
|
-
if (!domainCheck.allowed) {
|
|
121
|
-
this.logSecurityEvent({
|
|
122
|
-
type: 'network_operation_blocked',
|
|
123
|
-
severity: domainCheck.severity,
|
|
124
|
-
operation: operation,
|
|
125
|
-
target: target,
|
|
126
|
-
reason: domainCheck.reason,
|
|
127
|
-
timestamp: new Date(),
|
|
128
|
-
});
|
|
129
|
-
return domainCheck;
|
|
130
|
-
}
|
|
131
|
-
return { allowed: true, severity: 'low' };
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Validate a command execution
|
|
135
|
-
*/
|
|
136
|
-
ActiveStackSecurity.prototype.validateCommandExecution = function (command) {
|
|
137
|
-
if (!this.config.enabled) {
|
|
138
|
-
return { allowed: true, severity: 'low' };
|
|
139
|
-
}
|
|
140
|
-
// Check for dangerous commands
|
|
141
|
-
var commandCheck = this.validateCommandSafety(command);
|
|
142
|
-
if (!commandCheck.allowed) {
|
|
143
|
-
this.logSecurityEvent({
|
|
144
|
-
type: 'dangerous_command_blocked',
|
|
145
|
-
severity: commandCheck.severity,
|
|
146
|
-
operation: 'execute',
|
|
147
|
-
command: command,
|
|
148
|
-
reason: commandCheck.reason,
|
|
149
|
-
timestamp: new Date(),
|
|
150
|
-
});
|
|
151
|
-
return commandCheck;
|
|
152
|
-
}
|
|
153
|
-
return { allowed: true, severity: 'low' };
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Get security log
|
|
157
|
-
*/
|
|
158
|
-
ActiveStackSecurity.prototype.getSecurityLog = function () {
|
|
159
|
-
return __spreadArray([], this.securityLog, true);
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Clear security log
|
|
163
|
-
*/
|
|
164
|
-
ActiveStackSecurity.prototype.clearSecurityLog = function () {
|
|
165
|
-
this.securityLog = [];
|
|
166
|
-
};
|
|
167
|
-
ActiveStackSecurity.prototype.validatePathScope = function (filePath, cwd) {
|
|
168
|
-
// Check if path is within current working directory
|
|
169
|
-
if (!filePath.startsWith(cwd)) {
|
|
170
|
-
return {
|
|
171
|
-
allowed: false,
|
|
172
|
-
reason: 'File operation outside current working directory',
|
|
173
|
-
severity: 'high',
|
|
174
|
-
details: { filePath: filePath, cwd: cwd },
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
// Check for node_modules protection
|
|
178
|
-
if (filePath.includes('node_modules') && !filePath.includes(cwd + '/node_modules')) {
|
|
179
|
-
return {
|
|
180
|
-
allowed: false,
|
|
181
|
-
reason: 'Access to external node_modules directory',
|
|
182
|
-
severity: 'high',
|
|
183
|
-
details: { filePath: filePath, cwd: cwd },
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
// Check for system directory protection
|
|
187
|
-
var systemDirs = ['/etc', '/var', '/usr', '/bin', '/sbin', '/lib', '/sys', '/proc'];
|
|
188
|
-
for (var _i = 0, systemDirs_1 = systemDirs; _i < systemDirs_1.length; _i++) {
|
|
189
|
-
var dir = systemDirs_1[_i];
|
|
190
|
-
if (filePath.startsWith(dir)) {
|
|
191
|
-
return {
|
|
192
|
-
allowed: false,
|
|
193
|
-
reason: 'Access to system directory',
|
|
194
|
-
severity: 'critical',
|
|
195
|
-
details: { filePath: filePath, systemDir: dir },
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return { allowed: true, severity: 'low' };
|
|
200
|
-
};
|
|
201
|
-
ActiveStackSecurity.prototype.detectSuspiciousPatterns = function (filePath, operation) {
|
|
202
|
-
var suspiciousPatterns = [
|
|
203
|
-
{ pattern: /\.(pem|key|env|secret|config)$/i, severity: 'high', reason: 'Sensitive file extension' },
|
|
204
|
-
{ pattern: /(password|secret|token|api[_-]?key)/i, severity: 'medium', reason: 'Potential credential file' },
|
|
205
|
-
{ pattern: /\.(bashrc|bash_profile|zshrc|profile)$/, severity: 'medium', reason: 'Shell configuration file' },
|
|
206
|
-
{ pattern: /\.(git|ssh)\/config$/, severity: 'medium', reason: 'Git/SSH configuration' },
|
|
207
|
-
];
|
|
208
|
-
for (var _i = 0, suspiciousPatterns_1 = suspiciousPatterns; _i < suspiciousPatterns_1.length; _i++) {
|
|
209
|
-
var _a = suspiciousPatterns_1[_i], pattern = _a.pattern, severity = _a.severity, reason = _a.reason;
|
|
210
|
-
if (pattern.test(filePath)) {
|
|
211
|
-
return {
|
|
212
|
-
allowed: false,
|
|
213
|
-
reason: "".concat(reason, " detected"),
|
|
214
|
-
severity: severity,
|
|
215
|
-
details: { filePath: filePath, pattern: pattern.source },
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return { allowed: true, severity: 'low' };
|
|
220
|
-
};
|
|
221
|
-
ActiveStackSecurity.prototype.validateSystemFileProtection = function (filePath, operation) {
|
|
222
|
-
var systemFiles = [
|
|
223
|
-
'/etc/passwd', '/etc/shadow', '/etc/hosts', '/etc/resolv.conf',
|
|
224
|
-
'/etc/ssh/ssh_config', '/etc/ssh/sshd_config',
|
|
225
|
-
'/var/log/', '/var/spool/', '/var/mail/',
|
|
226
|
-
'/usr/bin/', '/usr/sbin/', '/usr/lib/',
|
|
227
|
-
];
|
|
228
|
-
for (var _i = 0, systemFiles_1 = systemFiles; _i < systemFiles_1.length; _i++) {
|
|
229
|
-
var sysFile = systemFiles_1[_i];
|
|
230
|
-
if (filePath.startsWith(sysFile)) {
|
|
231
|
-
return {
|
|
232
|
-
allowed: false,
|
|
233
|
-
reason: 'Access to system file',
|
|
234
|
-
severity: 'critical',
|
|
235
|
-
details: { filePath: filePath, systemFile: sysFile },
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return { allowed: true, severity: 'low' };
|
|
240
|
-
};
|
|
241
|
-
ActiveStackSecurity.prototype.isLocalhost = function (target) {
|
|
242
|
-
var localhostPatterns = [
|
|
243
|
-
'localhost',
|
|
244
|
-
'127.0.0.1',
|
|
245
|
-
'::1',
|
|
246
|
-
'0.0.0.0',
|
|
247
|
-
];
|
|
248
|
-
return localhostPatterns.some(function (pattern) { return target.includes(pattern); });
|
|
249
|
-
};
|
|
250
|
-
ActiveStackSecurity.prototype.validateDomain = function (target) {
|
|
251
|
-
var suspiciousDomains = [
|
|
252
|
-
'malicious.com',
|
|
253
|
-
'evil.org',
|
|
254
|
-
'hacker.net',
|
|
255
|
-
// Add more suspicious domains as needed
|
|
256
|
-
];
|
|
257
|
-
for (var _i = 0, suspiciousDomains_1 = suspiciousDomains; _i < suspiciousDomains_1.length; _i++) {
|
|
258
|
-
var domain = suspiciousDomains_1[_i];
|
|
259
|
-
if (target.includes(domain)) {
|
|
260
|
-
return {
|
|
261
|
-
allowed: false,
|
|
262
|
-
reason: 'Suspicious domain detected',
|
|
263
|
-
severity: 'high',
|
|
264
|
-
details: { target: target, domain: domain },
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
return { allowed: true, severity: 'low' };
|
|
269
|
-
};
|
|
270
|
-
ActiveStackSecurity.prototype.validateCommandSafety = function (command) {
|
|
271
|
-
var dangerousCommands = [
|
|
272
|
-
{ pattern: /rm\s+-rf/, severity: 'critical', reason: 'Recursive force delete' },
|
|
273
|
-
{ pattern: /chmod\s+[0-7]{3,4}\s+/, severity: 'high', reason: 'File permission modification' },
|
|
274
|
-
{ pattern: /chown\s+[^\s]+\s+/, severity: 'high', reason: 'File ownership change' },
|
|
275
|
-
{ pattern: /dd\s+if=.*of=/, severity: 'critical', reason: 'Disk cloning/destruction' },
|
|
276
|
-
{ pattern: /mkfs\./, severity: 'critical', reason: 'Filesystem creation' },
|
|
277
|
-
{ pattern: /fdisk\s+/, severity: 'critical', reason: 'Partition manipulation' },
|
|
278
|
-
{ pattern: /mount\s+/, severity: 'high', reason: 'Filesystem mounting' },
|
|
279
|
-
{ pattern: /umount\s+/, severity: 'high', reason: 'Filesystem unmounting' },
|
|
280
|
-
{ pattern: /passwd\s+/, severity: 'high', reason: 'Password change' },
|
|
281
|
-
{ pattern: /useradd\s+/, severity: 'high', reason: 'User creation' },
|
|
282
|
-
{ pattern: /userdel\s+/, severity: 'high', reason: 'User deletion' },
|
|
283
|
-
];
|
|
284
|
-
for (var _i = 0, dangerousCommands_1 = dangerousCommands; _i < dangerousCommands_1.length; _i++) {
|
|
285
|
-
var _a = dangerousCommands_1[_i], pattern = _a.pattern, severity = _a.severity, reason = _a.reason;
|
|
286
|
-
if (pattern.test(command)) {
|
|
287
|
-
return {
|
|
288
|
-
allowed: false,
|
|
289
|
-
reason: "".concat(reason, " command detected"),
|
|
290
|
-
severity: severity,
|
|
291
|
-
details: { command: command, pattern: pattern.source },
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return { allowed: true, severity: 'low' };
|
|
296
|
-
};
|
|
297
|
-
ActiveStackSecurity.prototype.logSecurityEvent = function (event) {
|
|
298
|
-
if (this.config.validation.securityLogging) {
|
|
299
|
-
this.securityLog.push(event);
|
|
300
|
-
// Keep log size manageable
|
|
301
|
-
if (this.securityLog.length > 1000) {
|
|
302
|
-
this.securityLog = this.securityLog.slice(-500);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
|
-
return ActiveStackSecurity;
|
|
307
|
-
}());
|
|
308
|
-
exports.ActiveStackSecurity = ActiveStackSecurity;
|
|
309
|
-
/**
|
|
310
|
-
* Global active stack security instance
|
|
311
|
-
*/
|
|
312
|
-
exports.activeStackSecurity = new ActiveStackSecurity();
|
|
313
|
-
//# sourceMappingURL=active-stack-security.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"active-stack-security.js","sourceRoot":"","sources":["../src/security/active-stack-security.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;;;;;;;;;;;AAGH,uCAAmD;AA2DnD;IAIE,6BAAY,MAA2C;QAF/C,gBAAW,GAAoB,EAAE,CAAC;QAGxC,IAAI,CAAC,MAAM,cACT,OAAO,EAAE,IAAI,EACb,aAAa,EAAE;gBACb,GAAG,EAAE,IAAI;gBACT,YAAY,EAAE,IAAI;gBAClB,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,IAAI;aACf,EACD,iBAAiB,EAAE;gBACjB,WAAW,EAAE,IAAI;gBACjB,sBAAsB,EAAE,IAAI;gBAC5B,eAAe,EAAE,IAAI;gBACrB,aAAa,EAAE,IAAI;aACpB,EACD,UAAU,EAAE;gBACV,gBAAgB,EAAE,IAAI;gBACtB,cAAc,EAAE,IAAI;gBACpB,gBAAgB,EAAE,IAAI;gBACtB,eAAe,EAAE,IAAI;aACtB,IACE,MAAM,CACV,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,mDAAqB,GAArB,UAAsB,QAAgB,EAAE,SAAsC;QAC5E,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO,EAAE,OAAO,E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AA2B;YAC3B,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;gBACnC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YAClD,CAAC;QACH,CAAC;IACH,CAAC;IACH,0BAAC;AAAD,CAAC,AAnTD,IAmTC;AAnTY,kDAAmB;AAiUhC;;GAEG;AACU,QAAA,mBAAmB,GAAG,IAAI,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Advanced Targeting Security Module
|
|
3
|
-
*
|
|
4
|
-
* Enables Erosolar CLI to analyze and operate on external active stacks
|
|
5
|
-
* and critical infrastructure while maintaining security controls.
|
|
6
|
-
*
|
|
7
|
-
* @license MIT
|
|
8
|
-
* @author Bo Shang
|
|
9
|
-
*
|
|
10
|
-
* DISCLAIMER: This software is provided for authorized security testing,
|
|
11
|
-
* research, and defensive purposes only. Users must ensure compliance
|
|
12
|
-
* with all applicable laws and regulations in their jurisdiction.
|
|
13
|
-
*/
|
|
14
|
-
import { type SecurityValidationResult } from './active-stack-security.js';
|
|
15
|
-
export interface TargetAuthorization {
|
|
16
|
-
/** Target identifier (domain, IP range, organization) */
|
|
17
|
-
target: string;
|
|
18
|
-
/** Authorization level */
|
|
19
|
-
level: 'research' | 'analysis' | 'testing' | 'operations';
|
|
20
|
-
/** Scope of authorized operations */
|
|
21
|
-
scope: string[];
|
|
22
|
-
/** Authorization source */
|
|
23
|
-
authorizedBy: string;
|
|
24
|
-
/** Expiration timestamp */
|
|
25
|
-
expiresAt?: Date;
|
|
26
|
-
/** Legal/compliance requirements */
|
|
27
|
-
compliance: {
|
|
28
|
-
jurisdiction: string;
|
|
29
|
-
legalFramework: string;
|
|
30
|
-
reportingRequirements: string[];
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export interface CriticalInfrastructureTarget {
|
|
34
|
-
/** Infrastructure category */
|
|
35
|
-
category: 'energy' | 'finance' | 'telecom' | 'government' | 'military' | 'healthcare' | 'transportation';
|
|
36
|
-
/** Target identifier */
|
|
37
|
-
identifier: string;
|
|
38
|
-
/** Country/region */
|
|
39
|
-
jurisdiction: string;
|
|
40
|
-
/** Sensitivity level */
|
|
41
|
-
sensitivity: 'low' | 'medium' | 'high' | 'critical';
|
|
42
|
-
/** Authorized operations */
|
|
43
|
-
authorizedOperations: string[];
|
|
44
|
-
/** Legal restrictions */
|
|
45
|
-
legalRestrictions: string[];
|
|
46
|
-
}
|
|
47
|
-
export interface OperationAuthorization {
|
|
48
|
-
/** Operation type */
|
|
49
|
-
type: 'scanning' | 'analysis' | 'vulnerability_assessment' | 'penetration_testing' | 'research';
|
|
50
|
-
/** Target information */
|
|
51
|
-
target: CriticalInfrastructureTarget | string;
|
|
52
|
-
/** Authorization level required */
|
|
53
|
-
requiredLevel: string;
|
|
54
|
-
/** Legal compliance requirements */
|
|
55
|
-
compliance: {
|
|
56
|
-
jurisdiction: string;
|
|
57
|
-
legalFramework: string;
|
|
58
|
-
reportingRequired: boolean;
|
|
59
|
-
evidenceCollection: boolean;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export declare class AdvancedTargetingSecurity {
|
|
63
|
-
private authorizedTargets;
|
|
64
|
-
private criticalInfrastructure;
|
|
65
|
-
private operationLog;
|
|
66
|
-
constructor();
|
|
67
|
-
/**
|
|
68
|
-
* Authorize a target for operations
|
|
69
|
-
*/
|
|
70
|
-
authorizeTarget(authorization: TargetAuthorization): void;
|
|
71
|
-
/**
|
|
72
|
-
* Validate operation on external target
|
|
73
|
-
*/
|
|
74
|
-
validateExternalOperation(operation: string, target: string, parameters: Record<string, unknown>): SecurityValidationResult;
|
|
75
|
-
/**
|
|
76
|
-
* Register critical infrastructure target
|
|
77
|
-
*/
|
|
78
|
-
registerCriticalInfrastructure(target: CriticalInfrastructureTarget): void;
|
|
79
|
-
/**
|
|
80
|
-
* Get authorized targets
|
|
81
|
-
*/
|
|
82
|
-
getAuthorizedTargets(): TargetAuthorization[];
|
|
83
|
-
/**
|
|
84
|
-
* Get critical infrastructure targets
|
|
85
|
-
*/
|
|
86
|
-
getCriticalInfrastructure(): CriticalInfrastructureTarget[];
|
|
87
|
-
/**
|
|
88
|
-
* Get operation log
|
|
89
|
-
*/
|
|
90
|
-
getOperationLog(): AdvancedOperationEvent[];
|
|
91
|
-
/**
|
|
92
|
-
* Generate targeting report
|
|
93
|
-
*/
|
|
94
|
-
generateTargetingReport(): string;
|
|
95
|
-
private initializeDefaultTargets;
|
|
96
|
-
private isOperationAuthorized;
|
|
97
|
-
private validateCriticalInfrastructureOperation;
|
|
98
|
-
private logAdvancedOperation;
|
|
99
|
-
}
|
|
100
|
-
export interface AdvancedOperationEvent {
|
|
101
|
-
type: string;
|
|
102
|
-
severity: 'low' | 'medium' | 'high' | 'critical';
|
|
103
|
-
operation: string;
|
|
104
|
-
target: string;
|
|
105
|
-
timestamp: Date;
|
|
106
|
-
authorizationLevel?: string;
|
|
107
|
-
authorizedBy?: string;
|
|
108
|
-
details?: Record<string, unknown>;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Global advanced targeting security instance
|
|
112
|
-
*/
|
|
113
|
-
export declare const advancedTargetingSecurity: AdvancedTargetingSecurity;
|