@epic-cloudcontrol/daemon 0.2.0 → 0.2.1
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/dist/sandbox.js +3 -6
- package/package.json +1 -1
package/dist/sandbox.js
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* - Environment variable filtering
|
|
8
8
|
* - Output size limits
|
|
9
9
|
*/
|
|
10
|
+
import os from "os";
|
|
11
|
+
import fs from "fs";
|
|
12
|
+
import path from "path";
|
|
10
13
|
const DEFAULT_BLOCKED_COMMANDS = [
|
|
11
14
|
"rm -rf /",
|
|
12
15
|
"rm -rf ~",
|
|
@@ -144,9 +147,6 @@ export function truncateOutput(output, maxBytes) {
|
|
|
144
147
|
* Returns the path. Caller is responsible for cleanup.
|
|
145
148
|
*/
|
|
146
149
|
export function createTaskTmpDir(taskId) {
|
|
147
|
-
const os = require("os");
|
|
148
|
-
const fs = require("fs");
|
|
149
|
-
const path = require("path");
|
|
150
150
|
const dir = path.join(os.tmpdir(), `cloudcontrol-${taskId.slice(0, 8)}`);
|
|
151
151
|
if (!fs.existsSync(dir)) {
|
|
152
152
|
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
@@ -157,9 +157,6 @@ export function createTaskTmpDir(taskId) {
|
|
|
157
157
|
* Clean up a task's temp directory.
|
|
158
158
|
*/
|
|
159
159
|
export function cleanupTaskTmpDir(taskId) {
|
|
160
|
-
const os = require("os");
|
|
161
|
-
const fs = require("fs");
|
|
162
|
-
const path = require("path");
|
|
163
160
|
const dir = path.join(os.tmpdir(), `cloudcontrol-${taskId.slice(0, 8)}`);
|
|
164
161
|
try {
|
|
165
162
|
fs.rmSync(dir, { recursive: true, force: true });
|