@oneuptime/common 12.0.11 → 12.0.12
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/Server/Types/Workflow/Components/Conditions/IfElse.ts +9 -0
- package/Server/Types/Workflow/Components/JavaScript.ts +9 -0
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +12 -0
- package/Server/Utils/VM/VMRunner.ts +693 -874
- package/Tests/Server/Types/Workflow/Components/CustomCodeScriptError.test.ts +121 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorJavascriptExpression.test.ts +92 -0
- package/Tests/Server/Utils/VM/VMRunnerIsolation.test.ts +385 -0
- package/Tests/Server/Utils/VM/VMRunnerSsrf.test.ts +3 -0
- package/Types/Monitor/CustomCodeMonitor/CustomCodeMonitorResponse.ts +14 -2
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js +8 -0
- package/build/dist/Server/Types/Workflow/Components/Conditions/IfElse.js.map +1 -1
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js +8 -0
- package/build/dist/Server/Types/Workflow/Components/JavaScript.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +12 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +402 -525
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/package.json +1 -1
|
@@ -165,6 +165,15 @@ export default class IfElse extends ComponentCode {
|
|
|
165
165
|
options.log(msg);
|
|
166
166
|
});
|
|
167
167
|
|
|
168
|
+
/*
|
|
169
|
+
* runCodeInSandbox resolves with `scriptError` when the expression
|
|
170
|
+
* threw or timed out — it no longer rejects. Fail the run instead of
|
|
171
|
+
* silently taking the "No" branch.
|
|
172
|
+
*/
|
|
173
|
+
if (returnResult.scriptError) {
|
|
174
|
+
throw returnResult.scriptError;
|
|
175
|
+
}
|
|
176
|
+
|
|
168
177
|
if (returnResult.returnValue) {
|
|
169
178
|
return {
|
|
170
179
|
returnValues: {},
|
|
@@ -81,6 +81,15 @@ export default class JavaScriptCode extends ComponentCode {
|
|
|
81
81
|
options.log(msg);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
/*
|
|
85
|
+
* runCodeInSandbox resolves with `scriptError` when the user script
|
|
86
|
+
* threw or timed out — it no longer rejects. Route those runs to the
|
|
87
|
+
* error port, matching the pre-sandbox behavior.
|
|
88
|
+
*/
|
|
89
|
+
if (returnResult.scriptError) {
|
|
90
|
+
throw returnResult.scriptError;
|
|
91
|
+
}
|
|
92
|
+
|
|
84
93
|
const returnVal: JSONValue = returnResult.returnValue;
|
|
85
94
|
|
|
86
95
|
return {
|
|
@@ -636,6 +636,18 @@ ${contextBlock}
|
|
|
636
636
|
return null;
|
|
637
637
|
}
|
|
638
638
|
|
|
639
|
+
/*
|
|
640
|
+
* runCodeInSandbox resolves with `scriptError` when the expression threw
|
|
641
|
+
* or timed out — it no longer rejects. Keep the pre-sandbox outcome
|
|
642
|
+
* (criteria not met) but retain the error log.
|
|
643
|
+
*/
|
|
644
|
+
if (result.scriptError) {
|
|
645
|
+
logger.error(result.scriptError, {
|
|
646
|
+
projectId: input.monitor.projectId?.toString(),
|
|
647
|
+
});
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
650
|
+
|
|
639
651
|
if (result && result.returnValue) {
|
|
640
652
|
return `JavaScript Expression - ${expression} - evaluated to true.`;
|
|
641
653
|
}
|