@trentapps/manager-protocol 1.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/LICENSE +21 -0
- package/README.md +639 -0
- package/dist/analyzers/ArchitectureDetector.d.ts +44 -0
- package/dist/analyzers/ArchitectureDetector.d.ts.map +1 -0
- package/dist/analyzers/ArchitectureDetector.js +218 -0
- package/dist/analyzers/ArchitectureDetector.js.map +1 -0
- package/dist/analyzers/CSSAnalyzer.d.ts +284 -0
- package/dist/analyzers/CSSAnalyzer.d.ts.map +1 -0
- package/dist/analyzers/CSSAnalyzer.js +1180 -0
- package/dist/analyzers/CSSAnalyzer.js.map +1 -0
- package/dist/analyzers/index.d.ts +5 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +5 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +174 -0
- package/dist/cli.js.map +1 -0
- package/dist/design-system/index.d.ts +6 -0
- package/dist/design-system/index.d.ts.map +1 -0
- package/dist/design-system/index.js +6 -0
- package/dist/design-system/index.js.map +1 -0
- package/dist/design-system/tokens.d.ts +106 -0
- package/dist/design-system/tokens.d.ts.map +1 -0
- package/dist/design-system/tokens.js +554 -0
- package/dist/design-system/tokens.js.map +1 -0
- package/dist/engine/AuditLogger.d.ts +506 -0
- package/dist/engine/AuditLogger.d.ts.map +1 -0
- package/dist/engine/AuditLogger.js +1491 -0
- package/dist/engine/AuditLogger.js.map +1 -0
- package/dist/engine/GitHubApprovalManager.d.ts +123 -0
- package/dist/engine/GitHubApprovalManager.d.ts.map +1 -0
- package/dist/engine/GitHubApprovalManager.js +347 -0
- package/dist/engine/GitHubApprovalManager.js.map +1 -0
- package/dist/engine/GitHubClient.d.ts +183 -0
- package/dist/engine/GitHubClient.d.ts.map +1 -0
- package/dist/engine/GitHubClient.js +411 -0
- package/dist/engine/GitHubClient.js.map +1 -0
- package/dist/engine/RateLimiter.d.ts +81 -0
- package/dist/engine/RateLimiter.d.ts.map +1 -0
- package/dist/engine/RateLimiter.js +215 -0
- package/dist/engine/RateLimiter.js.map +1 -0
- package/dist/engine/RuleDependencyAnalyzer.d.ts +73 -0
- package/dist/engine/RuleDependencyAnalyzer.d.ts.map +1 -0
- package/dist/engine/RuleDependencyAnalyzer.js +475 -0
- package/dist/engine/RuleDependencyAnalyzer.js.map +1 -0
- package/dist/engine/RulesEngine.d.ts +176 -0
- package/dist/engine/RulesEngine.d.ts.map +1 -0
- package/dist/engine/RulesEngine.js +705 -0
- package/dist/engine/RulesEngine.js.map +1 -0
- package/dist/engine/TaskManager.d.ts +174 -0
- package/dist/engine/TaskManager.d.ts.map +1 -0
- package/dist/engine/TaskManager.js +663 -0
- package/dist/engine/TaskManager.js.map +1 -0
- package/dist/engine/index.d.ts +11 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +13 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/architecture.d.ts +9 -0
- package/dist/rules/architecture.d.ts.map +1 -0
- package/dist/rules/architecture.js +322 -0
- package/dist/rules/architecture.js.map +1 -0
- package/dist/rules/azure.d.ts +7 -0
- package/dist/rules/azure.d.ts.map +1 -0
- package/dist/rules/azure.js +136 -0
- package/dist/rules/azure.js.map +1 -0
- package/dist/rules/compliance.d.ts +9 -0
- package/dist/rules/compliance.d.ts.map +1 -0
- package/dist/rules/compliance.js +286 -0
- package/dist/rules/compliance.js.map +1 -0
- package/dist/rules/condition-optimizer.d.ts +151 -0
- package/dist/rules/condition-optimizer.d.ts.map +1 -0
- package/dist/rules/condition-optimizer.js +479 -0
- package/dist/rules/condition-optimizer.js.map +1 -0
- package/dist/rules/css.d.ts +10 -0
- package/dist/rules/css.d.ts.map +1 -0
- package/dist/rules/css.js +1777 -0
- package/dist/rules/css.js.map +1 -0
- package/dist/rules/field-standards.d.ts +1172 -0
- package/dist/rules/field-standards.d.ts.map +1 -0
- package/dist/rules/field-standards.js +908 -0
- package/dist/rules/field-standards.js.map +1 -0
- package/dist/rules/flask.d.ts +7 -0
- package/dist/rules/flask.d.ts.map +1 -0
- package/dist/rules/flask.js +142 -0
- package/dist/rules/flask.js.map +1 -0
- package/dist/rules/index.d.ts +827 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +556 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/ml-ai.d.ts +7 -0
- package/dist/rules/ml-ai.d.ts.map +1 -0
- package/dist/rules/ml-ai.js +148 -0
- package/dist/rules/ml-ai.js.map +1 -0
- package/dist/rules/operational.d.ts +9 -0
- package/dist/rules/operational.d.ts.map +1 -0
- package/dist/rules/operational.js +318 -0
- package/dist/rules/operational.js.map +1 -0
- package/dist/rules/patterns.d.ts +568 -0
- package/dist/rules/patterns.d.ts.map +1 -0
- package/dist/rules/patterns.js +1359 -0
- package/dist/rules/patterns.js.map +1 -0
- package/dist/rules/security.d.ts +9 -0
- package/dist/rules/security.d.ts.map +1 -0
- package/dist/rules/security.js +848 -0
- package/dist/rules/security.js.map +1 -0
- package/dist/rules/shared-patterns.d.ts +268 -0
- package/dist/rules/shared-patterns.d.ts.map +1 -0
- package/dist/rules/shared-patterns.js +556 -0
- package/dist/rules/shared-patterns.js.map +1 -0
- package/dist/rules/storage.d.ts +13 -0
- package/dist/rules/storage.d.ts.map +1 -0
- package/dist/rules/storage.js +672 -0
- package/dist/rules/storage.js.map +1 -0
- package/dist/rules/stripe.d.ts +7 -0
- package/dist/rules/stripe.d.ts.map +1 -0
- package/dist/rules/stripe.js +133 -0
- package/dist/rules/stripe.js.map +1 -0
- package/dist/rules/testing.d.ts +7 -0
- package/dist/rules/testing.d.ts.map +1 -0
- package/dist/rules/testing.js +135 -0
- package/dist/rules/testing.js.map +1 -0
- package/dist/rules/ux.d.ts +9 -0
- package/dist/rules/ux.d.ts.map +1 -0
- package/dist/rules/ux.js +280 -0
- package/dist/rules/ux.js.map +1 -0
- package/dist/rules/websocket.d.ts +7 -0
- package/dist/rules/websocket.d.ts.map +1 -0
- package/dist/rules/websocket.js +128 -0
- package/dist/rules/websocket.js.map +1 -0
- package/dist/server.d.ts +43 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1967 -0
- package/dist/server.js.map +1 -0
- package/dist/supervisor/AgentSupervisor.d.ts +195 -0
- package/dist/supervisor/AgentSupervisor.d.ts.map +1 -0
- package/dist/supervisor/AgentSupervisor.js +569 -0
- package/dist/supervisor/AgentSupervisor.js.map +1 -0
- package/dist/supervisor/ManagedServerRegistry.d.ts +185 -0
- package/dist/supervisor/ManagedServerRegistry.d.ts.map +1 -0
- package/dist/supervisor/ManagedServerRegistry.js +729 -0
- package/dist/supervisor/ManagedServerRegistry.js.map +1 -0
- package/dist/supervisor/ProjectTracker.d.ts +210 -0
- package/dist/supervisor/ProjectTracker.d.ts.map +1 -0
- package/dist/supervisor/ProjectTracker.js +709 -0
- package/dist/supervisor/ProjectTracker.js.map +1 -0
- package/dist/supervisor/index.d.ts +6 -0
- package/dist/supervisor/index.d.ts.map +1 -0
- package/dist/supervisor/index.js +6 -0
- package/dist/supervisor/index.js.map +1 -0
- package/dist/testing/index.d.ts +11 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +12 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/rule-tester.d.ts +217 -0
- package/dist/testing/rule-tester.d.ts.map +1 -0
- package/dist/testing/rule-tester.examples.d.ts +57 -0
- package/dist/testing/rule-tester.examples.d.ts.map +1 -0
- package/dist/testing/rule-tester.examples.js +375 -0
- package/dist/testing/rule-tester.examples.js.map +1 -0
- package/dist/testing/rule-tester.js +381 -0
- package/dist/testing/rule-tester.js.map +1 -0
- package/dist/testing/rule-validator.d.ts +141 -0
- package/dist/testing/rule-validator.d.ts.map +1 -0
- package/dist/testing/rule-validator.js +640 -0
- package/dist/testing/rule-validator.js.map +1 -0
- package/dist/types/index.d.ts +1282 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +386 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/errors.d.ts +86 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +171 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/rate-limiting.d.ts +268 -0
- package/dist/utils/rate-limiting.d.ts.map +1 -0
- package/dist/utils/rate-limiting.js +403 -0
- package/dist/utils/rate-limiting.js.map +1 -0
- package/dist/utils/shared.d.ts +306 -0
- package/dist/utils/shared.d.ts.map +1 -0
- package/dist/utils/shared.js +464 -0
- package/dist/utils/shared.js.map +1 -0
- package/dist/utils/shell.d.ts +22 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +29 -0
- package/dist/utils/shell.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,848 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enterprise Agent Supervisor - Security Rules
|
|
3
|
+
*
|
|
4
|
+
* Built-in security rules for protecting against common vulnerabilities and threats.
|
|
5
|
+
*/
|
|
6
|
+
import { createEncryptionRule } from './shared-patterns.js';
|
|
7
|
+
export const securityRules = [
|
|
8
|
+
// ============================================================================
|
|
9
|
+
// DATA PROTECTION RULES
|
|
10
|
+
// ============================================================================
|
|
11
|
+
{
|
|
12
|
+
id: 'sec-001',
|
|
13
|
+
name: 'Block PII Access Without Authorization',
|
|
14
|
+
description: 'Prevents unauthorized access to personally identifiable information',
|
|
15
|
+
type: 'security',
|
|
16
|
+
enabled: true,
|
|
17
|
+
priority: 950,
|
|
18
|
+
conditions: [
|
|
19
|
+
{ field: 'actionCategory', operator: 'equals', value: 'pii_access' },
|
|
20
|
+
{ field: 'userRole', operator: 'not_in', value: ['admin', 'data_officer', 'compliance'] }
|
|
21
|
+
],
|
|
22
|
+
conditionLogic: 'all',
|
|
23
|
+
actions: [
|
|
24
|
+
{ type: 'deny', message: 'PII access requires authorized role (admin, data_officer, compliance)' },
|
|
25
|
+
{ type: 'log' }
|
|
26
|
+
],
|
|
27
|
+
riskWeight: 45,
|
|
28
|
+
tags: ['pii', 'gdpr', 'privacy'],
|
|
29
|
+
// Task #37: Rule interdependencies
|
|
30
|
+
relatedRules: ['sec-002', 'sec-003'] // Related to data export and logging rules
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 'sec-002',
|
|
34
|
+
name: 'Require Approval for Bulk Data Export',
|
|
35
|
+
description: 'Requires human approval for exporting large datasets',
|
|
36
|
+
type: 'security',
|
|
37
|
+
enabled: true,
|
|
38
|
+
priority: 900,
|
|
39
|
+
conditions: [
|
|
40
|
+
{ field: 'actionName', operator: 'contains', value: 'export' },
|
|
41
|
+
{ field: 'recordCount', operator: 'greater_than', value: 1000 }
|
|
42
|
+
],
|
|
43
|
+
conditionLogic: 'all',
|
|
44
|
+
actions: [
|
|
45
|
+
{ type: 'require_approval', message: 'Bulk data export (>1000 records) requires human approval' }
|
|
46
|
+
],
|
|
47
|
+
riskWeight: 35,
|
|
48
|
+
tags: ['data-export', 'bulk-operations'],
|
|
49
|
+
// Task #37: Rule interdependencies
|
|
50
|
+
dependsOn: ['sec-001'], // Check PII access authorization first
|
|
51
|
+
relatedRules: ['sec-003'] // Related to logging sensitive data
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'sec-003',
|
|
55
|
+
name: 'Block Sensitive Data in Logs',
|
|
56
|
+
description: 'Prevents logging of sensitive information',
|
|
57
|
+
type: 'security',
|
|
58
|
+
enabled: true,
|
|
59
|
+
priority: 920,
|
|
60
|
+
conditions: [
|
|
61
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_access' },
|
|
62
|
+
{ field: 'dataClassification', operator: 'in', value: ['confidential', 'restricted'] },
|
|
63
|
+
{ field: 'logEnabled', operator: 'equals', value: true }
|
|
64
|
+
],
|
|
65
|
+
conditionLogic: 'all',
|
|
66
|
+
actions: [
|
|
67
|
+
{ type: 'warn', message: 'Sensitive data should not be logged - ensure data masking is enabled' }
|
|
68
|
+
],
|
|
69
|
+
riskWeight: 25,
|
|
70
|
+
tags: ['logging', 'data-masking'],
|
|
71
|
+
// Task #37: Rule interdependencies
|
|
72
|
+
dependsOn: ['sec-001'], // PII access check should happen first
|
|
73
|
+
relatedRules: ['sec-002'] // Related to bulk export
|
|
74
|
+
},
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// AUTHENTICATION & AUTHORIZATION RULES
|
|
77
|
+
// ============================================================================
|
|
78
|
+
{
|
|
79
|
+
id: 'sec-010',
|
|
80
|
+
name: 'Block Unauthenticated API Calls',
|
|
81
|
+
description: 'Prevents API calls without proper authentication',
|
|
82
|
+
type: 'security',
|
|
83
|
+
enabled: true,
|
|
84
|
+
priority: 990,
|
|
85
|
+
conditions: [
|
|
86
|
+
{ field: 'actionCategory', operator: 'equals', value: 'external_api' },
|
|
87
|
+
{ field: 'authToken', operator: 'not_exists', value: null }
|
|
88
|
+
],
|
|
89
|
+
conditionLogic: 'all',
|
|
90
|
+
actions: [
|
|
91
|
+
{ type: 'deny', message: 'External API calls require authentication token' }
|
|
92
|
+
],
|
|
93
|
+
riskWeight: 50,
|
|
94
|
+
tags: ['authentication', 'api'],
|
|
95
|
+
// Task #37: Rule interdependencies
|
|
96
|
+
relatedRules: ['sec-011', 'sec-012', 'sec-031'] // Related auth and API rules
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'sec-011',
|
|
100
|
+
name: 'Privilege Escalation Detection',
|
|
101
|
+
description: 'Detects and blocks privilege escalation attempts',
|
|
102
|
+
type: 'security',
|
|
103
|
+
enabled: true,
|
|
104
|
+
priority: 980,
|
|
105
|
+
conditions: [
|
|
106
|
+
{ field: 'actionCategory', operator: 'equals', value: 'authorization' },
|
|
107
|
+
{ field: 'targetRole', operator: 'in', value: ['admin', 'superuser', 'root'] },
|
|
108
|
+
{ field: 'userRole', operator: 'not_in', value: ['admin', 'superuser'] }
|
|
109
|
+
],
|
|
110
|
+
conditionLogic: 'all',
|
|
111
|
+
actions: [
|
|
112
|
+
{ type: 'deny', message: 'Privilege escalation attempt blocked' },
|
|
113
|
+
{ type: 'notify', message: 'Security alert: Privilege escalation attempt detected' }
|
|
114
|
+
],
|
|
115
|
+
riskWeight: 60,
|
|
116
|
+
tags: ['privilege-escalation', 'authorization'],
|
|
117
|
+
// Task #37: Rule interdependencies
|
|
118
|
+
dependsOn: ['sec-010'], // Check authentication before authorization
|
|
119
|
+
relatedRules: ['sec-012'] // Related session security
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'sec-012',
|
|
123
|
+
name: 'Session Hijacking Prevention',
|
|
124
|
+
description: 'Blocks actions from suspicious session patterns',
|
|
125
|
+
type: 'security',
|
|
126
|
+
enabled: true,
|
|
127
|
+
priority: 970,
|
|
128
|
+
conditions: [
|
|
129
|
+
{ field: 'sessionAnomalyScore', operator: 'greater_than', value: 0.8 }
|
|
130
|
+
],
|
|
131
|
+
conditionLogic: 'all',
|
|
132
|
+
actions: [
|
|
133
|
+
{ type: 'deny', message: 'Session anomaly detected - action blocked for security' },
|
|
134
|
+
{ type: 'notify', message: 'Security alert: Possible session hijacking detected' }
|
|
135
|
+
],
|
|
136
|
+
riskWeight: 55,
|
|
137
|
+
tags: ['session-security', 'anomaly-detection'],
|
|
138
|
+
// Task #37: Rule interdependencies
|
|
139
|
+
dependsOn: ['sec-010'], // Check authentication first
|
|
140
|
+
relatedRules: ['sec-011'] // Related to privilege escalation
|
|
141
|
+
},
|
|
142
|
+
// ============================================================================
|
|
143
|
+
// CODE EXECUTION RULES
|
|
144
|
+
// ============================================================================
|
|
145
|
+
{
|
|
146
|
+
id: 'sec-020',
|
|
147
|
+
name: 'Block Arbitrary Code Execution',
|
|
148
|
+
description: 'Prevents execution of unvalidated code',
|
|
149
|
+
type: 'security',
|
|
150
|
+
enabled: true,
|
|
151
|
+
priority: 1000,
|
|
152
|
+
conditions: [
|
|
153
|
+
{ field: 'actionCategory', operator: 'equals', value: 'code_execution' },
|
|
154
|
+
{ field: 'codeValidated', operator: 'not_equals', value: true }
|
|
155
|
+
],
|
|
156
|
+
conditionLogic: 'all',
|
|
157
|
+
actions: [
|
|
158
|
+
{ type: 'deny', message: 'Code execution requires validation before execution' }
|
|
159
|
+
],
|
|
160
|
+
riskWeight: 70,
|
|
161
|
+
tags: ['code-execution', 'validation']
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: 'sec-021',
|
|
165
|
+
name: 'Sandbox Requirement for Scripts',
|
|
166
|
+
description: 'Requires sandbox for script execution',
|
|
167
|
+
type: 'security',
|
|
168
|
+
enabled: true,
|
|
169
|
+
priority: 960,
|
|
170
|
+
conditions: [
|
|
171
|
+
{ field: 'actionCategory', operator: 'equals', value: 'code_execution' },
|
|
172
|
+
{ field: 'sandboxed', operator: 'not_equals', value: true },
|
|
173
|
+
{ field: 'environment', operator: 'equals', value: 'production' }
|
|
174
|
+
],
|
|
175
|
+
conditionLogic: 'all',
|
|
176
|
+
actions: [
|
|
177
|
+
{ type: 'deny', message: 'Script execution in production requires sandboxing' }
|
|
178
|
+
],
|
|
179
|
+
riskWeight: 50,
|
|
180
|
+
tags: ['sandbox', 'code-execution', 'production']
|
|
181
|
+
},
|
|
182
|
+
// ============================================================================
|
|
183
|
+
// NETWORK SECURITY RULES
|
|
184
|
+
// ============================================================================
|
|
185
|
+
{
|
|
186
|
+
id: 'sec-030',
|
|
187
|
+
name: 'Block Unauthorized External Connections',
|
|
188
|
+
description: 'Prevents connections to non-whitelisted external hosts',
|
|
189
|
+
type: 'security',
|
|
190
|
+
enabled: true,
|
|
191
|
+
priority: 940,
|
|
192
|
+
conditions: [
|
|
193
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
194
|
+
{ field: 'hostWhitelisted', operator: 'not_equals', value: true }
|
|
195
|
+
],
|
|
196
|
+
conditionLogic: 'all',
|
|
197
|
+
actions: [
|
|
198
|
+
{ type: 'require_approval', message: 'Connection to non-whitelisted host requires approval' }
|
|
199
|
+
],
|
|
200
|
+
riskWeight: 35,
|
|
201
|
+
tags: ['network', 'whitelist']
|
|
202
|
+
},
|
|
203
|
+
// HTTPS for External APIs - uses shared encryption pattern
|
|
204
|
+
createEncryptionRule({
|
|
205
|
+
id: 'sec-031',
|
|
206
|
+
name: 'Enforce HTTPS for External APIs',
|
|
207
|
+
description: 'Requires HTTPS for all external API communications',
|
|
208
|
+
encryptionType: 'transport',
|
|
209
|
+
scope: {
|
|
210
|
+
category: 'external_api'
|
|
211
|
+
},
|
|
212
|
+
actionType: 'deny',
|
|
213
|
+
message: 'External API calls must use HTTPS',
|
|
214
|
+
priority: 930,
|
|
215
|
+
riskWeight: 40,
|
|
216
|
+
tags: ['https', 'api']
|
|
217
|
+
}),
|
|
218
|
+
// ============================================================================
|
|
219
|
+
// FILE SYSTEM SECURITY RULES
|
|
220
|
+
// ============================================================================
|
|
221
|
+
{
|
|
222
|
+
id: 'sec-040',
|
|
223
|
+
name: 'Block Access to System Files',
|
|
224
|
+
description: 'Prevents access to critical system files',
|
|
225
|
+
type: 'security',
|
|
226
|
+
enabled: true,
|
|
227
|
+
priority: 990,
|
|
228
|
+
conditions: [
|
|
229
|
+
{ field: 'actionCategory', operator: 'equals', value: 'file_system' },
|
|
230
|
+
{ field: 'filePath', operator: 'matches_regex', value: '^(/etc|/sys|/proc|C:\\\\Windows)' }
|
|
231
|
+
],
|
|
232
|
+
conditionLogic: 'all',
|
|
233
|
+
actions: [
|
|
234
|
+
{ type: 'deny', message: 'Access to system files is prohibited' }
|
|
235
|
+
],
|
|
236
|
+
riskWeight: 60,
|
|
237
|
+
tags: ['file-system', 'system-files']
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: 'sec-041',
|
|
241
|
+
name: 'Require Approval for Config File Changes',
|
|
242
|
+
description: 'Requires approval for modifying configuration files',
|
|
243
|
+
type: 'security',
|
|
244
|
+
enabled: true,
|
|
245
|
+
priority: 880,
|
|
246
|
+
conditions: [
|
|
247
|
+
{ field: 'actionCategory', operator: 'equals', value: 'file_system' },
|
|
248
|
+
{ field: 'operation', operator: 'in', value: ['write', 'delete', 'modify'] },
|
|
249
|
+
{ field: 'filePath', operator: 'matches_regex', value: '\\.(conf|config|yml|yaml|json|env)$' }
|
|
250
|
+
],
|
|
251
|
+
conditionLogic: 'all',
|
|
252
|
+
actions: [
|
|
253
|
+
{ type: 'require_approval', message: 'Configuration file changes require approval' }
|
|
254
|
+
],
|
|
255
|
+
riskWeight: 30,
|
|
256
|
+
tags: ['configuration', 'file-system']
|
|
257
|
+
},
|
|
258
|
+
// ============================================================================
|
|
259
|
+
// INJECTION PREVENTION RULES
|
|
260
|
+
// ============================================================================
|
|
261
|
+
{
|
|
262
|
+
id: 'sec-050',
|
|
263
|
+
name: 'SQL Injection Prevention',
|
|
264
|
+
description: 'Detects and blocks SQL injection patterns',
|
|
265
|
+
type: 'security',
|
|
266
|
+
enabled: true,
|
|
267
|
+
priority: 1000,
|
|
268
|
+
conditions: [
|
|
269
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_access' },
|
|
270
|
+
{ field: 'query', operator: 'matches_regex', value: '(\\b(SELECT|INSERT|UPDATE|DELETE|DROP|UNION|OR|AND)\\b.*[\'";])|(--)|(\\*/)|(/\\*)' }
|
|
271
|
+
],
|
|
272
|
+
conditionLogic: 'all',
|
|
273
|
+
actions: [
|
|
274
|
+
{ type: 'deny', message: 'SQL injection pattern detected - action blocked' },
|
|
275
|
+
{ type: 'notify', message: 'Security alert: SQL injection attempt detected' }
|
|
276
|
+
],
|
|
277
|
+
riskWeight: 80,
|
|
278
|
+
tags: ['sql-injection', 'owasp']
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
id: 'sec-051',
|
|
282
|
+
name: 'Command Injection Prevention',
|
|
283
|
+
description: 'Detects and blocks command injection patterns',
|
|
284
|
+
type: 'security',
|
|
285
|
+
enabled: true,
|
|
286
|
+
priority: 1000,
|
|
287
|
+
conditions: [
|
|
288
|
+
{ field: 'actionCategory', operator: 'equals', value: 'code_execution' },
|
|
289
|
+
{ field: 'command', operator: 'matches_regex', value: '([;&|`$]|\\$\\(|\\{\\{)' }
|
|
290
|
+
],
|
|
291
|
+
conditionLogic: 'all',
|
|
292
|
+
actions: [
|
|
293
|
+
{ type: 'deny', message: 'Command injection pattern detected - action blocked' },
|
|
294
|
+
{ type: 'notify', message: 'Security alert: Command injection attempt detected' }
|
|
295
|
+
],
|
|
296
|
+
riskWeight: 80,
|
|
297
|
+
tags: ['command-injection', 'owasp']
|
|
298
|
+
},
|
|
299
|
+
// ============================================================================
|
|
300
|
+
// OWASP TOP 10 - PATH TRAVERSAL (A01:2021 - Broken Access Control)
|
|
301
|
+
// ============================================================================
|
|
302
|
+
{
|
|
303
|
+
id: 'sec-060',
|
|
304
|
+
name: 'Path Traversal Prevention',
|
|
305
|
+
description: 'Detects and blocks path traversal attacks (directory traversal)',
|
|
306
|
+
type: 'security',
|
|
307
|
+
enabled: true,
|
|
308
|
+
priority: 1000,
|
|
309
|
+
conditions: [
|
|
310
|
+
{ field: 'actionCategory', operator: 'equals', value: 'file_system' },
|
|
311
|
+
{ field: 'filePath', operator: 'matches_regex', value: '(\\.\\./|\\.\\.\\\\|%2e%2e%2f|%2e%2e/|\\.\\.%2f|%2e%2e%5c)' }
|
|
312
|
+
],
|
|
313
|
+
conditionLogic: 'all',
|
|
314
|
+
actions: [
|
|
315
|
+
{ type: 'deny', message: 'Path traversal attack detected - action blocked' },
|
|
316
|
+
{ type: 'notify', message: 'Security alert: Path traversal attempt detected' }
|
|
317
|
+
],
|
|
318
|
+
riskWeight: 85,
|
|
319
|
+
tags: ['path-traversal', 'owasp', 'a01-broken-access-control']
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
id: 'sec-061',
|
|
323
|
+
name: 'Null Byte Injection Prevention',
|
|
324
|
+
description: 'Blocks null byte injection in file paths',
|
|
325
|
+
type: 'security',
|
|
326
|
+
enabled: true,
|
|
327
|
+
priority: 995,
|
|
328
|
+
conditions: [
|
|
329
|
+
{ field: 'actionCategory', operator: 'equals', value: 'file_system' },
|
|
330
|
+
{ field: 'filePath', operator: 'matches_regex', value: '(%00|\\x00|\\0)' }
|
|
331
|
+
],
|
|
332
|
+
conditionLogic: 'all',
|
|
333
|
+
actions: [
|
|
334
|
+
{ type: 'deny', message: 'Null byte injection detected in file path' },
|
|
335
|
+
{ type: 'notify', message: 'Security alert: Null byte injection attempt detected' }
|
|
336
|
+
],
|
|
337
|
+
riskWeight: 80,
|
|
338
|
+
tags: ['null-byte', 'owasp', 'file-system']
|
|
339
|
+
},
|
|
340
|
+
// ============================================================================
|
|
341
|
+
// OWASP TOP 10 - SSRF (A10:2021 - Server-Side Request Forgery)
|
|
342
|
+
// ============================================================================
|
|
343
|
+
{
|
|
344
|
+
id: 'sec-070',
|
|
345
|
+
name: 'SSRF Prevention - Internal Network',
|
|
346
|
+
description: 'Blocks server-side requests to internal network addresses',
|
|
347
|
+
type: 'security',
|
|
348
|
+
enabled: true,
|
|
349
|
+
priority: 990,
|
|
350
|
+
conditions: [
|
|
351
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
352
|
+
{ field: 'targetUrl', operator: 'matches_regex', value: '(localhost|127\\.0\\.0\\.1|0\\.0\\.0\\.0|10\\.|172\\.(1[6-9]|2[0-9]|3[01])\\.|192\\.168\\.|\\[::1\\]|\\[::\\])' }
|
|
353
|
+
],
|
|
354
|
+
conditionLogic: 'all',
|
|
355
|
+
actions: [
|
|
356
|
+
{ type: 'deny', message: 'SSRF attempt blocked - internal network address detected' },
|
|
357
|
+
{ type: 'notify', message: 'Security alert: SSRF attempt to internal network' }
|
|
358
|
+
],
|
|
359
|
+
riskWeight: 75,
|
|
360
|
+
tags: ['ssrf', 'owasp', 'a10-ssrf', 'network']
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
id: 'sec-071',
|
|
364
|
+
name: 'SSRF Prevention - Cloud Metadata',
|
|
365
|
+
description: 'Blocks server-side requests to cloud metadata endpoints',
|
|
366
|
+
type: 'security',
|
|
367
|
+
enabled: true,
|
|
368
|
+
priority: 995,
|
|
369
|
+
conditions: [
|
|
370
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
371
|
+
{ field: 'targetUrl', operator: 'matches_regex', value: '(169\\.254\\.169\\.254|metadata\\.google|metadata\\.azure)' }
|
|
372
|
+
],
|
|
373
|
+
conditionLogic: 'all',
|
|
374
|
+
actions: [
|
|
375
|
+
{ type: 'deny', message: 'SSRF attempt blocked - cloud metadata endpoint detected' },
|
|
376
|
+
{ type: 'notify', message: 'Security alert: SSRF attempt to cloud metadata' }
|
|
377
|
+
],
|
|
378
|
+
riskWeight: 90,
|
|
379
|
+
tags: ['ssrf', 'owasp', 'a10-ssrf', 'cloud-metadata']
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
id: 'sec-072',
|
|
383
|
+
name: 'SSRF Prevention - File Protocol',
|
|
384
|
+
description: 'Blocks server-side requests using file:// protocol',
|
|
385
|
+
type: 'security',
|
|
386
|
+
enabled: true,
|
|
387
|
+
priority: 990,
|
|
388
|
+
conditions: [
|
|
389
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
390
|
+
{ field: 'targetUrl', operator: 'matches_regex', value: '^(file|gopher|dict|ldap|tftp)://' }
|
|
391
|
+
],
|
|
392
|
+
conditionLogic: 'all',
|
|
393
|
+
actions: [
|
|
394
|
+
{ type: 'deny', message: 'SSRF attempt blocked - dangerous protocol detected' },
|
|
395
|
+
{ type: 'notify', message: 'Security alert: SSRF attempt with dangerous protocol' }
|
|
396
|
+
],
|
|
397
|
+
riskWeight: 85,
|
|
398
|
+
tags: ['ssrf', 'owasp', 'a10-ssrf', 'protocol']
|
|
399
|
+
},
|
|
400
|
+
// ============================================================================
|
|
401
|
+
// OWASP TOP 10 - INSECURE DESERIALIZATION (A08:2021 - Software and Data Integrity Failures)
|
|
402
|
+
// ============================================================================
|
|
403
|
+
{
|
|
404
|
+
id: 'sec-080',
|
|
405
|
+
name: 'Insecure Deserialization Prevention - Java',
|
|
406
|
+
description: 'Detects Java deserialization attacks',
|
|
407
|
+
type: 'security',
|
|
408
|
+
enabled: true,
|
|
409
|
+
priority: 985,
|
|
410
|
+
conditions: [
|
|
411
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
412
|
+
{ field: 'payload', operator: 'matches_regex', value: '(rO0AB|ac ed 00 05|java\\.lang\\.(Runtime|ProcessBuilder)|ysoserial)' }
|
|
413
|
+
],
|
|
414
|
+
conditionLogic: 'all',
|
|
415
|
+
actions: [
|
|
416
|
+
{ type: 'deny', message: 'Java deserialization attack detected - action blocked' },
|
|
417
|
+
{ type: 'notify', message: 'Security alert: Java deserialization attack attempt' }
|
|
418
|
+
],
|
|
419
|
+
riskWeight: 90,
|
|
420
|
+
tags: ['deserialization', 'owasp', 'a08-integrity', 'java']
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
id: 'sec-081',
|
|
424
|
+
name: 'Insecure Deserialization Prevention - PHP',
|
|
425
|
+
description: 'Detects PHP object injection attacks',
|
|
426
|
+
type: 'security',
|
|
427
|
+
enabled: true,
|
|
428
|
+
priority: 985,
|
|
429
|
+
conditions: [
|
|
430
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
431
|
+
{ field: 'payload', operator: 'matches_regex', value: '(O:\\d+:"|a:\\d+:\\{|s:\\d+:|__wakeup|__destruct|__toString)' }
|
|
432
|
+
],
|
|
433
|
+
conditionLogic: 'all',
|
|
434
|
+
actions: [
|
|
435
|
+
{ type: 'deny', message: 'PHP object injection detected - action blocked' },
|
|
436
|
+
{ type: 'notify', message: 'Security alert: PHP object injection attempt' }
|
|
437
|
+
],
|
|
438
|
+
riskWeight: 85,
|
|
439
|
+
tags: ['deserialization', 'owasp', 'a08-integrity', 'php']
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
id: 'sec-082',
|
|
443
|
+
name: 'Insecure Deserialization Prevention - Python Pickle',
|
|
444
|
+
description: 'Detects Python pickle deserialization attacks',
|
|
445
|
+
type: 'security',
|
|
446
|
+
enabled: true,
|
|
447
|
+
priority: 985,
|
|
448
|
+
conditions: [
|
|
449
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
450
|
+
{ field: 'payload', operator: 'matches_regex', value: '(cos\\nsystem|posix\\nsystem|__reduce__|\\x80\\x04)' }
|
|
451
|
+
],
|
|
452
|
+
conditionLogic: 'all',
|
|
453
|
+
actions: [
|
|
454
|
+
{ type: 'deny', message: 'Python deserialization attack detected - action blocked' },
|
|
455
|
+
{ type: 'notify', message: 'Security alert: Python deserialization attempt' }
|
|
456
|
+
],
|
|
457
|
+
riskWeight: 85,
|
|
458
|
+
tags: ['deserialization', 'owasp', 'a08-integrity', 'python']
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: 'sec-083',
|
|
462
|
+
name: 'Insecure Deserialization Prevention - .NET',
|
|
463
|
+
description: 'Detects .NET deserialization attacks',
|
|
464
|
+
type: 'security',
|
|
465
|
+
enabled: true,
|
|
466
|
+
priority: 985,
|
|
467
|
+
conditions: [
|
|
468
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
469
|
+
{ field: 'payload', operator: 'matches_regex', value: '(BinaryFormatter|ObjectStateFormatter|SoapFormatter|NetDataContractSerializer|LosFormatter)' }
|
|
470
|
+
],
|
|
471
|
+
conditionLogic: 'all',
|
|
472
|
+
actions: [
|
|
473
|
+
{ type: 'deny', message: '.NET deserialization attack detected - action blocked' },
|
|
474
|
+
{ type: 'notify', message: 'Security alert: .NET deserialization attack attempt' }
|
|
475
|
+
],
|
|
476
|
+
riskWeight: 85,
|
|
477
|
+
tags: ['deserialization', 'owasp', 'a08-integrity', 'dotnet']
|
|
478
|
+
},
|
|
479
|
+
// ============================================================================
|
|
480
|
+
// OWASP TOP 10 - XXE (A05:2021 - Security Misconfiguration)
|
|
481
|
+
// ============================================================================
|
|
482
|
+
{
|
|
483
|
+
id: 'sec-090',
|
|
484
|
+
name: 'XXE Prevention - External Entity',
|
|
485
|
+
description: 'Detects XML External Entity injection attacks',
|
|
486
|
+
type: 'security',
|
|
487
|
+
enabled: true,
|
|
488
|
+
priority: 995,
|
|
489
|
+
conditions: [
|
|
490
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_access', 'data_modification'] },
|
|
491
|
+
{ field: 'payload', operator: 'matches_regex', value: '(<!ENTITY|<!DOCTYPE.*\\[|SYSTEM\\s+["\']|PUBLIC\\s+["\'])' }
|
|
492
|
+
],
|
|
493
|
+
conditionLogic: 'all',
|
|
494
|
+
actions: [
|
|
495
|
+
{ type: 'deny', message: 'XXE attack detected - external entity declaration blocked' },
|
|
496
|
+
{ type: 'notify', message: 'Security alert: XXE injection attempt detected' }
|
|
497
|
+
],
|
|
498
|
+
riskWeight: 85,
|
|
499
|
+
tags: ['xxe', 'owasp', 'a05-misconfiguration', 'xml']
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
id: 'sec-091',
|
|
503
|
+
name: 'XXE Prevention - Parameter Entity',
|
|
504
|
+
description: 'Detects XXE parameter entity attacks',
|
|
505
|
+
type: 'security',
|
|
506
|
+
enabled: true,
|
|
507
|
+
priority: 990,
|
|
508
|
+
conditions: [
|
|
509
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_access', 'data_modification'] },
|
|
510
|
+
{ field: 'payload', operator: 'matches_regex', value: '(%[a-zA-Z0-9]+;|<!ENTITY\\s+%\\s+)' }
|
|
511
|
+
],
|
|
512
|
+
conditionLogic: 'all',
|
|
513
|
+
actions: [
|
|
514
|
+
{ type: 'deny', message: 'XXE parameter entity attack detected - action blocked' },
|
|
515
|
+
{ type: 'notify', message: 'Security alert: XXE parameter entity attempt' }
|
|
516
|
+
],
|
|
517
|
+
riskWeight: 80,
|
|
518
|
+
tags: ['xxe', 'owasp', 'a05-misconfiguration', 'xml']
|
|
519
|
+
},
|
|
520
|
+
// ============================================================================
|
|
521
|
+
// OWASP TOP 10 - OPEN REDIRECTS (A01:2021 - Broken Access Control)
|
|
522
|
+
// ============================================================================
|
|
523
|
+
{
|
|
524
|
+
id: 'sec-100',
|
|
525
|
+
name: 'Open Redirect Prevention',
|
|
526
|
+
description: 'Detects and blocks open redirect vulnerabilities',
|
|
527
|
+
type: 'security',
|
|
528
|
+
enabled: true,
|
|
529
|
+
priority: 920,
|
|
530
|
+
conditions: [
|
|
531
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
532
|
+
{ field: 'redirectUrl', operator: 'matches_regex', value: '^(https?://|//|\\\\\\\\)(?!localhost|127\\.0\\.0\\.1)' },
|
|
533
|
+
{ field: 'redirectValidated', operator: 'not_equals', value: true }
|
|
534
|
+
],
|
|
535
|
+
conditionLogic: 'all',
|
|
536
|
+
actions: [
|
|
537
|
+
{ type: 'deny', message: 'Open redirect detected - external redirect not allowed' },
|
|
538
|
+
{ type: 'notify', message: 'Security alert: Open redirect attempt detected' }
|
|
539
|
+
],
|
|
540
|
+
riskWeight: 60,
|
|
541
|
+
tags: ['open-redirect', 'owasp', 'a01-broken-access-control']
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
id: 'sec-101',
|
|
545
|
+
name: 'Open Redirect Prevention - JavaScript Protocol',
|
|
546
|
+
description: 'Blocks javascript: protocol in redirects',
|
|
547
|
+
type: 'security',
|
|
548
|
+
enabled: true,
|
|
549
|
+
priority: 950,
|
|
550
|
+
conditions: [
|
|
551
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
552
|
+
{ field: 'redirectUrl', operator: 'matches_regex', value: '(javascript:|data:|vbscript:)' }
|
|
553
|
+
],
|
|
554
|
+
conditionLogic: 'all',
|
|
555
|
+
actions: [
|
|
556
|
+
{ type: 'deny', message: 'Dangerous protocol in redirect URL blocked' },
|
|
557
|
+
{ type: 'notify', message: 'Security alert: JavaScript protocol redirect attempt' }
|
|
558
|
+
],
|
|
559
|
+
riskWeight: 75,
|
|
560
|
+
tags: ['open-redirect', 'owasp', 'xss', 'a01-broken-access-control']
|
|
561
|
+
},
|
|
562
|
+
// ============================================================================
|
|
563
|
+
// OWASP TOP 10 - MASS ASSIGNMENT (A01:2021 - Broken Access Control)
|
|
564
|
+
// ============================================================================
|
|
565
|
+
{
|
|
566
|
+
id: 'sec-110',
|
|
567
|
+
name: 'Mass Assignment Prevention - Admin Fields',
|
|
568
|
+
description: 'Blocks mass assignment of admin/privileged fields',
|
|
569
|
+
type: 'security',
|
|
570
|
+
enabled: true,
|
|
571
|
+
priority: 960,
|
|
572
|
+
conditions: [
|
|
573
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
574
|
+
{ field: 'assignedFields', operator: 'contains', value: 'isAdmin' }
|
|
575
|
+
],
|
|
576
|
+
conditionLogic: 'all',
|
|
577
|
+
actions: [
|
|
578
|
+
{ type: 'deny', message: 'Mass assignment blocked - cannot assign admin fields directly' },
|
|
579
|
+
{ type: 'notify', message: 'Security alert: Mass assignment attempt on admin field' }
|
|
580
|
+
],
|
|
581
|
+
riskWeight: 70,
|
|
582
|
+
tags: ['mass-assignment', 'owasp', 'a01-broken-access-control']
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
id: 'sec-111',
|
|
586
|
+
name: 'Mass Assignment Prevention - Role Fields',
|
|
587
|
+
description: 'Blocks mass assignment of role/permission fields',
|
|
588
|
+
type: 'security',
|
|
589
|
+
enabled: true,
|
|
590
|
+
priority: 955,
|
|
591
|
+
conditions: [
|
|
592
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
593
|
+
{ field: 'assignedFields', operator: 'matches_regex', value: '(role|permission|privilege|access_level|is_superuser|is_staff)' }
|
|
594
|
+
],
|
|
595
|
+
conditionLogic: 'all',
|
|
596
|
+
actions: [
|
|
597
|
+
{ type: 'deny', message: 'Mass assignment blocked - cannot assign role/permission fields directly' },
|
|
598
|
+
{ type: 'notify', message: 'Security alert: Mass assignment attempt on role field' }
|
|
599
|
+
],
|
|
600
|
+
riskWeight: 70,
|
|
601
|
+
tags: ['mass-assignment', 'owasp', 'a01-broken-access-control']
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
id: 'sec-112',
|
|
605
|
+
name: 'Mass Assignment Prevention - Sensitive Fields',
|
|
606
|
+
description: 'Blocks mass assignment of password and sensitive fields',
|
|
607
|
+
type: 'security',
|
|
608
|
+
enabled: true,
|
|
609
|
+
priority: 965,
|
|
610
|
+
conditions: [
|
|
611
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
612
|
+
{ field: 'assignedFields', operator: 'matches_regex', value: '(password|password_hash|secret|api_key|token|credit_card|ssn|account_number)' }
|
|
613
|
+
],
|
|
614
|
+
conditionLogic: 'all',
|
|
615
|
+
actions: [
|
|
616
|
+
{ type: 'deny', message: 'Mass assignment blocked - cannot assign sensitive fields directly' },
|
|
617
|
+
{ type: 'notify', message: 'Security alert: Mass assignment attempt on sensitive field' }
|
|
618
|
+
],
|
|
619
|
+
riskWeight: 80,
|
|
620
|
+
tags: ['mass-assignment', 'owasp', 'a01-broken-access-control', 'pii']
|
|
621
|
+
},
|
|
622
|
+
// ============================================================================
|
|
623
|
+
// OWASP TOP 10 - BROKEN ACCESS CONTROL (A01:2021)
|
|
624
|
+
// ============================================================================
|
|
625
|
+
{
|
|
626
|
+
id: 'sec-120',
|
|
627
|
+
name: 'IDOR Prevention - Direct Object Reference',
|
|
628
|
+
description: 'Detects insecure direct object reference patterns',
|
|
629
|
+
type: 'security',
|
|
630
|
+
enabled: true,
|
|
631
|
+
priority: 940,
|
|
632
|
+
conditions: [
|
|
633
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_access' },
|
|
634
|
+
{ field: 'objectId', operator: 'exists', value: null },
|
|
635
|
+
{ field: 'ownershipVerified', operator: 'not_equals', value: true }
|
|
636
|
+
],
|
|
637
|
+
conditionLogic: 'all',
|
|
638
|
+
actions: [
|
|
639
|
+
{ type: 'require_approval', message: 'Direct object access requires ownership verification' },
|
|
640
|
+
{ type: 'warn', message: 'IDOR risk: Ensure object ownership is verified' }
|
|
641
|
+
],
|
|
642
|
+
riskWeight: 55,
|
|
643
|
+
tags: ['idor', 'owasp', 'a01-broken-access-control']
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
id: 'sec-121',
|
|
647
|
+
name: 'Horizontal Privilege Escalation Prevention',
|
|
648
|
+
description: 'Blocks access to resources owned by other users',
|
|
649
|
+
type: 'security',
|
|
650
|
+
enabled: true,
|
|
651
|
+
priority: 970,
|
|
652
|
+
conditions: [
|
|
653
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_access', 'data_modification'] },
|
|
654
|
+
{ field: 'resourceOwnerId', operator: 'not_equals', value: '@userId' },
|
|
655
|
+
{ field: 'userRole', operator: 'not_in', value: ['admin', 'superuser'] }
|
|
656
|
+
],
|
|
657
|
+
conditionLogic: 'all',
|
|
658
|
+
actions: [
|
|
659
|
+
{ type: 'deny', message: 'Access denied - resource belongs to another user' },
|
|
660
|
+
{ type: 'notify', message: 'Security alert: Horizontal privilege escalation attempt' }
|
|
661
|
+
],
|
|
662
|
+
riskWeight: 65,
|
|
663
|
+
tags: ['privilege-escalation', 'owasp', 'a01-broken-access-control']
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
id: 'sec-122',
|
|
667
|
+
name: 'Force Browsing Prevention',
|
|
668
|
+
description: 'Blocks access to unauthorized admin/system endpoints',
|
|
669
|
+
type: 'security',
|
|
670
|
+
enabled: true,
|
|
671
|
+
priority: 950,
|
|
672
|
+
conditions: [
|
|
673
|
+
{ field: 'actionCategory', operator: 'equals', value: 'network' },
|
|
674
|
+
{ field: 'targetUrl', operator: 'matches_regex', value: '(/admin|/management|/console|/debug|/actuator|/swagger|/api-docs)' },
|
|
675
|
+
{ field: 'userRole', operator: 'not_in', value: ['admin', 'developer'] }
|
|
676
|
+
],
|
|
677
|
+
conditionLogic: 'all',
|
|
678
|
+
actions: [
|
|
679
|
+
{ type: 'deny', message: 'Access to admin endpoints denied - insufficient privileges' },
|
|
680
|
+
{ type: 'notify', message: 'Security alert: Unauthorized admin endpoint access attempt' }
|
|
681
|
+
],
|
|
682
|
+
riskWeight: 60,
|
|
683
|
+
tags: ['force-browsing', 'owasp', 'a01-broken-access-control']
|
|
684
|
+
},
|
|
685
|
+
// ============================================================================
|
|
686
|
+
// OWASP TOP 10 - CRYPTOGRAPHIC FAILURES (A02:2021)
|
|
687
|
+
// ============================================================================
|
|
688
|
+
{
|
|
689
|
+
id: 'sec-130',
|
|
690
|
+
name: 'Weak Cryptography Detection - MD5/SHA1',
|
|
691
|
+
description: 'Detects use of weak cryptographic algorithms',
|
|
692
|
+
type: 'security',
|
|
693
|
+
enabled: true,
|
|
694
|
+
priority: 900,
|
|
695
|
+
conditions: [
|
|
696
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_access', 'data_modification', 'authentication'] },
|
|
697
|
+
{ field: 'algorithm', operator: 'in', value: ['md5', 'sha1', 'des', '3des', 'rc4', 'rc2'] }
|
|
698
|
+
],
|
|
699
|
+
conditionLogic: 'all',
|
|
700
|
+
actions: [
|
|
701
|
+
{ type: 'warn', message: 'Weak cryptographic algorithm detected - use SHA-256 or stronger' },
|
|
702
|
+
{ type: 'log' }
|
|
703
|
+
],
|
|
704
|
+
riskWeight: 45,
|
|
705
|
+
tags: ['cryptography', 'owasp', 'a02-crypto-failures']
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
id: 'sec-131',
|
|
709
|
+
name: 'Hardcoded Secrets Detection',
|
|
710
|
+
description: 'Detects hardcoded secrets, passwords, and API keys',
|
|
711
|
+
type: 'security',
|
|
712
|
+
enabled: true,
|
|
713
|
+
priority: 980,
|
|
714
|
+
conditions: [
|
|
715
|
+
{ field: 'actionCategory', operator: 'equals', value: 'code_execution' },
|
|
716
|
+
{ field: 'code', operator: 'matches_regex', value: '(password\\s*=\\s*["\'][^"\']+["\']|api[_-]?key\\s*=\\s*["\'][^"\']+["\']|secret\\s*=\\s*["\'][^"\']+["\']|-----BEGIN (RSA |DSA |EC )?PRIVATE KEY-----)' }
|
|
717
|
+
],
|
|
718
|
+
conditionLogic: 'all',
|
|
719
|
+
actions: [
|
|
720
|
+
{ type: 'deny', message: 'Hardcoded secret detected - use environment variables or secret management' },
|
|
721
|
+
{ type: 'notify', message: 'Security alert: Hardcoded secret detected in code' }
|
|
722
|
+
],
|
|
723
|
+
riskWeight: 75,
|
|
724
|
+
tags: ['secrets', 'owasp', 'a02-crypto-failures']
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
id: 'sec-132',
|
|
728
|
+
name: 'Insufficient Key Length Detection',
|
|
729
|
+
description: 'Detects cryptographic keys that are too short',
|
|
730
|
+
type: 'security',
|
|
731
|
+
enabled: true,
|
|
732
|
+
priority: 890,
|
|
733
|
+
conditions: [
|
|
734
|
+
{ field: 'actionCategory', operator: 'in', value: ['authentication', 'data_modification'] },
|
|
735
|
+
{ field: 'keyLength', operator: 'less_than', value: 2048 },
|
|
736
|
+
{ field: 'algorithm', operator: 'in', value: ['rsa', 'dsa'] }
|
|
737
|
+
],
|
|
738
|
+
conditionLogic: 'all',
|
|
739
|
+
actions: [
|
|
740
|
+
{ type: 'warn', message: 'Cryptographic key length too short - use at least 2048 bits for RSA/DSA' },
|
|
741
|
+
{ type: 'log' }
|
|
742
|
+
],
|
|
743
|
+
riskWeight: 40,
|
|
744
|
+
tags: ['cryptography', 'owasp', 'a02-crypto-failures']
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
id: 'sec-133',
|
|
748
|
+
name: 'Insecure Random Number Generation',
|
|
749
|
+
description: 'Detects use of weak random number generators for security purposes',
|
|
750
|
+
type: 'security',
|
|
751
|
+
enabled: true,
|
|
752
|
+
priority: 910,
|
|
753
|
+
conditions: [
|
|
754
|
+
{ field: 'actionCategory', operator: 'in', value: ['authentication', 'code_execution'] },
|
|
755
|
+
{ field: 'randomGenerator', operator: 'in', value: ['Math.random', 'random.random', 'rand', 'srand'] },
|
|
756
|
+
{ field: 'securityContext', operator: 'equals', value: true }
|
|
757
|
+
],
|
|
758
|
+
conditionLogic: 'all',
|
|
759
|
+
actions: [
|
|
760
|
+
{ type: 'warn', message: 'Weak random number generator used in security context - use cryptographically secure RNG' },
|
|
761
|
+
{ type: 'log' }
|
|
762
|
+
],
|
|
763
|
+
riskWeight: 50,
|
|
764
|
+
tags: ['cryptography', 'owasp', 'a02-crypto-failures']
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
id: 'sec-134',
|
|
768
|
+
name: 'Unencrypted Sensitive Data Storage',
|
|
769
|
+
description: 'Detects storage of sensitive data without encryption',
|
|
770
|
+
type: 'security',
|
|
771
|
+
enabled: true,
|
|
772
|
+
priority: 920,
|
|
773
|
+
conditions: [
|
|
774
|
+
{ field: 'actionCategory', operator: 'equals', value: 'data_modification' },
|
|
775
|
+
{ field: 'dataClassification', operator: 'in', value: ['confidential', 'restricted'] },
|
|
776
|
+
{ field: 'encrypted', operator: 'not_equals', value: true }
|
|
777
|
+
],
|
|
778
|
+
conditionLogic: 'all',
|
|
779
|
+
actions: [
|
|
780
|
+
{ type: 'require_approval', message: 'Storing sensitive data without encryption requires approval' },
|
|
781
|
+
{ type: 'warn', message: 'Sensitive data should be encrypted at rest' }
|
|
782
|
+
],
|
|
783
|
+
riskWeight: 55,
|
|
784
|
+
tags: ['encryption', 'owasp', 'a02-crypto-failures', 'data-protection']
|
|
785
|
+
},
|
|
786
|
+
// ============================================================================
|
|
787
|
+
// OWASP TOP 10 - XSS (A03:2021 - Injection)
|
|
788
|
+
// ============================================================================
|
|
789
|
+
{
|
|
790
|
+
id: 'sec-140',
|
|
791
|
+
name: 'XSS Prevention - Script Tags',
|
|
792
|
+
description: 'Detects script tag injection attempts',
|
|
793
|
+
type: 'security',
|
|
794
|
+
enabled: true,
|
|
795
|
+
priority: 990,
|
|
796
|
+
conditions: [
|
|
797
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_modification', 'user_communication'] },
|
|
798
|
+
{ field: 'payload', operator: 'matches_regex', value: '(<script|<\\/script|javascript:|on\\w+\\s*=)' }
|
|
799
|
+
],
|
|
800
|
+
conditionLogic: 'all',
|
|
801
|
+
actions: [
|
|
802
|
+
{ type: 'deny', message: 'XSS attack detected - script injection blocked' },
|
|
803
|
+
{ type: 'notify', message: 'Security alert: XSS injection attempt detected' }
|
|
804
|
+
],
|
|
805
|
+
riskWeight: 80,
|
|
806
|
+
tags: ['xss', 'owasp', 'a03-injection']
|
|
807
|
+
},
|
|
808
|
+
{
|
|
809
|
+
id: 'sec-141',
|
|
810
|
+
name: 'XSS Prevention - Event Handlers',
|
|
811
|
+
description: 'Detects event handler injection attempts',
|
|
812
|
+
type: 'security',
|
|
813
|
+
enabled: true,
|
|
814
|
+
priority: 985,
|
|
815
|
+
conditions: [
|
|
816
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_modification', 'user_communication'] },
|
|
817
|
+
{ field: 'payload', operator: 'matches_regex', value: '(onerror|onload|onclick|onmouseover|onfocus|onblur|onchange|onsubmit)\\s*=' }
|
|
818
|
+
],
|
|
819
|
+
conditionLogic: 'all',
|
|
820
|
+
actions: [
|
|
821
|
+
{ type: 'deny', message: 'XSS attack detected - event handler injection blocked' },
|
|
822
|
+
{ type: 'notify', message: 'Security alert: XSS event handler injection attempt' }
|
|
823
|
+
],
|
|
824
|
+
riskWeight: 75,
|
|
825
|
+
tags: ['xss', 'owasp', 'a03-injection']
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
id: 'sec-142',
|
|
829
|
+
name: 'XSS Prevention - Data URI',
|
|
830
|
+
description: 'Detects data URI XSS injection attempts',
|
|
831
|
+
type: 'security',
|
|
832
|
+
enabled: true,
|
|
833
|
+
priority: 980,
|
|
834
|
+
conditions: [
|
|
835
|
+
{ field: 'actionCategory', operator: 'in', value: ['data_modification', 'user_communication'] },
|
|
836
|
+
{ field: 'payload', operator: 'matches_regex', value: 'data:\\s*(text\\/html|application\\/javascript|text\\/javascript)' }
|
|
837
|
+
],
|
|
838
|
+
conditionLogic: 'all',
|
|
839
|
+
actions: [
|
|
840
|
+
{ type: 'deny', message: 'XSS attack detected - data URI injection blocked' },
|
|
841
|
+
{ type: 'notify', message: 'Security alert: XSS data URI injection attempt' }
|
|
842
|
+
],
|
|
843
|
+
riskWeight: 70,
|
|
844
|
+
tags: ['xss', 'owasp', 'a03-injection']
|
|
845
|
+
}
|
|
846
|
+
];
|
|
847
|
+
export default securityRules;
|
|
848
|
+
//# sourceMappingURL=security.js.map
|