@eagleoutice/flowr 2.16.0 → 2.16.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/README.md +9 -9
- package/cli/flowr-main-options.d.ts +15 -0
- package/cli/flowr-main-options.js +18 -0
- package/cli/flowr.d.ts +18 -0
- package/cli/flowr.js +13 -2
- package/cli/repl/commands/repl-clipboard.js +2 -1
- package/cli/repl/commands/repl-commands.js +2 -0
- package/cli/repl/commands/repl-main.d.ts +5 -0
- package/cli/repl/commands/repl-signature.js +2 -0
- package/cli/repl/core.d.ts +7 -1
- package/cli/repl/core.js +17 -8
- package/cli/repl/execute.js +2 -0
- package/cli/repl/server/connection.js +2 -1
- package/cli/repl/server/net.d.ts +10 -0
- package/cli/repl/server/net.js +34 -1
- package/cli/slicer-app.js +2 -1
- package/config.d.ts +12 -2
- package/config.js +91 -14
- package/dataflow/environments/built-in-props.d.ts +5 -2
- package/dataflow/environments/built-in-props.js +6 -3
- package/dataflow/environments/default-builtin-config.d.ts +197 -11
- package/dataflow/environments/default-builtin-config.js +62 -42
- package/dataflow/environments/identifier.d.ts +1 -0
- package/dataflow/environments/query-fn-props.d.ts +3 -0
- package/dataflow/environments/query-fn-props.js +8 -0
- package/dataflow/environments/resolve-by-name.js +11 -4
- package/dataflow/eval/resolve/resolve-argument.js +5 -1
- package/dataflow/extractor.js +14 -5
- package/dataflow/fn/frame-reflection.js +14 -2
- package/dataflow/graph/graph.js +12 -0
- package/dataflow/internal/control-flow.d.ts +11 -0
- package/dataflow/internal/control-flow.js +15 -0
- package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.js +4 -10
- package/dataflow/internal/process/functions/call/built-in/built-in-function-definition.js +1 -1
- package/dataflow/internal/process/functions/call/built-in/built-in-purrr-formula.js +9 -0
- package/dataflow/internal/process/functions/call/built-in/transitive-side-effects.js +8 -7
- package/dataflow/internal/process/functions/call/deferred.js +6 -1
- package/dataflow/internal/process/functions/call/named-call-handling.js +70 -9
- package/documentation/doc-capabilities.js +4 -1
- package/documentation/wiki-interface.js +4 -0
- package/engines.js +11 -3
- package/linter/linter-executor.js +19 -1
- package/linter/linter-rules.d.ts +8 -3
- package/linter/rules/file-path-validity.js +4 -1
- package/linter/rules/function-finder-util.d.ts +1 -1
- package/linter/rules/function-finder-util.js +1 -3
- package/linter/rules/network-functions.d.ts +4 -3
- package/linter/rules/network-functions.js +14 -12
- package/linter/rules/no-leaked-credentials.d.ts +8 -3
- package/linter/rules/no-leaked-credentials.js +133 -35
- package/linter/rules/problematic-inputs.d.ts +1 -1
- package/linter/rules/problematic-inputs.js +20 -14
- package/linter/rules/seeded-randomness.js +3 -1
- package/linter/rules/unescaped-arguments.d.ts +13 -2
- package/linter/rules/unescaped-arguments.js +100 -12
- package/package.json +1 -1
- package/project/plugins/file-plugins/files/flowr-rda-file.d.ts +14 -5
- package/project/plugins/file-plugins/files/flowr-rda-file.js +35 -24
- package/project/plugins/package-version-plugins/flowr-analyzer-package-versions-sigdb-plugin.js +2 -1
- package/project/sigdb/decompress.js +3 -1
- package/project/sigdb/sigdb-download.js +9 -6
- package/queries/catalog/call-context-query/call-context-query-executor.js +2 -1
- package/queries/catalog/config-query/config-query-executor.js +9 -2
- package/queries/catalog/input-sources-query/input-source-functions.d.ts +6 -4
- package/queries/catalog/input-sources-query/input-source-functions.js +11 -6
- package/queries/catalog/input-sources-query/input-sources-query-executor.js +1 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.d.ts +1 -1
- package/queries/catalog/input-sources-query/input-sources-query-format.js +9 -2
- package/queries/catalog/input-sources-query/simple-input-classifier.d.ts +12 -4
- package/queries/catalog/input-sources-query/simple-input-classifier.js +227 -29
- package/r-bridge/shell-executor.js +2 -0
- package/r-bridge/shell.js +2 -0
- package/search/search-executor/search-enrichers.js +5 -3
- package/slicing/static/static-slicer.js +14 -9
- package/util/files.d.ts +6 -0
- package/util/files.js +12 -0
- package/util/parallel.js +2 -0
- package/util/secure-mode.d.ts +42 -0
- package/util/secure-mode.js +70 -0
- package/util/version.js +2 -2
package/util/parallel.js
CHANGED
|
@@ -43,6 +43,7 @@ const cp = __importStar(require("child_process"));
|
|
|
43
43
|
const log_1 = require("./log");
|
|
44
44
|
const assert_1 = require("./assert");
|
|
45
45
|
const json_1 = require("./json");
|
|
46
|
+
const secure_mode_1 = require("./secure-mode");
|
|
46
47
|
/**
|
|
47
48
|
* This is not really generic but written especially for the benchmarking script.
|
|
48
49
|
* It offers a work stealing thread pool executor.
|
|
@@ -93,6 +94,7 @@ class LimitedThreadPool {
|
|
|
93
94
|
(0, assert_1.guard)(args !== undefined, () => `arguments should not be undefined in ${JSON.stringify(this.workingQueue)}`);
|
|
94
95
|
this.currentlyRunning.add(args);
|
|
95
96
|
console.log(`[${this.counter}/${this.limit}] Running next, currently running: ${this.currentlyRunning.size}, queue: ${this.workingQueue.length} [args: ${args.join(' ')}]`);
|
|
97
|
+
secure_mode_1.SecureMode.guard('starting a process', this.module);
|
|
96
98
|
const child = cp.fork(this.module, args);
|
|
97
99
|
child.on('exit', this.onChildExit(args));
|
|
98
100
|
let timeout;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* flowR's secure mode, for analyzing untrusted code (e.g., on a server that accepts arbitrary projects).
|
|
3
|
+
*
|
|
4
|
+
* Once enabled, it stays enabled for the lifetime of the process: there is deliberately no way to disable it.
|
|
5
|
+
* Instead of trying to find every path that may lead to a dangerous operation, the operations themselves
|
|
6
|
+
* (starting R or any other process, accessing the network, using the clipboard) check {@link SecureMode.guard}, so
|
|
7
|
+
* code added later is covered as well. Configuration is restricted on top (see {@link FlowrConfig.fromFile}).
|
|
8
|
+
*
|
|
9
|
+
* Enable it with `--secure` on the command line, the environment variable {@link SecureMode.EnvVar}, or {@link SecureMode.enable}.
|
|
10
|
+
*/
|
|
11
|
+
/** What the secure mode forbids, named in the error it throws. */
|
|
12
|
+
export type SecureModeOperation = 'starting R' | 'starting a process' | 'network access' | 'clipboard access';
|
|
13
|
+
/** Thrown by {@link SecureMode.guard} if a forbidden operation is attempted in secure mode. */
|
|
14
|
+
export declare class SecureModeError extends Error {
|
|
15
|
+
readonly operation: SecureModeOperation;
|
|
16
|
+
constructor(operation: SecureModeOperation, detail?: string);
|
|
17
|
+
}
|
|
18
|
+
/** Whether `value` (of an environment variable) switches something on. */
|
|
19
|
+
export declare function isTruthyEnvValue(value: string | undefined): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* The process-wide secure mode, see the module documentation.
|
|
22
|
+
* @helper security
|
|
23
|
+
*/
|
|
24
|
+
export declare const SecureMode: {
|
|
25
|
+
readonly EnvVar: "FLOWR_SECURE_MODE";
|
|
26
|
+
/** Enables the secure mode for the rest of the process's lifetime (there is no way back). */
|
|
27
|
+
readonly enable: (this: void) => void;
|
|
28
|
+
/**
|
|
29
|
+
* In secure mode, decompressing a file of the analyzed project must not yield more than this many bytes,
|
|
30
|
+
* so a decompression bomb cannot exhaust the memory. Use {@link SecureMode.decompressionLimit}.
|
|
31
|
+
*/
|
|
32
|
+
readonly MaxDecompressedBytes: number;
|
|
33
|
+
/** The maximum number of bytes decompressing a project file may yield, `undefined` (no limit) outside the secure mode. */
|
|
34
|
+
readonly decompressionLimit: (this: void) => number | undefined;
|
|
35
|
+
/** Whether the secure mode is enabled. */
|
|
36
|
+
readonly isEnabled: (this: void) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Call this right before performing the given operation.
|
|
39
|
+
* @throws a {@link SecureModeError} if the secure mode is enabled
|
|
40
|
+
*/
|
|
41
|
+
readonly guard: (this: void, operation: SecureModeOperation, detail?: string) => void;
|
|
42
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* flowR's secure mode, for analyzing untrusted code (e.g., on a server that accepts arbitrary projects).
|
|
4
|
+
*
|
|
5
|
+
* Once enabled, it stays enabled for the lifetime of the process: there is deliberately no way to disable it.
|
|
6
|
+
* Instead of trying to find every path that may lead to a dangerous operation, the operations themselves
|
|
7
|
+
* (starting R or any other process, accessing the network, using the clipboard) check {@link SecureMode.guard}, so
|
|
8
|
+
* code added later is covered as well. Configuration is restricted on top (see {@link FlowrConfig.fromFile}).
|
|
9
|
+
*
|
|
10
|
+
* Enable it with `--secure` on the command line, the environment variable {@link SecureMode.EnvVar}, or {@link SecureMode.enable}.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.SecureMode = exports.SecureModeError = void 0;
|
|
14
|
+
exports.isTruthyEnvValue = isTruthyEnvValue;
|
|
15
|
+
/** Environment variable that enables {@link SecureMode} when flowR is loaded. */
|
|
16
|
+
const EnvVar = 'FLOWR_SECURE_MODE';
|
|
17
|
+
/** Thrown by {@link SecureMode.guard} if a forbidden operation is attempted in secure mode. */
|
|
18
|
+
class SecureModeError extends Error {
|
|
19
|
+
operation;
|
|
20
|
+
constructor(operation, detail) {
|
|
21
|
+
super(`flowR runs in secure mode, which forbids ${operation}${detail ? ` (${detail})` : ''}`);
|
|
22
|
+
this.operation = operation;
|
|
23
|
+
this.name = 'SecureModeError';
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.SecureModeError = SecureModeError;
|
|
27
|
+
/** Whether `value` (of an environment variable) switches something on. */
|
|
28
|
+
function isTruthyEnvValue(value) {
|
|
29
|
+
const v = value?.trim().toLowerCase();
|
|
30
|
+
return v !== undefined && v !== '' && v !== '0' && v !== 'false' && v !== 'no' && v !== 'off';
|
|
31
|
+
}
|
|
32
|
+
let enabled = typeof process !== 'undefined' && isTruthyEnvValue(process.env?.[EnvVar]);
|
|
33
|
+
/**
|
|
34
|
+
* The process-wide secure mode, see the module documentation.
|
|
35
|
+
* @helper security
|
|
36
|
+
*/
|
|
37
|
+
exports.SecureMode = {
|
|
38
|
+
EnvVar,
|
|
39
|
+
/** Enables the secure mode for the rest of the process's lifetime (there is no way back). */
|
|
40
|
+
enable() {
|
|
41
|
+
enabled = true;
|
|
42
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
43
|
+
// inherited by every child process flowR may (legitimately) start before, e.g., a worker
|
|
44
|
+
process.env[EnvVar] = '1';
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
* In secure mode, decompressing a file of the analyzed project must not yield more than this many bytes,
|
|
49
|
+
* so a decompression bomb cannot exhaust the memory. Use {@link SecureMode.decompressionLimit}.
|
|
50
|
+
*/
|
|
51
|
+
MaxDecompressedBytes: 512 * 1024 * 1024,
|
|
52
|
+
/** The maximum number of bytes decompressing a project file may yield, `undefined` (no limit) outside the secure mode. */
|
|
53
|
+
decompressionLimit() {
|
|
54
|
+
return enabled ? exports.SecureMode.MaxDecompressedBytes : undefined;
|
|
55
|
+
},
|
|
56
|
+
/** Whether the secure mode is enabled. */
|
|
57
|
+
isEnabled() {
|
|
58
|
+
return enabled;
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Call this right before performing the given operation.
|
|
62
|
+
* @throws a {@link SecureModeError} if the secure mode is enabled
|
|
63
|
+
*/
|
|
64
|
+
guard(operation, detail) {
|
|
65
|
+
if (enabled) {
|
|
66
|
+
throw new SecureModeError(operation, detail);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=secure-mode.js.map
|
package/util/version.js
CHANGED
|
@@ -42,9 +42,9 @@ const assert_1 = require("./assert");
|
|
|
42
42
|
const sigdb_download_1 = require("../project/sigdb/sigdb-download");
|
|
43
43
|
const doc_files_1 = require("../documentation/doc-util/doc-files");
|
|
44
44
|
// this is automatically replaced with the current version by release-it
|
|
45
|
-
const version = '2.16.
|
|
45
|
+
const version = '2.16.2';
|
|
46
46
|
// this is automatically replaced with the release date by release-it (scripts/bump-version.ts)
|
|
47
|
-
const versionDate = '2026-10-
|
|
47
|
+
const versionDate = '2026-10-16T18:03:09Z';
|
|
48
48
|
/**
|
|
49
49
|
* Retrieves the current flowR version as a new {@link SemVer} object.
|
|
50
50
|
*/
|