0xray 4.0.33 → 4.0.35
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/.grok-plugin/plugin.json +1 -1
- package/.xray/codex.json +12 -4
- package/.xray/features.json +1 -1
- package/AGENTS-consumer.md +6 -6
- package/AGENTS.md +5 -5
- package/README.md +2 -2
- package/dist/AGENTS.md +5 -5
- package/dist/CHANGELOG.md +25 -0
- package/dist/README.md +2 -2
- package/dist/cli/index.js +2 -5
- package/dist/governance/governance-service.js +1 -1
- package/dist/integrations/base/README.md +1 -9
- package/dist/integrations/base/index.d.ts +0 -1
- package/dist/integrations/base/index.js +0 -2
- package/dist/integrations/governance/index.js +31 -8
- package/dist/integrations/grok/hooks/grok-hook-utils.js +1 -1
- package/dist/integrations/grok/hooks/session-start.js +12 -0
- package/dist/integrations/hooks/goggles-pipeline.mjs +108 -22
- package/dist/integrations/hooks/goggles-planes.json +23 -0
- package/dist/integrations/hooks/host-truth.mjs +74 -0
- package/dist/integrations/hooks/station-hook-runtime.cjs +3 -0
- package/dist/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/dist/mcps/knowledge-skills/storyteller.server.js +0 -1
- package/dist/nucleus/delegation-gate.d.ts +2 -2
- package/dist/nucleus/delegation-gate.js +13 -2
- package/dist/nucleus/work-freshness.mjs +189 -0
- package/dist/processors/implementations/agents-md-validation-processor.js +1 -1
- package/docs-site/docs/plates/boot.md +17 -2
- package/docs-site/docs/plates/governance.md +3 -2
- package/docs-site/docs/plates/index.md +3 -1
- package/docs-site/docs/plates/memory-recall.md +26 -35
- package/docs-site/docs/plates/orchestration.md +39 -35
- package/docs-site/docs/plates/processor.md +34 -36
- package/docs-site/docs/plates/reporting.md +3 -8
- package/docs-site/docs/plates/routing.md +22 -11
- package/package.json +2 -2
- package/scripts/foundry/release.mjs +48 -5
- package/scripts/mjs/test-consumer-readiness.mjs +1 -0
- package/scripts/mjs/test-mcp-functionality.mjs +14 -9
- package/scripts/node/basic-security-audit.cjs +0 -1
- package/scripts/node/bridge-mcp-wiring.cjs +66 -3
- package/scripts/node/postinstall.cjs +1 -1
- package/scripts/node/prepare-consumer.cjs +11 -7
- package/scripts/node/setup-dev.cjs +18 -26
- package/scripts/node/validate-mcp-connectivity.js +2 -1
- package/src/integrations/openclaw/plugin/xray-pre-tool/package.json +1 -1
- package/src/mcps/knowledge-skills/storyteller.server.ts +0 -1
- package/xray/agents_template.md +5 -5
- package/xray/codex.json +12 -4
- package/xray/features.json +1 -1
- package/dist/agents/known-names.d.ts +0 -26
- package/dist/agents/known-names.js +0 -72
- package/dist/analytics/consent-manager.d.ts +0 -92
- package/dist/analytics/consent-manager.js +0 -257
- package/dist/benchmark/performance-benchmark.d.ts +0 -103
- package/dist/benchmark/performance-benchmark.js +0 -373
- package/dist/cli/commands/analytics-disable.d.ts +0 -9
- package/dist/cli/commands/analytics-disable.js +0 -72
- package/dist/cli/commands/analytics-enable-action.d.ts +0 -8
- package/dist/cli/commands/analytics-enable-action.js +0 -82
- package/dist/cli/commands/analytics-preview.d.ts +0 -9
- package/dist/cli/commands/analytics-preview.js +0 -106
- package/dist/cli/commands/analytics-status.d.ts +0 -9
- package/dist/cli/commands/analytics-status.js +0 -68
- package/dist/cli/commands/enforce.d.ts +0 -12
- package/dist/cli/commands/enforce.js +0 -78
- package/dist/cli/commands/govern.d.ts +0 -29
- package/dist/cli/commands/govern.js +0 -149
- package/dist/cli/commands/security-audit.d.ts +0 -23
- package/dist/cli/commands/security-audit.js +0 -219
- package/dist/cli/server.d.ts +0 -1
- package/dist/cli/server.js +0 -147
- package/dist/config/routing-mappings.d.ts +0 -26
- package/dist/config/routing-mappings.js +0 -151
- package/dist/core/bridge.mjs +0 -922
- package/dist/core/trace-context.d.ts +0 -12
- package/dist/core/trace-context.js +0 -33
- package/dist/enforcement/index.d.ts +0 -22
- package/dist/enforcement/index.js +0 -40
- package/dist/enforcement/loaders/index.d.ts +0 -36
- package/dist/enforcement/loaders/index.js +0 -39
- package/dist/enforcement/test-auto-healing.d.ts +0 -83
- package/dist/enforcement/test-auto-healing.js +0 -325
- package/dist/inference/index.d.ts +0 -10
- package/dist/inference/index.js +0 -5
- package/dist/infrastructure/iac-validator.d.ts +0 -150
- package/dist/infrastructure/iac-validator.js +0 -465
- package/dist/infrastructure/schemas/cloud-schemas.d.ts +0 -482
- package/dist/infrastructure/schemas/cloud-schemas.js +0 -488
- package/dist/integrations/base/ExampleIntegration.d.ts +0 -46
- package/dist/integrations/base/ExampleIntegration.js +0 -180
- package/dist/integrations/enforcement-gate.d.ts +0 -44
- package/dist/integrations/enforcement-gate.js +0 -348
- package/dist/mcps/connection/connection-manager.d.ts +0 -39
- package/dist/mcps/connection/connection-manager.js +0 -79
- package/dist/mcps/index.d.ts +0 -17
- package/dist/mcps/index.js +0 -65
- package/dist/mcps/orchestrator/index.d.ts +0 -6
- package/dist/mcps/orchestrator/index.js +0 -5
- package/dist/metrics/index.d.ts +0 -6
- package/dist/metrics/index.js +0 -6
- package/dist/orchestrator/self-direction-activation.d.ts +0 -108
- package/dist/orchestrator/self-direction-activation.js +0 -244
- package/dist/orchestrator/universal-registry-bridge.d.ts +0 -84
- package/dist/orchestrator/universal-registry-bridge.js +0 -246
- package/dist/performance/performance-budget-enforcer.d.ts +0 -157
- package/dist/performance/performance-budget-enforcer.js +0 -433
- package/dist/performance/performance-regression-tester.d.ts +0 -107
- package/dist/performance/performance-regression-tester.js +0 -341
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.d.ts +0 -11
- package/dist/postprocessor/analysis/CodeChangeAnalyzer.js +0 -50
- package/dist/postprocessor/config/ProcessorConfigLoader.d.ts +0 -44
- package/dist/postprocessor/config/ProcessorConfigLoader.js +0 -16
- package/dist/postprocessor/integration.d.ts +0 -156
- package/dist/postprocessor/integration.js +0 -194
- package/dist/postprocessor/metamorphosis/index.d.ts +0 -2
- package/dist/postprocessor/metamorphosis/index.js +0 -1
- package/dist/postprocessor/redeploy/RetryHandler.d.ts +0 -49
- package/dist/postprocessor/redeploy/RetryHandler.js +0 -118
- package/dist/processors/implementations/session-capture-processor.d.ts +0 -14
- package/dist/processors/implementations/session-capture-processor.js +0 -37
- package/dist/public/XrayService.d.ts +0 -17
- package/dist/public/XrayService.js +0 -40
- package/dist/public/index.d.ts +0 -4
- package/dist/public/index.js +0 -2
- package/dist/security/comprehensive-security-audit.d.ts +0 -157
- package/dist/security/comprehensive-security-audit.js +0 -1004
- package/dist/security/index.d.ts +0 -13
- package/dist/security/index.js +0 -13
- package/dist/security/security-agent-coordinator.d.ts +0 -71
- package/dist/security/security-agent-coordinator.js +0 -203
- package/dist/security/security-hardening-system.d.ts +0 -238
- package/dist/security/security-hardening-system.js +0 -726
- package/dist/security/security-orchestration-layer.d.ts +0 -118
- package/dist/security/security-orchestration-layer.js +0 -495
- package/dist/testing/memory-regression-suite.d.ts +0 -105
- package/dist/testing/memory-regression-suite.js +0 -258
- package/dist/tools/assess-complexity-tool.d.ts +0 -28
- package/dist/tools/assess-complexity-tool.js +0 -44
- package/dist/tools/query-routing-tool.d.ts +0 -17
- package/dist/tools/query-routing-tool.js +0 -59
- package/dist/utils/batch-operations.d.ts +0 -25
- package/dist/utils/batch-operations.js +0 -292
- package/dist/utils/task-graph.d.ts +0 -29
- package/dist/utils/task-graph.js +0 -106
- package/dist/utils/test-template-generator.d.ts +0 -25
- package/dist/utils/test-template-generator.js +0 -178
- package/dist/utils/token-manager.d.ts +0 -48
- package/dist/utils/token-manager.js +0 -163
- package/dist/validation/agent-config-validator.d.ts +0 -110
- package/dist/validation/agent-config-validator.js +0 -280
- package/dist/validation/orchestration-flow-validator.d.ts +0 -87
- package/dist/validation/orchestration-flow-validator.js +0 -606
- package/src/mcps/connection/connection-manager.ts +0 -91
- package/src/mcps/index.ts +0 -80
- package/src/mcps/orchestrator/index.ts +0 -29
package/dist/security/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 0xRay AI v1.22.60 - Security Module Index
|
|
3
|
-
* Unified exports for the comprehensive security system
|
|
4
|
-
*/
|
|
5
|
-
export { SecurityScanner, securityScanner } from "./security-scanner.js";
|
|
6
|
-
export { PromptSecurityValidator, promptSecurityValidator, } from "./prompt-security-validator.js";
|
|
7
|
-
export * from "./security-headers.js";
|
|
8
|
-
export * from "./security-hardening-system.js";
|
|
9
|
-
export * from "./security-hardener.js";
|
|
10
|
-
export * from "./security-auditor.js";
|
|
11
|
-
export { ComprehensiveSecurityAuditSystem, createSecurityAuditSystem, runQuickSecurityAudit, runDeepSecurityAudit, type Vulnerability, type VulnerabilityCategory, type SeverityLevel, type RemediationStep, type RemediationPlan, type SecurityAuditConfig, type SecurityAuditReport, type WeightedVote, type ArchitecturalDecision, type ComplianceResult, type ComplianceStandard, } from "./comprehensive-security-audit.js";
|
|
12
|
-
export { SecurityOrchestrationLayer, createSecurityOrchestrationLayer, runSecurityOrchestration, type SecurityAgent, type SecurityAgentType, type AgentStatus, type SecurityTask, type SecurityTaskType, type AgentVote, type SecurityDecision, type OrchestrationConfig, type SecurityOrchestrationReport, } from "./security-orchestration-layer.js";
|
|
13
|
-
export { SecurityAgentCoordinator, createSecurityAgentCoordinator, runMultiAgentSecurityScan, type SecurityAgentConfig, type SecurityAgentContext, type AgentVotingResult, type MultiAgentSecurityResult, } from "./security-agent-coordinator.js";
|
package/dist/security/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 0xRay AI v1.22.60 - Security Module Index
|
|
3
|
-
* Unified exports for the comprehensive security system
|
|
4
|
-
*/
|
|
5
|
-
export { SecurityScanner, securityScanner } from "./security-scanner.js";
|
|
6
|
-
export { PromptSecurityValidator, promptSecurityValidator, } from "./prompt-security-validator.js";
|
|
7
|
-
export * from "./security-headers.js";
|
|
8
|
-
export * from "./security-hardening-system.js";
|
|
9
|
-
export * from "./security-hardener.js";
|
|
10
|
-
export * from "./security-auditor.js";
|
|
11
|
-
export { ComprehensiveSecurityAuditSystem, createSecurityAuditSystem, runQuickSecurityAudit, runDeepSecurityAudit, } from "./comprehensive-security-audit.js";
|
|
12
|
-
export { SecurityOrchestrationLayer, createSecurityOrchestrationLayer, runSecurityOrchestration, } from "./security-orchestration-layer.js";
|
|
13
|
-
export { SecurityAgentCoordinator, createSecurityAgentCoordinator, runMultiAgentSecurityScan, } from "./security-agent-coordinator.js";
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Agent Integration
|
|
3
|
-
*
|
|
4
|
-
* Integrates the security orchestration layer with the framework's agent system.
|
|
5
|
-
* Provides coordination between security agents using weighted voting.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import { EventEmitter } from "events";
|
|
9
|
-
import { SecurityOrchestrationLayer, SecurityAgent, SecurityDecision, OrchestrationConfig } from "./security-orchestration-layer.js";
|
|
10
|
-
import { Vulnerability } from "./comprehensive-security-audit.js";
|
|
11
|
-
export interface SecurityAgentConfig {
|
|
12
|
-
agentId: string;
|
|
13
|
-
agentType: string;
|
|
14
|
-
capabilities: string[];
|
|
15
|
-
weight: number;
|
|
16
|
-
}
|
|
17
|
-
export interface SecurityAgentContext {
|
|
18
|
-
projectPath: string;
|
|
19
|
-
scanDepth: "shallow" | "medium" | "deep";
|
|
20
|
-
complianceStandards: string[];
|
|
21
|
-
enableAutoRemediation: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface AgentVotingResult {
|
|
24
|
-
agentId: string;
|
|
25
|
-
agentName: string;
|
|
26
|
-
vote: "approve" | "reject" | "abstain";
|
|
27
|
-
weight: number;
|
|
28
|
-
reasoning: string;
|
|
29
|
-
concerns: string[];
|
|
30
|
-
confidence: number;
|
|
31
|
-
}
|
|
32
|
-
export interface MultiAgentSecurityResult {
|
|
33
|
-
auditId: string;
|
|
34
|
-
timestamp: Date;
|
|
35
|
-
duration: number;
|
|
36
|
-
participatingAgents: string[];
|
|
37
|
-
vulnerabilities: Vulnerability[];
|
|
38
|
-
decisions: SecurityDecision[];
|
|
39
|
-
agentVotes: AgentVotingResult[];
|
|
40
|
-
summary: {
|
|
41
|
-
totalVulnerabilities: number;
|
|
42
|
-
critical: number;
|
|
43
|
-
high: number;
|
|
44
|
-
medium: number;
|
|
45
|
-
low: number;
|
|
46
|
-
securityScore: number;
|
|
47
|
-
complianceScore: number;
|
|
48
|
-
};
|
|
49
|
-
weightedApproval: number;
|
|
50
|
-
approved: boolean;
|
|
51
|
-
recommendations: string[];
|
|
52
|
-
}
|
|
53
|
-
export declare class SecurityAgentCoordinator extends EventEmitter {
|
|
54
|
-
private orchestration;
|
|
55
|
-
private agentRegistry;
|
|
56
|
-
private isActive;
|
|
57
|
-
constructor(config?: Partial<OrchestrationConfig>);
|
|
58
|
-
private setupEventHandlers;
|
|
59
|
-
registerAgent(config: SecurityAgentConfig): void;
|
|
60
|
-
unregisterAgent(agentId: string): boolean;
|
|
61
|
-
getRegisteredAgents(): SecurityAgentConfig[];
|
|
62
|
-
runCoordinatedSecurityScan(context: SecurityAgentContext): Promise<MultiAgentSecurityResult>;
|
|
63
|
-
private collectAgentVotes;
|
|
64
|
-
private calculateWeightedApproval;
|
|
65
|
-
getOrchestrationLayer(): SecurityOrchestrationLayer;
|
|
66
|
-
getActiveAgents(): SecurityAgent[];
|
|
67
|
-
getPendingTasks(): import("./security-orchestration-layer.js").SecurityTask[];
|
|
68
|
-
isCoordinatorActive(): boolean;
|
|
69
|
-
}
|
|
70
|
-
export declare function createSecurityAgentCoordinator(config?: Partial<OrchestrationConfig>): SecurityAgentCoordinator;
|
|
71
|
-
export declare function runMultiAgentSecurityScan(projectPath: string, context?: Partial<SecurityAgentContext>): Promise<MultiAgentSecurityResult>;
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Agent Integration
|
|
3
|
-
*
|
|
4
|
-
* Integrates the security orchestration layer with the framework's agent system.
|
|
5
|
-
* Provides coordination between security agents using weighted voting.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import { EventEmitter } from "events";
|
|
9
|
-
import { frameworkLogger } from "../core/framework-logger.js";
|
|
10
|
-
import { createSecurityOrchestrationLayer, } from "./security-orchestration-layer.js";
|
|
11
|
-
export class SecurityAgentCoordinator extends EventEmitter {
|
|
12
|
-
orchestration;
|
|
13
|
-
agentRegistry = new Map();
|
|
14
|
-
isActive = false;
|
|
15
|
-
constructor(config) {
|
|
16
|
-
super();
|
|
17
|
-
this.orchestration = createSecurityOrchestrationLayer(config);
|
|
18
|
-
this.setupEventHandlers();
|
|
19
|
-
}
|
|
20
|
-
setupEventHandlers() {
|
|
21
|
-
this.orchestration.on("orchestration:start", (data) => {
|
|
22
|
-
this.emit("coordinator:start", data);
|
|
23
|
-
frameworkLogger.log("security-agent-coordinator", "coordinator-start", "info", data);
|
|
24
|
-
});
|
|
25
|
-
this.orchestration.on("orchestration:complete", (report) => {
|
|
26
|
-
this.emit("coordinator:complete", report);
|
|
27
|
-
frameworkLogger.log("security-agent-coordinator", "coordinator-complete", "info", {
|
|
28
|
-
auditId: report.auditId,
|
|
29
|
-
duration: report.duration,
|
|
30
|
-
vulnerabilities: report.summary.totalVulnerabilities,
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
this.orchestration.on("orchestration:error", (error) => {
|
|
34
|
-
this.emit("coordinator:error", error);
|
|
35
|
-
frameworkLogger.log("security-agent-coordinator", "coordinator-error", "error", error);
|
|
36
|
-
});
|
|
37
|
-
this.orchestration.on("agent:vote", ({ agentId, vote }) => {
|
|
38
|
-
this.emit("agent:vote", { agentId, vote });
|
|
39
|
-
});
|
|
40
|
-
this.orchestration.on("agent:status-change", (agent) => {
|
|
41
|
-
this.emit("agent:status-change", agent);
|
|
42
|
-
});
|
|
43
|
-
this.orchestration.on("task:complete", (task) => {
|
|
44
|
-
this.emit("task:complete", task);
|
|
45
|
-
});
|
|
46
|
-
this.orchestration.on("task:failed", (task) => {
|
|
47
|
-
this.emit("task:failed", task);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
registerAgent(config) {
|
|
51
|
-
this.agentRegistry.set(config.agentId, config);
|
|
52
|
-
frameworkLogger.log("security-agent-coordinator", "agent-registered", "info", {
|
|
53
|
-
agentId: config.agentId,
|
|
54
|
-
agentType: config.agentType,
|
|
55
|
-
weight: config.weight,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
unregisterAgent(agentId) {
|
|
59
|
-
const removed = this.agentRegistry.delete(agentId);
|
|
60
|
-
if (removed) {
|
|
61
|
-
frameworkLogger.log("security-agent-coordinator", "agent-unregistered", "info", {
|
|
62
|
-
agentId,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return removed;
|
|
66
|
-
}
|
|
67
|
-
getRegisteredAgents() {
|
|
68
|
-
return Array.from(this.agentRegistry.values());
|
|
69
|
-
}
|
|
70
|
-
async runCoordinatedSecurityScan(context) {
|
|
71
|
-
this.isActive = true;
|
|
72
|
-
const startTime = Date.now();
|
|
73
|
-
frameworkLogger.log("security-agent-coordinator", "coordinated-scan-start", "info", {
|
|
74
|
-
projectPath: context.projectPath,
|
|
75
|
-
scanDepth: context.scanDepth,
|
|
76
|
-
registeredAgents: this.agentRegistry.size,
|
|
77
|
-
});
|
|
78
|
-
try {
|
|
79
|
-
const report = await this.orchestration.runSecurityOrchestration(context.projectPath);
|
|
80
|
-
const agentVotes = this.collectAgentVotes(report);
|
|
81
|
-
const weightedApproval = this.calculateWeightedApproval(agentVotes);
|
|
82
|
-
const result = {
|
|
83
|
-
auditId: report.auditId,
|
|
84
|
-
timestamp: report.timestamp,
|
|
85
|
-
duration: report.duration,
|
|
86
|
-
participatingAgents: report.agents.map((a) => a.name),
|
|
87
|
-
vulnerabilities: report.vulnerabilities,
|
|
88
|
-
decisions: report.decisions,
|
|
89
|
-
agentVotes,
|
|
90
|
-
summary: report.summary,
|
|
91
|
-
weightedApproval,
|
|
92
|
-
approved: weightedApproval >= 0.5,
|
|
93
|
-
recommendations: report.recommendations,
|
|
94
|
-
};
|
|
95
|
-
this.emit("coordinated-scan:complete", result);
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
catch (error) {
|
|
99
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
100
|
-
frameworkLogger.log("security-agent-coordinator", "coordinated-scan-error", "error", {
|
|
101
|
-
error: errorMessage,
|
|
102
|
-
});
|
|
103
|
-
throw error;
|
|
104
|
-
}
|
|
105
|
-
finally {
|
|
106
|
-
this.isActive = false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
collectAgentVotes(report) {
|
|
110
|
-
const vulnerabilities = report.vulnerabilities;
|
|
111
|
-
const agents = report.agents;
|
|
112
|
-
return agents.map((agent) => {
|
|
113
|
-
const agentVulns = vulnerabilities.filter((v) => v.severity === "critical" || v.severity === "high");
|
|
114
|
-
const concerns = [];
|
|
115
|
-
let vote = "approve";
|
|
116
|
-
let reasoning = `Security review by ${agent.name}. Found ${vulnerabilities.length} vulnerabilities.`;
|
|
117
|
-
const criticalCount = vulnerabilities.filter((v) => v.severity === "critical").length;
|
|
118
|
-
const highCount = vulnerabilities.filter((v) => v.severity === "high").length;
|
|
119
|
-
if (criticalCount > 0) {
|
|
120
|
-
concerns.push(`${criticalCount} critical vulnerabilities detected`);
|
|
121
|
-
}
|
|
122
|
-
if (highCount > 5) {
|
|
123
|
-
concerns.push(`${highCount} high-severity vulnerabilities`);
|
|
124
|
-
}
|
|
125
|
-
if (criticalCount > 5) {
|
|
126
|
-
vote = "reject";
|
|
127
|
-
reasoning = "Too many critical vulnerabilities. Security posture unacceptable.";
|
|
128
|
-
}
|
|
129
|
-
else if (criticalCount > 0 || highCount > 10) {
|
|
130
|
-
vote = "approve";
|
|
131
|
-
reasoning = "Acceptable with noted concerns. Priority fixes required.";
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
agentId: agent.id,
|
|
135
|
-
agentName: agent.name,
|
|
136
|
-
vote,
|
|
137
|
-
weight: agent.weight,
|
|
138
|
-
reasoning,
|
|
139
|
-
concerns,
|
|
140
|
-
confidence: Math.max(0.5, 1 - (criticalCount * 0.1 + highCount * 0.02)),
|
|
141
|
-
};
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
calculateWeightedApproval(votes) {
|
|
145
|
-
if (votes.length === 0)
|
|
146
|
-
return 0;
|
|
147
|
-
const totalWeight = votes.reduce((sum, v) => sum + v.weight, 0);
|
|
148
|
-
const approvalWeight = votes
|
|
149
|
-
.filter((v) => v.vote === "approve")
|
|
150
|
-
.reduce((sum, v) => sum + v.weight, 0);
|
|
151
|
-
return totalWeight > 0 ? approvalWeight / totalWeight : 0;
|
|
152
|
-
}
|
|
153
|
-
getOrchestrationLayer() {
|
|
154
|
-
return this.orchestration;
|
|
155
|
-
}
|
|
156
|
-
getActiveAgents() {
|
|
157
|
-
return this.orchestration.getActiveAgents();
|
|
158
|
-
}
|
|
159
|
-
getPendingTasks() {
|
|
160
|
-
return this.orchestration.getTasks().filter((t) => t.status === "pending");
|
|
161
|
-
}
|
|
162
|
-
isCoordinatorActive() {
|
|
163
|
-
return this.isActive;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
export function createSecurityAgentCoordinator(config) {
|
|
167
|
-
return new SecurityAgentCoordinator(config);
|
|
168
|
-
}
|
|
169
|
-
export async function runMultiAgentSecurityScan(projectPath, context) {
|
|
170
|
-
const coordinator = createSecurityAgentCoordinator();
|
|
171
|
-
const fullContext = {
|
|
172
|
-
projectPath,
|
|
173
|
-
scanDepth: context?.scanDepth || "medium",
|
|
174
|
-
complianceStandards: context?.complianceStandards || ["owasp-top-10", "cwe"],
|
|
175
|
-
enableAutoRemediation: context?.enableAutoRemediation ?? true,
|
|
176
|
-
...context,
|
|
177
|
-
};
|
|
178
|
-
coordinator.registerAgent({
|
|
179
|
-
agentId: "agent-security-auditor",
|
|
180
|
-
agentType: "security-auditor",
|
|
181
|
-
capabilities: ["vulnerability-scanning", "threat-detection", "security-auditing"],
|
|
182
|
-
weight: 0.35,
|
|
183
|
-
});
|
|
184
|
-
coordinator.registerAgent({
|
|
185
|
-
agentId: "agent-code-analyzer",
|
|
186
|
-
agentType: "code-analyzer",
|
|
187
|
-
capabilities: ["code-pattern-analysis", "static-analysis", "security-hotspot-detection"],
|
|
188
|
-
weight: 0.30,
|
|
189
|
-
});
|
|
190
|
-
coordinator.registerAgent({
|
|
191
|
-
agentId: "agent-testing-lead",
|
|
192
|
-
agentType: "testing-lead",
|
|
193
|
-
capabilities: ["security-testing", "penetration-testing", "vulnerability-validation"],
|
|
194
|
-
weight: 0.20,
|
|
195
|
-
});
|
|
196
|
-
coordinator.registerAgent({
|
|
197
|
-
agentId: "agent-architect",
|
|
198
|
-
agentType: "architect",
|
|
199
|
-
capabilities: ["security-architecture", "threat-modeling", "risk-assessment"],
|
|
200
|
-
weight: 0.15,
|
|
201
|
-
});
|
|
202
|
-
return coordinator.runCoordinatedSecurityScan(fullContext);
|
|
203
|
-
}
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Security Hardening System
|
|
3
|
-
*
|
|
4
|
-
* Comprehensive security hardening implementation with OWASP compliance.
|
|
5
|
-
* Implements defense-in-depth security architecture for enterprise applications.
|
|
6
|
-
*
|
|
7
|
-
* @since 2026-01-08
|
|
8
|
-
*/
|
|
9
|
-
import { EventEmitter } from "events";
|
|
10
|
-
import { IncomingMessage, ServerResponse } from "http";
|
|
11
|
-
export declare const SECURITY_CONFIG: {
|
|
12
|
-
readonly headers: {
|
|
13
|
-
readonly "X-Content-Type-Options": "nosniff";
|
|
14
|
-
readonly "X-Frame-Options": "DENY";
|
|
15
|
-
readonly "X-XSS-Protection": "1; mode=block";
|
|
16
|
-
readonly "Strict-Transport-Security": "max-age=31536000; includeSubDomains";
|
|
17
|
-
readonly "Content-Security-Policy": "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'";
|
|
18
|
-
readonly "Referrer-Policy": "strict-origin-when-cross-origin";
|
|
19
|
-
readonly "Permissions-Policy": "geolocation=(), microphone=(), camera=()";
|
|
20
|
-
readonly "Cross-Origin-Embedder-Policy": "require-corp";
|
|
21
|
-
readonly "Cross-Origin-Opener-Policy": "same-origin";
|
|
22
|
-
readonly "Cross-Origin-Resource-Policy": "same-origin";
|
|
23
|
-
};
|
|
24
|
-
readonly rateLimiting: {
|
|
25
|
-
readonly windowMs: number;
|
|
26
|
-
readonly maxRequests: 100;
|
|
27
|
-
readonly skipSuccessfulRequests: false;
|
|
28
|
-
readonly skipFailedRequests: false;
|
|
29
|
-
};
|
|
30
|
-
readonly inputValidation: {
|
|
31
|
-
readonly maxStringLength: 10000;
|
|
32
|
-
readonly maxArrayLength: 1000;
|
|
33
|
-
readonly maxObjectDepth: 10;
|
|
34
|
-
readonly allowedCharacters: RegExp;
|
|
35
|
-
readonly sqlInjectionPatterns: readonly [RegExp, RegExp];
|
|
36
|
-
readonly xssPatterns: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
37
|
-
};
|
|
38
|
-
readonly encryption: {
|
|
39
|
-
readonly algorithm: "aes-256-gcm";
|
|
40
|
-
readonly keyLength: 32;
|
|
41
|
-
readonly ivLength: 16;
|
|
42
|
-
readonly saltRounds: 12;
|
|
43
|
-
};
|
|
44
|
-
readonly audit: {
|
|
45
|
-
readonly logLevel: "detailed";
|
|
46
|
-
readonly retentionDays: 90;
|
|
47
|
-
readonly sensitiveFields: readonly ["password", "token", "secret", "key", "authorization"];
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
export type SecurityEventType = "input_validation_failure" | "rate_limit_exceeded" | "authentication_failure" | "authorization_failure" | "suspicious_activity" | "sql_injection_attempt" | "xss_attempt" | "csrf_attempt" | "security_header_missing" | "encryption_failure" | "audit_log_failure";
|
|
51
|
-
export type SecuritySeverity = "low" | "medium" | "high" | "critical";
|
|
52
|
-
export interface SecurityEvent {
|
|
53
|
-
id: string;
|
|
54
|
-
type: SecurityEventType;
|
|
55
|
-
severity: SecuritySeverity;
|
|
56
|
-
message: string;
|
|
57
|
-
source: string;
|
|
58
|
-
userId?: string;
|
|
59
|
-
ipAddress?: string;
|
|
60
|
-
userAgent?: string;
|
|
61
|
-
timestamp: number;
|
|
62
|
-
metadata: Record<string, unknown>;
|
|
63
|
-
stackTrace?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface ValidationResult {
|
|
66
|
-
isValid: boolean;
|
|
67
|
-
errors: string[];
|
|
68
|
-
sanitizedValue?: unknown;
|
|
69
|
-
securityEvents: SecurityEvent[];
|
|
70
|
-
}
|
|
71
|
-
export interface RateLimitEntry {
|
|
72
|
-
count: number;
|
|
73
|
-
resetTime: number;
|
|
74
|
-
lastRequest: number;
|
|
75
|
-
}
|
|
76
|
-
export interface SecurityMiddlewareOptions {
|
|
77
|
-
enableRateLimiting?: boolean;
|
|
78
|
-
enableInputValidation?: boolean;
|
|
79
|
-
enableSecurityHeaders?: boolean;
|
|
80
|
-
enableAuditLogging?: boolean;
|
|
81
|
-
enableCsrfProtection?: boolean;
|
|
82
|
-
enableHsts?: boolean;
|
|
83
|
-
customHeaders?: Record<string, string>;
|
|
84
|
-
trustedOrigins?: string[];
|
|
85
|
-
rateLimitOptions?: Partial<typeof SECURITY_CONFIG.rateLimiting>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Core security hardening system
|
|
89
|
-
*/
|
|
90
|
-
export declare class SecurityHardeningSystem extends EventEmitter {
|
|
91
|
-
private rateLimitStore;
|
|
92
|
-
private securityEvents;
|
|
93
|
-
private encryptionKey;
|
|
94
|
-
private auditLogEnabled;
|
|
95
|
-
private started;
|
|
96
|
-
private pendingEncryptionKey;
|
|
97
|
-
private boundSecurityEvent;
|
|
98
|
-
private boundRateLimitExceeded;
|
|
99
|
-
private boundValidationFailure;
|
|
100
|
-
constructor(encryptionKey?: string);
|
|
101
|
-
start(): void;
|
|
102
|
-
/**
|
|
103
|
-
* Setup event handlers for security events
|
|
104
|
-
*/
|
|
105
|
-
private setupEventHandlers;
|
|
106
|
-
destroy(): void;
|
|
107
|
-
/**
|
|
108
|
-
* Create security middleware for HTTP requests
|
|
109
|
-
*/
|
|
110
|
-
createSecurityMiddleware(options?: SecurityMiddlewareOptions): (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
111
|
-
/**
|
|
112
|
-
* Check rate limiting for requests
|
|
113
|
-
*/
|
|
114
|
-
private checkRateLimit;
|
|
115
|
-
/**
|
|
116
|
-
* Apply security headers to response
|
|
117
|
-
*/
|
|
118
|
-
private applySecurityHeaders;
|
|
119
|
-
/**
|
|
120
|
-
* Validate CSRF token
|
|
121
|
-
*/
|
|
122
|
-
private validateCsrfToken;
|
|
123
|
-
/**
|
|
124
|
-
* Validate and sanitize input data
|
|
125
|
-
*/
|
|
126
|
-
validateInput(input: unknown, context?: string): ValidationResult;
|
|
127
|
-
/**
|
|
128
|
-
* Validate string input
|
|
129
|
-
*/
|
|
130
|
-
private validateString;
|
|
131
|
-
/**
|
|
132
|
-
* Validate object input
|
|
133
|
-
*/
|
|
134
|
-
private validateObject;
|
|
135
|
-
/**
|
|
136
|
-
* Validate array input
|
|
137
|
-
*/
|
|
138
|
-
private validateArray;
|
|
139
|
-
/**
|
|
140
|
-
* Check for security patterns in input
|
|
141
|
-
*/
|
|
142
|
-
private checkSecurityPatterns;
|
|
143
|
-
/**
|
|
144
|
-
* Encrypt sensitive data using AES-256-GCM
|
|
145
|
-
* SECURITY: Proper encryption with random IV and authentication tag (H-001 fix)
|
|
146
|
-
*
|
|
147
|
-
* @param data - Plaintext data to encrypt
|
|
148
|
-
* @returns Base64-encoded string containing encrypted data + IV + auth tag
|
|
149
|
-
*/
|
|
150
|
-
encryptData(data: string): string;
|
|
151
|
-
/**
|
|
152
|
-
* Decrypt sensitive data using AES-256-GCM
|
|
153
|
-
* SECURITY: Proper decryption with IV and auth tag verification (H-001 fix)
|
|
154
|
-
*
|
|
155
|
-
* @param encryptedData - Base64-encoded string containing encrypted data + IV + auth tag
|
|
156
|
-
* @returns Decrypted plaintext data
|
|
157
|
-
* @throws Error if decryption fails or authentication tag doesn't match
|
|
158
|
-
*/
|
|
159
|
-
decryptData(encryptedData: string): string | null;
|
|
160
|
-
/**
|
|
161
|
-
* Hash password securely with unique salt
|
|
162
|
-
* SECURITY: Generates unique random salt for each password (H-003 fix)
|
|
163
|
-
*/
|
|
164
|
-
hashPassword(password: string): Promise<{
|
|
165
|
-
hash: string;
|
|
166
|
-
salt: string;
|
|
167
|
-
}>;
|
|
168
|
-
/**
|
|
169
|
-
* Verify password hash
|
|
170
|
-
*/
|
|
171
|
-
verifyPassword(password: string, hash: string, salt: string): Promise<boolean>;
|
|
172
|
-
/**
|
|
173
|
-
* Generate secure random token
|
|
174
|
-
*/
|
|
175
|
-
generateSecureToken(length?: number): string;
|
|
176
|
-
/**
|
|
177
|
-
* Log audit event
|
|
178
|
-
*/
|
|
179
|
-
private logAuditEvent;
|
|
180
|
-
/**
|
|
181
|
-
* Sanitize headers for audit logging
|
|
182
|
-
*/
|
|
183
|
-
private sanitizeHeadersForAudit;
|
|
184
|
-
/**
|
|
185
|
-
* Emit security event
|
|
186
|
-
*/
|
|
187
|
-
private emitSecurityEvent;
|
|
188
|
-
/**
|
|
189
|
-
* Handle security events
|
|
190
|
-
*/
|
|
191
|
-
private handleSecurityEvent;
|
|
192
|
-
/**
|
|
193
|
-
* Handle rate limit exceeded
|
|
194
|
-
*/
|
|
195
|
-
private handleRateLimitExceeded;
|
|
196
|
-
/**
|
|
197
|
-
* Handle validation failure
|
|
198
|
-
*/
|
|
199
|
-
private handleValidationFailure;
|
|
200
|
-
/**
|
|
201
|
-
* Get client IP address
|
|
202
|
-
*/
|
|
203
|
-
private getClientIP;
|
|
204
|
-
/**
|
|
205
|
-
* Get rate limit info for IP
|
|
206
|
-
*/
|
|
207
|
-
private getRateLimitInfo;
|
|
208
|
-
/**
|
|
209
|
-
* Get object depth
|
|
210
|
-
*/
|
|
211
|
-
private getObjectDepth;
|
|
212
|
-
/**
|
|
213
|
-
* Cleanup old rate limit entries
|
|
214
|
-
*/
|
|
215
|
-
private cleanupRateLimitStore;
|
|
216
|
-
/**
|
|
217
|
-
* Get security events
|
|
218
|
-
*/
|
|
219
|
-
getSecurityEvents(limit?: number): SecurityEvent[];
|
|
220
|
-
/**
|
|
221
|
-
* Clear security events
|
|
222
|
-
*/
|
|
223
|
-
clearSecurityEvents(): void;
|
|
224
|
-
/**
|
|
225
|
-
* Get security statistics
|
|
226
|
-
*/
|
|
227
|
-
getSecurityStats(): {
|
|
228
|
-
totalEvents: number;
|
|
229
|
-
eventsByType: Record<SecurityEventType, number>;
|
|
230
|
-
eventsBySeverity: Record<SecuritySeverity, number>;
|
|
231
|
-
recentEvents: SecurityEvent[];
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Enable/disable audit logging
|
|
235
|
-
*/
|
|
236
|
-
setAuditLogging(enabled: boolean): void;
|
|
237
|
-
}
|
|
238
|
-
export declare const securityHardeningSystem: SecurityHardeningSystem;
|