@wocker/core 1.1.5 → 1.1.6-beta.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/lib/env.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- export declare const WOCKER_VERSION = "1.1.5";
1
+ export declare const WOCKER_VERSION = "1.1.6";
2
2
  export declare const WOCKER_VERSION_KEY = "__WOCKER_VERSION__";
3
3
  export declare const WOCKER_DATA_DIR: string;
4
4
  export declare const WOCKER_DATA_DIR_KEY = "__WOCKER_DATA_DIR__";
5
+ export declare const WOCKER_INTERNAL_ALLOWED_MOUNTS: string[];
5
6
  export declare const FILE_SYSTEM_DRIVER_KEY = "__FILE_SYSTEM_DRIVER_";
6
7
  export declare const PLUGIN_DIR_KEY = "PLUGIN_DIR";
7
8
  export declare const IS_CONTROLLER_METADATA = "IS_CONTROLLER";
package/lib/env.js CHANGED
@@ -3,13 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.ALIAS_METADATA = exports.ARGS_OLD_METADATA = exports.ARGS_METADATA = exports.LISTENER_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.DESCRIPTION_METADATA = exports.INJECTABLE_WATERMARK = exports.IS_MODULE_METADATA = exports.IS_GLOBAL_METADATA = exports.IS_CONTROLLER_METADATA = exports.PLUGIN_DIR_KEY = exports.FILE_SYSTEM_DRIVER_KEY = exports.WOCKER_DATA_DIR_KEY = exports.WOCKER_DATA_DIR = exports.WOCKER_VERSION_KEY = exports.WOCKER_VERSION = void 0;
6
+ exports.MODULE_METADATA = exports.PLUGIN_NAME_METADATA = exports.INJECT_TOKEN_METADATA = exports.SELF_DECLARED_DEPS_METADATA = exports.PARAMTYPES_METADATA = exports.ALIAS_METADATA = exports.ARGS_OLD_METADATA = exports.ARGS_METADATA = exports.LISTENER_METADATA = exports.COMPLETION_METADATA = exports.COMMAND_METADATA = exports.DESCRIPTION_METADATA = exports.INJECTABLE_WATERMARK = exports.IS_MODULE_METADATA = exports.IS_GLOBAL_METADATA = exports.IS_CONTROLLER_METADATA = exports.PLUGIN_DIR_KEY = exports.FILE_SYSTEM_DRIVER_KEY = exports.WOCKER_INTERNAL_ALLOWED_MOUNTS = exports.WOCKER_DATA_DIR_KEY = exports.WOCKER_DATA_DIR = exports.WOCKER_VERSION_KEY = exports.WOCKER_VERSION = void 0;
7
7
  const os_1 = __importDefault(require("os"));
8
8
  const path_1 = __importDefault(require("path"));
9
- exports.WOCKER_VERSION = "1.1.5";
9
+ exports.WOCKER_VERSION = "1.1.6";
10
10
  exports.WOCKER_VERSION_KEY = "__WOCKER_VERSION__";
11
11
  exports.WOCKER_DATA_DIR = process.env.WS_DIR || path_1.default.join(os_1.default.homedir(), ".workspace");
12
12
  exports.WOCKER_DATA_DIR_KEY = "__WOCKER_DATA_DIR__";
13
+ exports.WOCKER_INTERNAL_ALLOWED_MOUNTS = [
14
+ "/var/run/docker.sock",
15
+ "/var/run/docker.sock.raw",
16
+ exports.WOCKER_DATA_DIR
17
+ ];
13
18
  exports.FILE_SYSTEM_DRIVER_KEY = "__FILE_SYSTEM_DRIVER_";
14
19
  exports.PLUGIN_DIR_KEY = "PLUGIN_DIR";
15
20
  exports.IS_CONTROLLER_METADATA = "IS_CONTROLLER";
@@ -28,7 +28,7 @@ export declare abstract class AppConfig {
28
28
  getEnv(key: string, byDefault: string): string;
29
29
  setEnv(name: string, value: string): void;
30
30
  unsetEnv(name: string): void;
31
- isMountAllowed(path: string): boolean;
31
+ isMountAllowed(path: string, internal?: boolean): boolean;
32
32
  addMountAllow(path: string): void;
33
33
  removeMountAllow(path: string): void;
34
34
  addMountDeny(path: string): void;
@@ -13,6 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.AppConfig = void 0;
15
15
  const isPathAllowed_1 = require("../utils/isPathAllowed");
16
+ const env_1 = require("../env");
16
17
  class AppConfig {
17
18
  constructor(data) {
18
19
  const { plugins = [], presets = [], projects = [] } = data, rest = __rest(data, ["plugins", "presets", "projects"]);
@@ -160,9 +161,12 @@ class AppConfig {
160
161
  delete this.env;
161
162
  }
162
163
  }
163
- isMountAllowed(path) {
164
+ isMountAllowed(path, internal = false) {
164
165
  var _a, _b, _c, _d;
165
- return (0, isPathAllowed_1.isPathAllowed)(path, (_b = (_a = this.permissions) === null || _a === void 0 ? void 0 : _a.mounts) === null || _b === void 0 ? void 0 : _b.allow, (_d = (_c = this.permissions) === null || _c === void 0 ? void 0 : _c.mounts) === null || _d === void 0 ? void 0 : _d.deny);
166
+ return (0, isPathAllowed_1.isPathAllowed)(path, [
167
+ ...((_b = (_a = this.permissions) === null || _a === void 0 ? void 0 : _a.mounts) === null || _b === void 0 ? void 0 : _b.allow) || [],
168
+ ...internal ? env_1.WOCKER_INTERNAL_ALLOWED_MOUNTS : []
169
+ ], (_d = (_c = this.permissions) === null || _c === void 0 ? void 0 : _c.mounts) === null || _d === void 0 ? void 0 : _d.deny);
166
170
  }
167
171
  addMountAllow(path) {
168
172
  if (!this.permissions) {
@@ -18,8 +18,6 @@ export declare namespace ContainerService {
18
18
  user?: string;
19
19
  restart?: "always";
20
20
  entrypoint?: string | string[];
21
- /** @deprecated */
22
- projectId?: string;
23
21
  tty?: boolean;
24
22
  memory?: number;
25
23
  memorySwap?: number;
@@ -35,6 +33,7 @@ export declare namespace ContainerService {
35
33
  };
36
34
  networkMode?: string;
37
35
  extraHosts?: any;
36
+ internal?: boolean;
38
37
  volumes?: string[];
39
38
  ports?: string[];
40
39
  cmd?: string[];
@@ -40,7 +40,7 @@ export declare class AppService {
40
40
  unsetMeta(key: string): void;
41
41
  get experimentalFeatures(): string[];
42
42
  isExperimentalEnabled(key: string): boolean;
43
- isAllowedPath(path: string): boolean;
43
+ isAllowedPath(path: string, internal?: boolean): boolean;
44
44
  save(): void;
45
45
  }
46
46
  export {};
@@ -126,8 +126,8 @@ let AppService = class AppService {
126
126
  isExperimentalEnabled(key) {
127
127
  return this.config.getMeta(`experimental.${key}`) === "enabled";
128
128
  }
129
- isAllowedPath(path) {
130
- return this.config.isMountAllowed(path);
129
+ isAllowedPath(path, internal = false) {
130
+ return this.config.isMountAllowed(path, internal);
131
131
  }
132
132
  save() {
133
133
  this.config.save();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wocker/core",
3
3
  "type": "commonjs",
4
- "version": "1.1.5",
4
+ "version": "1.1.6-beta.1",
5
5
  "author": "Kris Papercut <krispcut@gmail.com>",
6
6
  "description": "Core of the Wocker",
7
7
  "license": "MIT",