@eagleoutice/flowr 2.16.8 → 2.17.0

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.
Files changed (94) hide show
  1. package/README.md +16 -10
  2. package/abstract-interpretation/absint-inference.d.ts +17 -1
  3. package/abstract-interpretation/absint-inference.js +118 -3
  4. package/abstract-interpretation/data-frame/arguments.d.ts +11 -1
  5. package/abstract-interpretation/data-frame/arguments.js +12 -0
  6. package/abstract-interpretation/domains/lattice.d.ts +2 -0
  7. package/abstract-interpretation/domains/lattice.js +0 -6
  8. package/abstract-interpretation/domains/multi-value-state-domain.d.ts +2 -1
  9. package/abstract-interpretation/domains/multi-value-state-domain.js +7 -3
  10. package/abstract-interpretation/domains/partial-product-domain.js +2 -1
  11. package/abstract-interpretation/domains/state-abstract-domain.d.ts +6 -3
  12. package/abstract-interpretation/domains/state-abstract-domain.js +13 -7
  13. package/abstract-interpretation/domains/state-domain.d.ts +4 -0
  14. package/config.js +1 -1
  15. package/control-flow/useless-loop.js +10 -8
  16. package/data/r-primitives.generated.d.ts +1 -0
  17. package/data/r-primitives.generated.js +9 -0
  18. package/data/sigdb/sigdb.remote.json +110 -110
  19. package/dataflow/environments/query-fn-props.d.ts +9 -3
  20. package/dataflow/environments/query-fn-props.js +13 -5
  21. package/dataflow/fn/class-declaration.js +1 -8
  22. package/dataflow/graph/df-helper.d.ts +2 -0
  23. package/dataflow/graph/df-helper.js +7 -0
  24. package/documentation/wiki-linter.js +29 -0
  25. package/documentation/wiki-query.js +20 -1
  26. package/linter/linter-executor.js +2 -1
  27. package/linter/linter-rules.d.ts +65 -0
  28. package/linter/linter-rules.js +5 -1
  29. package/linter/rules/cmd-check/global-environment-modification.d.ts +14 -1
  30. package/linter/rules/cmd-check/global-environment-modification.js +15 -7
  31. package/linter/rules/no-leaked-credentials.d.ts +1 -0
  32. package/linter/rules/no-leaked-credentials.js +3 -3
  33. package/linter/rules/process-state-in-session.d.ts +71 -0
  34. package/linter/rules/process-state-in-session.js +267 -0
  35. package/linter/rules/secret-exfiltration.d.ts +80 -0
  36. package/linter/rules/secret-exfiltration.js +183 -0
  37. package/package.json +1 -1
  38. package/project/flowr-analyzer.d.ts +6 -0
  39. package/project/flowr-analyzer.js +4 -0
  40. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +2 -0
  41. package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -3
  42. package/project/sigdb/decompress.d.ts +4 -0
  43. package/project/sigdb/decompress.js +60 -25
  44. package/project/sigdb/manifest.d.ts +1 -1
  45. package/project/sigdb/manifest.js +2 -5
  46. package/project/sigdb/reader.js +15 -6
  47. package/project/sigdb/sigdb-download.d.ts +3 -7
  48. package/project/sigdb/sigdb-download.js +71 -72
  49. package/queries/catalog/taint-query/taint-query-executor.d.ts +7 -0
  50. package/queries/catalog/taint-query/taint-query-executor.js +30 -0
  51. package/queries/catalog/taint-query/taint-query-format.d.ts +29 -0
  52. package/queries/catalog/taint-query/taint-query-format.js +124 -0
  53. package/queries/query.d.ts +12 -1
  54. package/queries/query.js +2 -0
  55. package/taint-analysis/builder/domain.d.ts +14 -0
  56. package/taint-analysis/builder/domain.js +69 -0
  57. package/taint-analysis/builder/report-template.d.ts +50 -0
  58. package/taint-analysis/builder/report-template.js +46 -0
  59. package/taint-analysis/builder/taint-analysis-definition.d.ts +108 -0
  60. package/taint-analysis/builder/taint-analysis-definition.js +128 -0
  61. package/taint-analysis/builder/taint-analysis.d.ts +124 -0
  62. package/taint-analysis/builder/taint-analysis.js +93 -0
  63. package/taint-analysis/builtin-index-bridge.d.ts +20 -0
  64. package/taint-analysis/builtin-index-bridge.js +48 -0
  65. package/taint-analysis/eval/eval.d.ts +1 -0
  66. package/taint-analysis/eval/eval.js +124 -0
  67. package/taint-analysis/eval/instrumentation.d.ts +59 -0
  68. package/taint-analysis/eval/instrumentation.js +124 -0
  69. package/taint-analysis/finite-domain.d.ts +41 -0
  70. package/taint-analysis/finite-domain.js +118 -0
  71. package/taint-analysis/function-categories.d.ts +31 -0
  72. package/taint-analysis/function-categories.js +61 -0
  73. package/taint-analysis/logger.d.ts +1 -0
  74. package/taint-analysis/logger.js +6 -0
  75. package/taint-analysis/predefined/determinism.d.ts +6 -0
  76. package/taint-analysis/predefined/determinism.js +14 -0
  77. package/taint-analysis/predefined/normalization.d.ts +17 -0
  78. package/taint-analysis/predefined/normalization.js +150 -0
  79. package/taint-analysis/predefined/predefined.d.ts +12 -0
  80. package/taint-analysis/predefined/predefined.js +18 -0
  81. package/taint-analysis/predefined/randomness-analysis.d.ts +6 -0
  82. package/taint-analysis/predefined/randomness-analysis.js +124 -0
  83. package/taint-analysis/predefined/secret-analysis.d.ts +77 -0
  84. package/taint-analysis/predefined/secret-analysis.js +165 -0
  85. package/taint-analysis/predefined/security-analysis.d.ts +7 -0
  86. package/taint-analysis/predefined/security-analysis.js +91 -0
  87. package/taint-analysis/taint-mapping.d.ts +86 -0
  88. package/taint-analysis/taint-mapping.js +70 -0
  89. package/taint-analysis/taint-resolve.d.ts +26 -0
  90. package/taint-analysis/taint-resolve.js +86 -0
  91. package/taint-analysis/taint-visitor.d.ts +80 -0
  92. package/taint-analysis/taint-visitor.js +82 -0
  93. package/util/flowr-version.d.ts +1 -1
  94. package/util/flowr-version.js +2 -2
@@ -0,0 +1,80 @@
1
+ import { AbstractInterpreter, type AbsintVisitorConfiguration } from '../abstract-interpretation/absint-inference';
2
+ import type { AnyAbstractDomain } from '../abstract-interpretation/domains/abstract-domain';
3
+ import type { AbstractProduct, ProductReduction } from '../abstract-interpretation/domains/partial-product-domain';
4
+ import type { NodeId } from '../r-bridge/lang-4.x/ast/model/processing/node-id';
5
+ import type { DataflowGraphVertexFunctionCall } from '../dataflow/graph/vertex';
6
+ import type { FnCallHookInfo } from './builder/taint-analysis';
7
+ import { RFunctionCall } from '../r-bridge/lang-4.x/ast/model/nodes/r-function-call';
8
+ import { RBinaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-binary-op';
9
+ import { RUnaryOp } from '../r-bridge/lang-4.x/ast/model/nodes/r-unary-op';
10
+ import { RAccess } from '../r-bridge/lang-4.x/ast/model/nodes/r-access';
11
+ import { RSymbol } from '../r-bridge/lang-4.x/ast/model/nodes/r-symbol';
12
+ import { Identifier } from '../dataflow/environments/identifier';
13
+ import type { RNode } from '../r-bridge/lang-4.x/ast/model/model';
14
+ import type { ParentInformation } from '../r-bridge/lang-4.x/ast/model/processing/decorate';
15
+ import type { TaintMapper } from './taint-mapping';
16
+ /**
17
+ * Function calls the taint analysis is able to handle:
18
+ * named function calls like `f(x)`, method calls (`obj$f(x)`), operators (`x + y`, `-x`), accesses (`x$a`, `x[[1]]`),
19
+ * and functions applied by others (`readLines` in `do.call(readLines, args)`)
20
+ */
21
+ export type TaintCallNode = RFunctionCall<ParentInformation> | RBinaryOp<ParentInformation> | RUnaryOp<ParentInformation> | RAccess<ParentInformation> | RSymbol<ParentInformation>;
22
+ /** Whether the given AST node can be handled by the taint analysis (see {@link TaintCallNode}). */
23
+ export declare function isTaintableCallNode(node: RNode<ParentInformation> | undefined): node is TaintCallNode;
24
+ /** The name mappings of a call are looked up by: the called function, or `$method` for a method call `obj$method(...)` */
25
+ export declare function taintCallName(call: DataflowGraphVertexFunctionCall, node: RNode<ParentInformation> | undefined): Identifier;
26
+ /**
27
+ * Resolves the inferred abstract taint of an argument node at the current program point, independent of any mapping
28
+ * rule. Returns `undefined` if no taint was inferred for the node.
29
+ */
30
+ export type ArgTaintProjector = (id: NodeId) => AnyAbstractDomain | undefined;
31
+ /**
32
+ * Callback hook invoked when a function call is visited during taint inference.
33
+ * @param taint - The resolved taint information for the function call
34
+ * @param node - The AST node representing the function call
35
+ * @param value - The abstract domain value at this point in the analysis
36
+ * @param projectArg - Resolves the incoming taint of any argument node, regardless of mapping rules
37
+ * @param call - The data flow graph vertex of the function call
38
+ * @param role - The role of the matched mapping (source/propagator/sink), or `undefined` for unmapped calls
39
+ */
40
+ export type TaintVisitorHook = (info: Omit<FnCallHookInfo, 'name' | 'dfg' | 'ctx'>) => void;
41
+ /**
42
+ * Configuration for the taint inference.
43
+ */
44
+ export type TaintVisitorConfiguration = AbsintVisitorConfiguration & {
45
+ /** Callbacks invoked when each function call is visited during taint inference */
46
+ fnCallHook?: TaintVisitorHook;
47
+ };
48
+ /**
49
+ * The abstract product mapping the name of a (component) taint analysis to its (value) abstract domain.
50
+ * Each property of the product holds the inferred taint of the respective component analysis.
51
+ */
52
+ export type TaintProduct = AbstractProduct;
53
+ /**
54
+ * A single component of a taint analysis, i.e. one of the combined taint analyses.
55
+ * It bundles the analysis name (used as the product key), its (value) abstract domain, and its function mapper.
56
+ * Note that {@link TaintAnalysisDefinition} structurally conforms to this interface.
57
+ * @template Domain - The (value) abstract domain of the component analysis
58
+ */
59
+ export interface TaintComponent<Domain extends AnyAbstractDomain = AnyAbstractDomain> {
60
+ /** The unique name of the component analysis, used as the key within the {@link TaintProduct}. */
61
+ readonly name: string;
62
+ /** The (value) abstract domain (taint lattice) of the component analysis. */
63
+ readonly domain: Domain;
64
+ /** The function mapper relating function names to the tainting behavior of the component analysis. */
65
+ readonly mapper: TaintMapper<Domain>;
66
+ }
67
+ /**
68
+ * Abstract interpreter conducting taint analyses, i.e. applying finite taint lattices on the control-flow graph.
69
+ * All components are evaluated simultaneously during a single control-flow traversal and their taints are combined into
70
+ * a product of the lattice values per CFG node, joined (and widened) component-wise. Optional reductions turn the
71
+ * otherwise direct product into a reduced product, allowing the component analyses to refine each other.
72
+ * A node reaching Bottom marks a finding, so it does not collapse the state.
73
+ *
74
+ * Please prefer using the {@link FlowrAnalyzer.taint} method to create a taint analysis.
75
+ */
76
+ export declare class TaintInterpreter extends AbstractInterpreter<TaintProduct> {
77
+ constructor(components: readonly TaintComponent[], config: TaintVisitorConfiguration, reductions?: readonly ProductReduction<TaintProduct>[]);
78
+ start(): void;
79
+ protected isUnsupportedFunctionCall(_nodeId: NodeId): boolean;
80
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaintInterpreter = void 0;
4
+ exports.isTaintableCallNode = isTaintableCallNode;
5
+ exports.taintCallName = taintCallName;
6
+ const absint_inference_1 = require("../abstract-interpretation/absint-inference");
7
+ const taint_resolve_1 = require("./taint-resolve");
8
+ const r_function_call_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
9
+ const r_binary_op_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
10
+ const r_unary_op_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-unary-op");
11
+ const r_access_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-access");
12
+ const r_symbol_1 = require("../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
13
+ const identifier_1 = require("../dataflow/environments/identifier");
14
+ /** the method `obj$method(...)` calls, as `$method` */
15
+ function methodName(node) {
16
+ const field = r_function_call_1.RFunctionCall.isUnnamed(node) && r_access_1.RAccess.isNamed(node.calledFunction) ? node.calledFunction.access[0]?.value : undefined;
17
+ return r_symbol_1.RSymbol.is(field) ? identifier_1.Identifier.make(`$${identifier_1.Identifier.getName(field.content)}`) : undefined;
18
+ }
19
+ /** Whether the given AST node can be handled by the taint analysis (see {@link TaintCallNode}). */
20
+ function isTaintableCallNode(node) {
21
+ return r_function_call_1.RFunctionCall.isNamed(node) || r_binary_op_1.RBinaryOp.is(node) || r_unary_op_1.RUnaryOp.is(node) || r_access_1.RAccess.is(node) || r_symbol_1.RSymbol.is(node) || methodName(node) !== undefined;
22
+ }
23
+ /** The name mappings of a call are looked up by: the called function, or `$method` for a method call `obj$method(...)` */
24
+ function taintCallName(call, node) {
25
+ return methodName(node) ?? call.name;
26
+ }
27
+ /** The abstract semantics of a taint component: every taintable call gets the taint its mappings resolve to. */
28
+ function taintSemantics({ domain, mapper }, fnCallHook) {
29
+ const handleCall = (state, call, ctx, explicitOnly) => {
30
+ const node = ctx.getAstNode(call.id);
31
+ const name = taintCallName(call, node);
32
+ const mappings = mapper.getMappings(name);
33
+ if (!isTaintableCallNode(node) || ((explicitOnly || name !== call.name || r_symbol_1.RSymbol.is(node)) && !mappings.some(m => m.category === undefined))) {
34
+ return;
35
+ }
36
+ const projectArg = (id) => ctx.getAbstractValue(id);
37
+ const { value, role, category } = (0, taint_resolve_1.resolveFnCallToTaint)(call, mappings, domain, projectArg, ctx.dfg, ctx.context);
38
+ state.set(call.id, value);
39
+ fnCallHook?.({ node, value, wasMapped: mappings.length > 0, projectArg, call, role, category });
40
+ };
41
+ return {
42
+ handleFunctionCall: (state, call, ctx) => handleCall(state, call, ctx, false),
43
+ /* accesses are only tracked with explicit mappings */
44
+ handleAccessCall: (state, call, ctx) => handleCall(state, call, ctx, true),
45
+ handleAssignmentCall(state, _call, ctx, target, source) {
46
+ const value = ctx.getAbstractValue(source);
47
+ if (value === undefined) {
48
+ state.remove(target);
49
+ }
50
+ else {
51
+ state.set(target, value);
52
+ }
53
+ }
54
+ };
55
+ }
56
+ /**
57
+ * Abstract interpreter conducting taint analyses, i.e. applying finite taint lattices on the control-flow graph.
58
+ * All components are evaluated simultaneously during a single control-flow traversal and their taints are combined into
59
+ * a product of the lattice values per CFG node, joined (and widened) component-wise. Optional reductions turn the
60
+ * otherwise direct product into a reduced product, allowing the component analyses to refine each other.
61
+ * A node reaching Bottom marks a finding, so it does not collapse the state.
62
+ *
63
+ * Please prefer using the {@link FlowrAnalyzer.taint} method to create a taint analysis.
64
+ */
65
+ class TaintInterpreter extends absint_inference_1.AbstractInterpreter {
66
+ constructor(components, config, reductions = []) {
67
+ const domains = Object.fromEntries(components.map(c => [c.name, c.domain]));
68
+ const semantics = Object.fromEntries(components.map(c => [c.name, taintSemantics(c, config.fnCallHook)]));
69
+ /* a component missing from a state is simply unknown, so the reductions see the product as partial */
70
+ super(config, { domains, semantics, reductions: reductions, collapseOnBottom: false });
71
+ }
72
+ start() {
73
+ super.start();
74
+ this.interpretUncalledFunctions();
75
+ }
76
+ /* taint flows through environment-changing calls as well, so they do not discard what is known */
77
+ isUnsupportedFunctionCall(_nodeId) {
78
+ return false;
79
+ }
80
+ }
81
+ exports.TaintInterpreter = TaintInterpreter;
82
+ //# sourceMappingURL=taint-visitor.js.map
@@ -3,7 +3,7 @@
3
3
  * @module
4
4
  */
5
5
  import { SemVer } from 'semver';
6
- export declare const versionDate = "2026-10-30T07:17:04Z";
6
+ export declare const versionDate = "2026-11-03T08:51:21Z";
7
7
  /**
8
8
  * Retrieves the current flowR version as a new {@link SemVer} object.
9
9
  */
@@ -8,9 +8,9 @@ exports.flowrVersion = flowrVersion;
8
8
  */
9
9
  const semver_1 = require("semver");
10
10
  // this is automatically replaced with the current version by release-it
11
- const version = '2.16.8';
11
+ const version = '2.17.0';
12
12
  // this is automatically replaced with the release date by release-it (scripts/bump-version.ts)
13
- exports.versionDate = '2026-10-30T07:17:04Z';
13
+ exports.versionDate = '2026-11-03T08:51:21Z';
14
14
  /**
15
15
  * Retrieves the current flowR version as a new {@link SemVer} object.
16
16
  */