snow-flow 8.41.0 → 8.41.2
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/CLAUDE.md +11 -8
- package/package.json +1 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.d.ts +0 -15
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.d.ts.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.js +0 -393
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.js.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_sync.d.ts +0 -15
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_sync.d.ts.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_sync.js +0 -267
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_sync.js.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_with_output.d.ts +0 -15
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_with_output.d.ts.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_with_output.js +0 -311
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_with_output.js.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_deploy.d.ts +0 -12
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_deploy.d.ts.map +0 -1
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_deploy.js +0 -375
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_deploy.js.map +0 -1
package/CLAUDE.md
CHANGED
|
@@ -171,7 +171,7 @@ console.log(`✅ Created Update Set: ${updateSet.name} (sys_id: ${updateSet.sys_
|
|
|
171
171
|
|
|
172
172
|
```javascript
|
|
173
173
|
// ✅ CORRECT - Verify first
|
|
174
|
-
const tableCheck = await
|
|
174
|
+
const tableCheck = await snow_execute_script({
|
|
175
175
|
script: `
|
|
176
176
|
var gr = new GlideRecord('u_custom_table');
|
|
177
177
|
gs.info('Table exists: ' + gr.isValid());
|
|
@@ -179,7 +179,8 @@ const tableCheck = await snow_execute_script_with_output({
|
|
|
179
179
|
gr.query();
|
|
180
180
|
gs.info('Record count: ' + gr.getRowCount());
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
`,
|
|
183
|
+
description: 'Verify custom table exists'
|
|
183
184
|
});
|
|
184
185
|
|
|
185
186
|
// ❌ WRONG - Assuming
|
|
@@ -574,7 +575,7 @@ function($scope) {
|
|
|
574
575
|
| Create Client Script | `snow_create_client_script()` |
|
|
575
576
|
| Query Incidents | `snow_query_incidents()` |
|
|
576
577
|
| Query Any Table | `snow_query_table()` |
|
|
577
|
-
| Execute Script | `
|
|
578
|
+
| Execute Script | `snow_execute_script()` |
|
|
578
579
|
| Pull Widget to Local | `snow_pull_artifact()` |
|
|
579
580
|
| Push Widget to Instance | `snow_push_artifact()` |
|
|
580
581
|
| Get Instance Info | `snow_get_instance_info()` |
|
|
@@ -621,9 +622,10 @@ await snow_create_ui_page({
|
|
|
621
622
|
**Background scripts are for VERIFICATION ONLY, not creating artifacts!**
|
|
622
623
|
|
|
623
624
|
```javascript
|
|
624
|
-
// ❌ WRONG
|
|
625
|
-
await
|
|
626
|
-
script: `var gr = new GlideRecord('sys_script'); gr.insert()
|
|
625
|
+
// ❌ WRONG - Using script execution to create artifacts
|
|
626
|
+
await snow_execute_script({
|
|
627
|
+
script: `var gr = new GlideRecord('sys_script'); gr.insert();`,
|
|
628
|
+
description: 'Create business rule via script'
|
|
627
629
|
});
|
|
628
630
|
|
|
629
631
|
// ✅ CORRECT - Use dedicated tools
|
|
@@ -667,11 +669,12 @@ data.items = items;
|
|
|
667
669
|
"The table u_custom_routing doesn't exist because it's not standard."
|
|
668
670
|
|
|
669
671
|
// ✅ CORRECT - Verify first
|
|
670
|
-
const check = await
|
|
672
|
+
const check = await snow_execute_script({
|
|
671
673
|
script: `
|
|
672
674
|
var gr = new GlideRecord('u_custom_routing');
|
|
673
675
|
gs.info('Table exists: ' + gr.isValid());
|
|
674
|
-
|
|
676
|
+
`,
|
|
677
|
+
description: 'Check if custom routing table exists'
|
|
675
678
|
});
|
|
676
679
|
```
|
|
677
680
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snow-flow",
|
|
3
|
-
"version": "8.41.
|
|
3
|
+
"version": "8.41.2",
|
|
4
4
|
"description": "ServiceNow development with SnowCode - 75+ LLM providers (Claude, GPT, Gemini, Llama, Mistral, DeepSeek, Groq, Ollama) • 395 Optimized Tools • 2 MCP Servers • Multi-agent orchestration • Use ANY AI coding assistant (ML tools moved to Enterprise)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* snow_execute_background_script - Execute background scripts with user confirmation
|
|
3
|
-
*
|
|
4
|
-
* Executes JavaScript background scripts in ServiceNow using Fix Scripts.
|
|
5
|
-
* Includes security analysis and user confirmation (unless autoConfirm=true).
|
|
6
|
-
*
|
|
7
|
-
* ⚠️ CRITICAL: ALL SCRIPTS MUST BE ES5 ONLY!
|
|
8
|
-
* ServiceNow runs on Rhino engine - no const/let/arrow functions/template literals.
|
|
9
|
-
*/
|
|
10
|
-
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
11
|
-
export declare const toolDefinition: MCPToolDefinition;
|
|
12
|
-
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
13
|
-
export declare const version = "1.0.0";
|
|
14
|
-
export declare const author = "Snow-Flow SDK Migration";
|
|
15
|
-
//# sourceMappingURL=snow_execute_background_script.d.ts.map
|
package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snow_execute_background_script.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBA+C5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CA2OxF;AAqID,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* snow_execute_background_script - Execute background scripts with user confirmation
|
|
4
|
-
*
|
|
5
|
-
* Executes JavaScript background scripts in ServiceNow using Fix Scripts.
|
|
6
|
-
* Includes security analysis and user confirmation (unless autoConfirm=true).
|
|
7
|
-
*
|
|
8
|
-
* ⚠️ CRITICAL: ALL SCRIPTS MUST BE ES5 ONLY!
|
|
9
|
-
* ServiceNow runs on Rhino engine - no const/let/arrow functions/template literals.
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.author = exports.version = exports.toolDefinition = void 0;
|
|
13
|
-
exports.execute = execute;
|
|
14
|
-
const auth_js_1 = require("../../shared/auth.js");
|
|
15
|
-
const error_handler_js_1 = require("../../shared/error-handler.js");
|
|
16
|
-
exports.toolDefinition = {
|
|
17
|
-
name: 'snow_execute_background_script',
|
|
18
|
-
description: '🚨 REQUIRES USER CONFIRMATION (unless autoConfirm=true): Execute background script using Fix Scripts (ES5 only)',
|
|
19
|
-
// Metadata for tool discovery (not sent to LLM)
|
|
20
|
-
category: 'automation',
|
|
21
|
-
subcategory: 'script-execution',
|
|
22
|
-
use_cases: ['automation', 'scripts', 'execution'],
|
|
23
|
-
complexity: 'advanced',
|
|
24
|
-
frequency: 'high',
|
|
25
|
-
// Permission enforcement
|
|
26
|
-
// Classification: WRITE - Execution operation - can have side effects
|
|
27
|
-
permission: 'write',
|
|
28
|
-
allowedRoles: ['developer', 'admin'],
|
|
29
|
-
inputSchema: {
|
|
30
|
-
type: 'object',
|
|
31
|
-
properties: {
|
|
32
|
-
script: {
|
|
33
|
-
type: 'string',
|
|
34
|
-
description: '🚨 ES5 ONLY! JavaScript code (no const/let/arrows/templates - Rhino engine)'
|
|
35
|
-
},
|
|
36
|
-
description: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
description: 'Clear description of what the script does (shown to user for approval)'
|
|
39
|
-
},
|
|
40
|
-
runAsUser: {
|
|
41
|
-
type: 'string',
|
|
42
|
-
description: 'User to execute script as (optional, defaults to current user)'
|
|
43
|
-
},
|
|
44
|
-
allowDataModification: {
|
|
45
|
-
type: 'boolean',
|
|
46
|
-
description: 'Whether script is allowed to modify data',
|
|
47
|
-
default: false
|
|
48
|
-
},
|
|
49
|
-
autoConfirm: {
|
|
50
|
-
type: 'boolean',
|
|
51
|
-
description: '⚠️ DANGEROUS: Skip user confirmation and execute immediately',
|
|
52
|
-
default: false
|
|
53
|
-
},
|
|
54
|
-
timeout: {
|
|
55
|
-
type: 'number',
|
|
56
|
-
description: 'Timeout in milliseconds for polling execution results',
|
|
57
|
-
default: 30000
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
required: ['script', 'description']
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
async function execute(args, context) {
|
|
64
|
-
const { script, description, runAsUser, allowDataModification = false, autoConfirm = false, timeout = 30000 } = args;
|
|
65
|
-
try {
|
|
66
|
-
// ES5 validation
|
|
67
|
-
const es5Validation = validateES5(script);
|
|
68
|
-
if (!es5Validation.valid) {
|
|
69
|
-
throw new error_handler_js_1.SnowFlowError(error_handler_js_1.ErrorType.ES5_SYNTAX_ERROR, 'Script contains non-ES5 syntax', {
|
|
70
|
-
retryable: false,
|
|
71
|
-
details: {
|
|
72
|
-
violations: es5Validation.violations,
|
|
73
|
-
message: 'ServiceNow uses Rhino engine - ES6+ syntax will fail'
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
// Security analysis
|
|
78
|
-
const securityAnalysis = analyzeScriptSecurity(script);
|
|
79
|
-
// Auto-confirm mode - execute immediately using Fix Scripts
|
|
80
|
-
if (autoConfirm === true) {
|
|
81
|
-
const executionId = `bg_auto_${Date.now()}_${Math.random().toString(36).substring(7)}`;
|
|
82
|
-
const outputMarker = `SNOW_FLOW_BG_${executionId}`;
|
|
83
|
-
const client = await (0, auth_js_1.getAuthenticatedClient)(context);
|
|
84
|
-
// Wrap script with output capture
|
|
85
|
-
const wrappedScript = `
|
|
86
|
-
// Snow-Flow Background Script - ID: ${executionId}
|
|
87
|
-
// Description: ${description}
|
|
88
|
-
// Auto-confirmed execution
|
|
89
|
-
var __bgOutput = [];
|
|
90
|
-
var __bgStartTime = new GlideDateTime();
|
|
91
|
-
var __bgResult = null;
|
|
92
|
-
var __bgError = null;
|
|
93
|
-
|
|
94
|
-
// Capture gs methods
|
|
95
|
-
var __bgOrigPrint = gs.print;
|
|
96
|
-
var __bgOrigInfo = gs.info;
|
|
97
|
-
var __bgOrigWarn = gs.warn;
|
|
98
|
-
var __bgOrigError = gs.error;
|
|
99
|
-
|
|
100
|
-
gs.print = function(msg) { __bgOutput.push({level: 'print', msg: String(msg)}); __bgOrigPrint(msg); };
|
|
101
|
-
gs.info = function(msg) { __bgOutput.push({level: 'info', msg: String(msg)}); __bgOrigInfo(msg); };
|
|
102
|
-
gs.warn = function(msg) { __bgOutput.push({level: 'warn', msg: String(msg)}); __bgOrigWarn(msg); };
|
|
103
|
-
gs.error = function(msg) { __bgOutput.push({level: 'error', msg: String(msg)}); __bgOrigError(msg); };
|
|
104
|
-
|
|
105
|
-
try {
|
|
106
|
-
gs.info('=== Snow-Flow Background Script Started ===');
|
|
107
|
-
gs.info('Description: ${description.replace(/'/g, "\\'")}');
|
|
108
|
-
|
|
109
|
-
__bgResult = (function() {
|
|
110
|
-
${script}
|
|
111
|
-
})();
|
|
112
|
-
|
|
113
|
-
gs.info('=== Snow-Flow Background Script Completed ===');
|
|
114
|
-
} catch(e) {
|
|
115
|
-
__bgError = e.toString();
|
|
116
|
-
gs.error('Background Script Error: ' + e.toString());
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Restore gs methods
|
|
120
|
-
gs.print = __bgOrigPrint;
|
|
121
|
-
gs.info = __bgOrigInfo;
|
|
122
|
-
gs.warn = __bgOrigWarn;
|
|
123
|
-
gs.error = __bgOrigError;
|
|
124
|
-
|
|
125
|
-
// Store result
|
|
126
|
-
var __bgEndTime = new GlideDateTime();
|
|
127
|
-
var __bgExecTime = Math.abs(GlideDateTime.subtract(__bgStartTime, __bgEndTime).getNumericValue());
|
|
128
|
-
|
|
129
|
-
var __bgResultObj = {
|
|
130
|
-
executionId: '${executionId}',
|
|
131
|
-
success: __bgError === null,
|
|
132
|
-
result: __bgResult,
|
|
133
|
-
error: __bgError,
|
|
134
|
-
output: __bgOutput,
|
|
135
|
-
executionTimeMs: __bgExecTime,
|
|
136
|
-
description: '${description.replace(/'/g, "\\'")}'
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
gs.setProperty('${outputMarker}', JSON.stringify(__bgResultObj));
|
|
140
|
-
gs.info('${outputMarker}:COMPLETE');
|
|
141
|
-
`;
|
|
142
|
-
// Create Scheduled Script Job
|
|
143
|
-
const jobName = `Snow-Flow BG Script - ${executionId}`;
|
|
144
|
-
const createResponse = await client.post('/api/now/table/sysauto_script', {
|
|
145
|
-
name: jobName,
|
|
146
|
-
script: wrappedScript,
|
|
147
|
-
active: true,
|
|
148
|
-
run_type: 'on_demand',
|
|
149
|
-
conditional: false
|
|
150
|
-
});
|
|
151
|
-
if (!createResponse.data?.result?.sys_id) {
|
|
152
|
-
throw new error_handler_js_1.SnowFlowError(error_handler_js_1.ErrorType.SERVICENOW_API_ERROR, 'Failed to create scheduled script job for background execution', { details: createResponse.data });
|
|
153
|
-
}
|
|
154
|
-
const jobSysId = createResponse.data.result.sys_id;
|
|
155
|
-
// Create sys_trigger to execute immediately
|
|
156
|
-
const now = new Date();
|
|
157
|
-
const triggerTime = new Date(now.getTime() + 2000); // 2 seconds from now
|
|
158
|
-
const triggerTimeStr = triggerTime.toISOString().replace('T', ' ').substring(0, 19);
|
|
159
|
-
try {
|
|
160
|
-
await client.post('/api/now/table/sys_trigger', {
|
|
161
|
-
name: jobName,
|
|
162
|
-
next_action: triggerTimeStr,
|
|
163
|
-
trigger_type: 0, // Run Once
|
|
164
|
-
state: 0, // Ready
|
|
165
|
-
document: 'sysauto_script',
|
|
166
|
-
document_key: jobSysId,
|
|
167
|
-
claimed_by: '',
|
|
168
|
-
system_id: 'snow-flow'
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
catch (triggerError) {
|
|
172
|
-
// If trigger creation fails, job won't auto-execute
|
|
173
|
-
}
|
|
174
|
-
// Poll for execution results
|
|
175
|
-
const startTime = Date.now();
|
|
176
|
-
let result = null;
|
|
177
|
-
let attempts = 0;
|
|
178
|
-
const maxAttempts = Math.ceil(timeout / 2000);
|
|
179
|
-
while (Date.now() - startTime < timeout && attempts < maxAttempts) {
|
|
180
|
-
attempts++;
|
|
181
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
182
|
-
try {
|
|
183
|
-
const propResponse = await client.get('/api/now/table/sys_properties', {
|
|
184
|
-
params: {
|
|
185
|
-
sysparm_query: `name=${outputMarker}`,
|
|
186
|
-
sysparm_fields: 'value,sys_id',
|
|
187
|
-
sysparm_limit: 1
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
if (propResponse.data?.result?.[0]?.value) {
|
|
191
|
-
try {
|
|
192
|
-
result = JSON.parse(propResponse.data.result[0].value);
|
|
193
|
-
// Cleanup property
|
|
194
|
-
const propSysId = propResponse.data.result[0].sys_id;
|
|
195
|
-
if (propSysId) {
|
|
196
|
-
await client.delete(`/api/now/table/sys_properties/${propSysId}`).catch(() => { });
|
|
197
|
-
}
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
catch (parseErr) {
|
|
201
|
-
// Continue polling
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch (pollError) {
|
|
206
|
-
// Continue polling
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
// Cleanup scheduled job
|
|
210
|
-
try {
|
|
211
|
-
await client.delete(`/api/now/table/sysauto_script/${jobSysId}`);
|
|
212
|
-
}
|
|
213
|
-
catch (cleanupError) {
|
|
214
|
-
// Ignore
|
|
215
|
-
}
|
|
216
|
-
if (result) {
|
|
217
|
-
return (0, error_handler_js_1.createSuccessResult)({
|
|
218
|
-
executed: true,
|
|
219
|
-
execution_id: executionId,
|
|
220
|
-
success: result.success,
|
|
221
|
-
result: result.result,
|
|
222
|
-
error: result.error,
|
|
223
|
-
output: result.output,
|
|
224
|
-
execution_time_ms: result.executionTimeMs,
|
|
225
|
-
auto_confirmed: true,
|
|
226
|
-
security_analysis: securityAnalysis
|
|
227
|
-
}, {
|
|
228
|
-
method: 'sysauto_script_with_trigger',
|
|
229
|
-
description
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
return (0, error_handler_js_1.createSuccessResult)({
|
|
234
|
-
executed: false,
|
|
235
|
-
execution_id: executionId,
|
|
236
|
-
scheduled_job_sys_id: jobSysId,
|
|
237
|
-
auto_confirmed: true,
|
|
238
|
-
security_analysis: securityAnalysis,
|
|
239
|
-
message: 'Script was saved as scheduled job but automatic execution could not be confirmed. The sys_trigger may not have been created (permissions) or the scheduler has not yet picked it up.',
|
|
240
|
-
action_required: `Navigate to System Scheduler > Scheduled Jobs and run: ${jobName}`
|
|
241
|
-
}, {
|
|
242
|
-
method: 'scheduled_job_pending',
|
|
243
|
-
description
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
// Standard mode - return confirmation request
|
|
248
|
-
const confirmationPrompt = generateConfirmationPrompt({
|
|
249
|
-
script,
|
|
250
|
-
description,
|
|
251
|
-
runAsUser,
|
|
252
|
-
allowDataModification,
|
|
253
|
-
securityAnalysis
|
|
254
|
-
});
|
|
255
|
-
return (0, error_handler_js_1.createSuccessResult)({
|
|
256
|
-
requires_confirmation: true,
|
|
257
|
-
confirmation_prompt: confirmationPrompt,
|
|
258
|
-
script_to_execute: script,
|
|
259
|
-
execution_context: {
|
|
260
|
-
runAsUser: runAsUser || 'current',
|
|
261
|
-
allowDataModification,
|
|
262
|
-
securityLevel: securityAnalysis.riskLevel
|
|
263
|
-
}
|
|
264
|
-
}, {
|
|
265
|
-
action_required: 'User must approve script execution via snow_confirm_script_execution'
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
catch (error) {
|
|
269
|
-
return (0, error_handler_js_1.createErrorResult)(error instanceof error_handler_js_1.SnowFlowError
|
|
270
|
-
? error
|
|
271
|
-
: new error_handler_js_1.SnowFlowError(error_handler_js_1.ErrorType.UNKNOWN_ERROR, error.message, { originalError: error }));
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
function validateES5(code) {
|
|
275
|
-
const violations = [];
|
|
276
|
-
const patterns = [
|
|
277
|
-
{ regex: /\b(const|let)\s+/g, type: 'const/let', fix: "Use 'var'" },
|
|
278
|
-
{ regex: /\([^)]*\)\s*=>/g, type: 'arrow_function', fix: 'Use function() {}' },
|
|
279
|
-
{ regex: /`[^`]*`/g, type: 'template_literal', fix: 'Use string concatenation' },
|
|
280
|
-
{ regex: /\{[^}]+\}\s*=\s*/g, type: 'destructuring', fix: 'Use explicit properties' },
|
|
281
|
-
{ regex: /for\s*\([^)]*\s+of\s+/g, type: 'for_of', fix: 'Use traditional for loop' },
|
|
282
|
-
{ regex: /class\s+\w+/g, type: 'class', fix: 'Use function constructor' }
|
|
283
|
-
];
|
|
284
|
-
patterns.forEach(({ regex, type, fix }) => {
|
|
285
|
-
let match;
|
|
286
|
-
while ((match = regex.exec(code)) !== null) {
|
|
287
|
-
violations.push({
|
|
288
|
-
type,
|
|
289
|
-
line: code.substring(0, match.index).split('\n').length,
|
|
290
|
-
code: match[0],
|
|
291
|
-
fix
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
return { valid: violations.length === 0, violations };
|
|
296
|
-
}
|
|
297
|
-
function analyzeScriptSecurity(script) {
|
|
298
|
-
const analysis = {
|
|
299
|
-
riskLevel: 'LOW',
|
|
300
|
-
warnings: [],
|
|
301
|
-
dataOperations: [],
|
|
302
|
-
systemAccess: []
|
|
303
|
-
};
|
|
304
|
-
const dataModificationPatterns = [
|
|
305
|
-
/\.insert\(\)/gi,
|
|
306
|
-
/\.update\(\)/gi,
|
|
307
|
-
/\.deleteRecord\(\)/gi,
|
|
308
|
-
/\.setValue\(/gi
|
|
309
|
-
];
|
|
310
|
-
const systemAccessPatterns = [
|
|
311
|
-
/gs\.getUser\(\)/gi,
|
|
312
|
-
/gs\.getUserID\(\)/gi,
|
|
313
|
-
/gs\.hasRole\(/gi,
|
|
314
|
-
/gs\.executeNow\(/gi
|
|
315
|
-
];
|
|
316
|
-
const dangerousPatterns = [
|
|
317
|
-
/eval\(/gi,
|
|
318
|
-
/new Function\(/gi,
|
|
319
|
-
/\.setWorkflow\(/gi
|
|
320
|
-
];
|
|
321
|
-
dataModificationPatterns.forEach(pattern => {
|
|
322
|
-
const matches = script.match(pattern);
|
|
323
|
-
if (matches) {
|
|
324
|
-
analysis.dataOperations.push(...matches);
|
|
325
|
-
if (analysis.riskLevel === 'LOW')
|
|
326
|
-
analysis.riskLevel = 'MEDIUM';
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
systemAccessPatterns.forEach(pattern => {
|
|
330
|
-
const matches = script.match(pattern);
|
|
331
|
-
if (matches) {
|
|
332
|
-
analysis.systemAccess.push(...matches);
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
dangerousPatterns.forEach(pattern => {
|
|
336
|
-
const matches = script.match(pattern);
|
|
337
|
-
if (matches) {
|
|
338
|
-
analysis.warnings.push(`Potentially dangerous operation detected: ${matches[0]}`);
|
|
339
|
-
analysis.riskLevel = 'HIGH';
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
if (script.includes('while') && (script.includes('.next()') || script.includes('.hasNext()'))) {
|
|
343
|
-
analysis.warnings.push('Script contains loops that may process many records');
|
|
344
|
-
if (analysis.riskLevel === 'LOW')
|
|
345
|
-
analysis.riskLevel = 'MEDIUM';
|
|
346
|
-
}
|
|
347
|
-
return analysis;
|
|
348
|
-
}
|
|
349
|
-
function generateConfirmationPrompt(context) {
|
|
350
|
-
const { script, description, runAsUser, allowDataModification, securityAnalysis } = context;
|
|
351
|
-
const riskEmoji = {
|
|
352
|
-
'LOW': '🟢',
|
|
353
|
-
'MEDIUM': '🟡',
|
|
354
|
-
'HIGH': '🔴'
|
|
355
|
-
}[securityAnalysis.riskLevel] || '⚪';
|
|
356
|
-
return `
|
|
357
|
-
🚨 BACKGROUND SCRIPT EXECUTION REQUEST
|
|
358
|
-
|
|
359
|
-
📋 **Description:** ${description}
|
|
360
|
-
|
|
361
|
-
${riskEmoji} **Security Risk Level:** ${securityAnalysis.riskLevel}
|
|
362
|
-
|
|
363
|
-
👤 **Run as User:** ${runAsUser || 'Current User'}
|
|
364
|
-
📝 **Data Modification:** ${allowDataModification ? '✅ ALLOWED' : '❌ READ-ONLY'}
|
|
365
|
-
|
|
366
|
-
🔍 **Script Analysis:**
|
|
367
|
-
${securityAnalysis.dataOperations.length > 0 ?
|
|
368
|
-
`📊 Data Operations Detected: ${securityAnalysis.dataOperations.join(', ')}` : ''}
|
|
369
|
-
${securityAnalysis.systemAccess.length > 0 ?
|
|
370
|
-
`🔧 System Access: ${securityAnalysis.systemAccess.join(', ')}` : ''}
|
|
371
|
-
${securityAnalysis.warnings.length > 0 ?
|
|
372
|
-
`⚠️ Warnings: ${securityAnalysis.warnings.join(', ')}` : ''}
|
|
373
|
-
|
|
374
|
-
📜 **Script to Execute:**
|
|
375
|
-
\`\`\`javascript
|
|
376
|
-
${script}
|
|
377
|
-
\`\`\`
|
|
378
|
-
|
|
379
|
-
⚡ **Impact:** This script will run in ServiceNow's server-side JavaScript context with full API access.
|
|
380
|
-
|
|
381
|
-
❓ **Do you want to proceed with executing this script?**
|
|
382
|
-
|
|
383
|
-
Reply with:
|
|
384
|
-
- ✅ **YES** - Execute the script
|
|
385
|
-
- ❌ **NO** - Cancel execution
|
|
386
|
-
- 📝 **MODIFY** - Make changes before execution
|
|
387
|
-
|
|
388
|
-
⚠️ Only proceed if you understand what this script does and trust its source!
|
|
389
|
-
`.trim();
|
|
390
|
-
}
|
|
391
|
-
exports.version = '1.0.0';
|
|
392
|
-
exports.author = 'Snow-Flow SDK Migration';
|
|
393
|
-
//# sourceMappingURL=snow_execute_background_script.js.map
|
package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snow_execute_background_script.js","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/automation/snow_execute_background_script.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAuDH,0BA2OC;AA/RD,kDAA8D;AAC9D,oEAAiH;AAEpG,QAAA,cAAc,GAAsB;IAC/C,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,iHAAiH;IAC9H,gDAAgD;IAChD,QAAQ,EAAE,YAAY;IACtB,WAAW,EAAE,kBAAkB;IAC/B,SAAS,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC;IACjD,UAAU,EAAE,UAAU;IACtB,SAAS,EAAE,MAAM;IAEjB,y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CAAC,CAAC,CAAC;QAC1C,qBAAqB,gBAAgB,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;EACpE,gBAAgB,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtC,gBAAgB,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;;;;EAI3D,MAAM;;;;;;;;;;;;;CAaP,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAEY,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,MAAM,GAAG,yBAAyB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* snow_execute_script_sync - Synchronous script execution
|
|
3
|
-
*
|
|
4
|
-
* Executes server-side JavaScript in ServiceNow using Fix Scripts.
|
|
5
|
-
* Creates a temporary Fix Script, runs it, captures output, and cleans up.
|
|
6
|
-
*
|
|
7
|
-
* ⚠️ CRITICAL: ALL SCRIPTS MUST BE ES5 ONLY!
|
|
8
|
-
* ServiceNow runs on Rhino engine - no const/let/arrow functions/template literals.
|
|
9
|
-
*/
|
|
10
|
-
import { MCPToolDefinition, ServiceNowContext, ToolResult } from '../../shared/types.js';
|
|
11
|
-
export declare const toolDefinition: MCPToolDefinition;
|
|
12
|
-
export declare function execute(args: any, context: ServiceNowContext): Promise<ToolResult>;
|
|
13
|
-
export declare const version = "1.0.0";
|
|
14
|
-
export declare const author = "Snow-Flow SDK Migration";
|
|
15
|
-
//# sourceMappingURL=snow_execute_script_sync.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snow_execute_script_sync.d.ts","sourceRoot":"","sources":["../../../../../src/mcp/servicenow-mcp-unified/tools/automation/snow_execute_script_sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAIzF,eAAO,MAAM,cAAc,EAAE,iBAkC5B,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CAoNxF;AA6BD,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,MAAM,4BAA4B,CAAC"}
|