@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 @@
1
+ export declare const RPrimitives: ReadonlySet<string>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RPrimitives = void 0;
4
+ /*
5
+ * GENERATED, do not edit: the primitive functions of base R. R 4.6.1 (2026-06-24). Regenerate:
6
+ * Rscript -e 'b<-baseenv();n<-ls(b,all.names=TRUE);writeLines(sort(n[vapply(n,function(x)is.primitive(get(x,envir=b)),NA)]))'
7
+ */
8
+ exports.RPrimitives = new Set(["-", ":", "::", ":::", "!", "!=", "...elt", "...length", "...names", ".C", ".cache_class", ".Call", ".Call.graphics", ".class2", ".External", ".External.graphics", ".External2", ".Fortran", ".Internal", ".isMethodsDispatchOn", ".Primitive", ".primTrace", ".primUntrace", ".subset", ".subset2", "(", "[", "[[", "[[<-", "[<-", "{", "@", "@<-", "*", "/", "&", "&&", "%*%", "%/%", "%%", "^", "+", "<", "<-", "<<-", "<=", "=", "==", ">", ">=", "|", "||", "~", "$", "$<-", "abs", "acos", "acosh", "all", "any", "anyNA", "Arg", "as.call", "as.character", "as.complex", "as.double", "as.environment", "as.integer", "as.logical", "as.numeric", "as.raw", "asin", "asinh", "atan", "atanh", "attr", "attr<-", "attributes", "attributes<-", "baseenv", "break", "browser", "c", "call", "ceiling", "class", "class<-", "Conj", "cos", "cosh", "cospi", "crossprod", "cummax", "cummin", "cumprod", "cumsum", "declare", "digamma", "dim", "dim<-", "dimnames", "dimnames<-", "emptyenv", "enc2native", "enc2utf8", "environment<-", "Exec", "exp", "expm1", "expression", "floor", "for", "forceAndCall", "function", "gamma", "gc.time", "globalenv", "if", "Im", "interactive", "invisible", "is.array", "is.atomic", "is.call", "is.character", "is.complex", "is.double", "is.environment", "is.expression", "is.finite", "is.function", "is.infinite", "is.integer", "is.language", "is.list", "is.logical", "is.matrix", "is.na", "is.name", "is.nan", "is.null", "is.numeric", "is.object", "is.pairlist", "is.raw", "is.recursive", "is.single", "is.symbol", "isS4", "lazyLoadDBfetch", "length", "length<-", "levels<-", "lgamma", "list", "log", "log10", "log1p", "log2", "max", "min", "missing", "Mod", "names", "names<-", "nargs", "next", "nzchar", "oldClass", "oldClass<-", "on.exit", "pos.to.env", "proc.time", "prod", "quote", "range", "Re", "rep", "repeat", "retracemem", "return", "round", "seq_along", "seq_len", "seq.int", "sign", "signif", "sin", "sinh", "sinpi", "sqrt", "standardGeneric", "storage.mode<-", "substitute", "sum", "switch", "Tailcall", "tan", "tanh", "tanpi", "tcrossprod", "tracemem", "trigamma", "trunc", "unCfillPOSIXlt", "unclass", "untracemem", "UseMethod", "while", "xtfrm"]);
9
+ //# sourceMappingURL=r-primitives.generated.js.map
@@ -1,112 +1,112 @@
1
1
  {
2
- "format": "flowr-sigdb-remote",
3
- "schema": 2,
4
- "tag": "v2.12.3",
5
- "repo": "flowr-analysis/flowr",
6
- "shards": {
7
- "base.base-current.sigs.ndjson.br": {
8
- "sha256": "e416dbb477b7db257a024e564c4b1624bceec977f8935b5b7d886680bee51523",
9
- "bytes": 94093
10
- },
11
- "base.base-current.sigs.ndjson.zst": {
12
- "sha256": "344725e5e230667a6189a80dd69e70c7c5d3681b8955f8776b6c2d454ed13759",
13
- "bytes": 99922
14
- },
15
- "base.base-full.sigs.ndjson.br": {
16
- "sha256": "0631a4448840cd8ae5dd5495cb7a76736ed4157cb8a9614017571c9be8f281b6",
17
- "bytes": 427552
18
- },
19
- "base.base-full.sigs.ndjson.zst": {
20
- "sha256": "c6d4224dd34c53163af537731b767cf5ec100d688325aca560a6f732897f1306",
21
- "bytes": 464284
22
- },
23
- "base.dict.sigs.ndjson.br": {
24
- "sha256": "b9b67b8482d94790e549bd992285efcc1a0b6fe63e8c27f3aff90181b93e93b9",
25
- "bytes": 49912
26
- },
27
- "base.dict.sigs.ndjson.zst": {
28
- "sha256": "15ecccca667b47e3b5f29d8cc149efa6741455bb94a62740736753f8bbd84a89",
29
- "bytes": 51311
30
- },
31
- "base.manifest.json.br": {
32
- "sha256": "d7749a4146eee5f64a31a58c609dc1af537fd158672f468f04c3e45469d00f63",
33
- "bytes": 802
34
- },
35
- "base.manifest.json.zst": {
36
- "sha256": "84dc383f8414764e0f080d3b00ba53c54b9fed58285e67341d5c4182cc06402e",
37
- "bytes": 916
38
- },
39
- "current.base-current.sigs.ndjson.br": {
40
- "sha256": "664459693ec1ff507fae465dc91c34f4dd507063144bfe6ae4d18fd17cbbf132",
41
- "bytes": 101245
42
- },
43
- "current.base-current.sigs.ndjson.zst": {
44
- "sha256": "adb44ea28268be16428b59265865c567b5232bc1e015feef29802c3116d03d93",
45
- "bytes": 106631
46
- },
47
- "current.base-full.sigs.ndjson.br": {
48
- "sha256": "9e339e4916fdf11a0339591705eaa6d356656873355777ead3476fc4b607d247",
49
- "bytes": 443384
50
- },
51
- "current.base-full.sigs.ndjson.zst": {
52
- "sha256": "92ed0acca5215c4f7e45aabe4ea5b3266525a624deed03b73e351900689cbeba",
53
- "bytes": 479202
54
- },
55
- "current.current-rest.sigs.ndjson.br": {
56
- "sha256": "4b0eaaaf4322c0c661906933c758adbf8e1555d768f765e62e59e1cd5ce25371",
57
- "bytes": 15063281
58
- },
59
- "current.current-rest.sigs.ndjson.zst": {
60
- "sha256": "c9253bd53ed377e5ef17c328b2c6c9b095afd8745fa2d285a4f9e3cb9f50f4e5",
61
- "bytes": 15788300
62
- },
63
- "current.current-top.sigs.ndjson.br": {
64
- "sha256": "b9351afc6de023d65df243cb325b2a88c919acfdc872b7cb5b734d0a3d20a61f",
65
- "bytes": 2123308
66
- },
67
- "current.current-top.sigs.ndjson.zst": {
68
- "sha256": "c1cf6aced3ba0013e3369e7e1e0d843659bd74936d89343b8f65d0a83a1d270a",
69
- "bytes": 2224574
70
- },
71
- "current.dict.sigs.ndjson.br": {
72
- "sha256": "467798d91506e50cd419513acdc90b1ad40eb8888af3ca9e94b9292acccff42c",
73
- "bytes": 6635365
74
- },
75
- "current.dict.sigs.ndjson.zst": {
76
- "sha256": "ba26328b2e41d569470d7dcae74e8a7b71cc5b96129ac975a80aaaba7f14b900",
77
- "bytes": 6776106
78
- },
79
- "current.manifest.json.br": {
80
- "sha256": "9d150be7ef1c265dff29d8a07df8af9440a01cce5b3c4702ea5d4c175d7ad9d3",
81
- "bytes": 420886
82
- },
83
- "current.manifest.json.zst": {
84
- "sha256": "8f7fa0048b6e50560eb11a05e0b6c7cd73332f60f106b3051ff6db8135468a06",
85
- "bytes": 540936
86
- },
87
- "history.dict.sigs.ndjson.br": {
88
- "sha256": "d99208eadaa7bf5f2acd6ec41a05dba3eeffc68faa294cbd018a4b9b78e77107",
89
- "bytes": 6917713
90
- },
91
- "history.dict.sigs.ndjson.zst": {
92
- "sha256": "29d01db01b65d7b84f4b05f5c652905214be270b11e0ba802108178b810a2099",
93
- "bytes": 7048453
94
- },
95
- "history.history-rest.sigs.ndjson.br": {
96
- "sha256": "ddfa1dd8c5b2abcb8f14711c91c8e3490778759171933381929f612c939d92a1",
97
- "bytes": 29750045
98
- },
99
- "history.history-rest.sigs.ndjson.zst": {
100
- "sha256": "e83887af44e7894d85ddac23acf5347b8dc5a143ed8c83fc95a64fbdf9f7a4b7",
101
- "bytes": 32199780
102
- },
103
- "history.manifest.json.br": {
104
- "sha256": "bf79bca873f7b056915db8d845f31acec64c2bb75b423c21e0b40e6e5ecd8d33",
105
- "bytes": 335712
106
- },
107
- "history.manifest.json.zst": {
108
- "sha256": "a290c361dada2d97657aafe8d788e3b1f723ad3cfc31630a6338afe43d55b248",
109
- "bytes": 429934
110
- }
111
- }
2
+ "format": "flowr-sigdb-remote",
3
+ "schema": 2,
4
+ "tag": "v2.12.3",
5
+ "repo": "flowr-analysis/flowr",
6
+ "shards": {
7
+ "base.base-current.sigs.ndjson.br": {
8
+ "sha256": "e416dbb477b7db257a024e564c4b1624bceec977f8935b5b7d886680bee51523",
9
+ "bytes": 94093
10
+ },
11
+ "base.base-current.sigs.ndjson.zst": {
12
+ "sha256": "344725e5e230667a6189a80dd69e70c7c5d3681b8955f8776b6c2d454ed13759",
13
+ "bytes": 99922
14
+ },
15
+ "base.base-full.sigs.ndjson.br": {
16
+ "sha256": "0631a4448840cd8ae5dd5495cb7a76736ed4157cb8a9614017571c9be8f281b6",
17
+ "bytes": 427552
18
+ },
19
+ "base.base-full.sigs.ndjson.zst": {
20
+ "sha256": "c6d4224dd34c53163af537731b767cf5ec100d688325aca560a6f732897f1306",
21
+ "bytes": 464284
22
+ },
23
+ "base.dict.sigs.ndjson.br": {
24
+ "sha256": "b9b67b8482d94790e549bd992285efcc1a0b6fe63e8c27f3aff90181b93e93b9",
25
+ "bytes": 49912
26
+ },
27
+ "base.dict.sigs.ndjson.zst": {
28
+ "sha256": "15ecccca667b47e3b5f29d8cc149efa6741455bb94a62740736753f8bbd84a89",
29
+ "bytes": 51311
30
+ },
31
+ "base.manifest.json.br": {
32
+ "sha256": "d7749a4146eee5f64a31a58c609dc1af537fd158672f468f04c3e45469d00f63",
33
+ "bytes": 802
34
+ },
35
+ "base.manifest.json.zst": {
36
+ "sha256": "84dc383f8414764e0f080d3b00ba53c54b9fed58285e67341d5c4182cc06402e",
37
+ "bytes": 916
38
+ },
39
+ "current.base-current.sigs.ndjson.br": {
40
+ "sha256": "664459693ec1ff507fae465dc91c34f4dd507063144bfe6ae4d18fd17cbbf132",
41
+ "bytes": 101245
42
+ },
43
+ "current.base-current.sigs.ndjson.zst": {
44
+ "sha256": "adb44ea28268be16428b59265865c567b5232bc1e015feef29802c3116d03d93",
45
+ "bytes": 106631
46
+ },
47
+ "current.base-full.sigs.ndjson.br": {
48
+ "sha256": "9e339e4916fdf11a0339591705eaa6d356656873355777ead3476fc4b607d247",
49
+ "bytes": 443384
50
+ },
51
+ "current.base-full.sigs.ndjson.zst": {
52
+ "sha256": "92ed0acca5215c4f7e45aabe4ea5b3266525a624deed03b73e351900689cbeba",
53
+ "bytes": 479202
54
+ },
55
+ "current.current-rest.sigs.ndjson.br": {
56
+ "sha256": "4b0eaaaf4322c0c661906933c758adbf8e1555d768f765e62e59e1cd5ce25371",
57
+ "bytes": 15063281
58
+ },
59
+ "current.current-rest.sigs.ndjson.zst": {
60
+ "sha256": "c9253bd53ed377e5ef17c328b2c6c9b095afd8745fa2d285a4f9e3cb9f50f4e5",
61
+ "bytes": 15788300
62
+ },
63
+ "current.current-top.sigs.ndjson.br": {
64
+ "sha256": "b9351afc6de023d65df243cb325b2a88c919acfdc872b7cb5b734d0a3d20a61f",
65
+ "bytes": 2123308
66
+ },
67
+ "current.current-top.sigs.ndjson.zst": {
68
+ "sha256": "c1cf6aced3ba0013e3369e7e1e0d843659bd74936d89343b8f65d0a83a1d270a",
69
+ "bytes": 2224574
70
+ },
71
+ "current.dict.sigs.ndjson.br": {
72
+ "sha256": "467798d91506e50cd419513acdc90b1ad40eb8888af3ca9e94b9292acccff42c",
73
+ "bytes": 6635365
74
+ },
75
+ "current.dict.sigs.ndjson.zst": {
76
+ "sha256": "ba26328b2e41d569470d7dcae74e8a7b71cc5b96129ac975a80aaaba7f14b900",
77
+ "bytes": 6776106
78
+ },
79
+ "current.manifest.json.br": {
80
+ "sha256": "9d150be7ef1c265dff29d8a07df8af9440a01cce5b3c4702ea5d4c175d7ad9d3",
81
+ "bytes": 420886
82
+ },
83
+ "current.manifest.json.zst": {
84
+ "sha256": "8f7fa0048b6e50560eb11a05e0b6c7cd73332f60f106b3051ff6db8135468a06",
85
+ "bytes": 540936
86
+ },
87
+ "history.dict.sigs.ndjson.br": {
88
+ "sha256": "d99208eadaa7bf5f2acd6ec41a05dba3eeffc68faa294cbd018a4b9b78e77107",
89
+ "bytes": 6917713
90
+ },
91
+ "history.dict.sigs.ndjson.zst": {
92
+ "sha256": "29d01db01b65d7b84f4b05f5c652905214be270b11e0ba802108178b810a2099",
93
+ "bytes": 7048453
94
+ },
95
+ "history.history-rest.sigs.ndjson.br": {
96
+ "sha256": "ddfa1dd8c5b2abcb8f14711c91c8e3490778759171933381929f612c939d92a1",
97
+ "bytes": 29750045
98
+ },
99
+ "history.history-rest.sigs.ndjson.zst": {
100
+ "sha256": "e83887af44e7894d85ddac23acf5347b8dc5a143ed8c83fc95a64fbdf9f7a4b7",
101
+ "bytes": 32199780
102
+ },
103
+ "history.manifest.json.br": {
104
+ "sha256": "bf79bca873f7b056915db8d845f31acec64c2bb75b423c21e0b40e6e5ecd8d33",
105
+ "bytes": 335712
106
+ },
107
+ "history.manifest.json.zst": {
108
+ "sha256": "a290c361dada2d97657aafe8d788e3b1f723ad3cfc31630a6338afe43d55b248",
109
+ "bytes": 429934
110
+ }
111
+ }
112
112
  }
@@ -141,13 +141,19 @@ export declare class BuiltInIndex {
141
141
  static ofEnvironment(builtIns: BuiltIns): BuiltInIndex;
142
142
  /** answers are keyed by what was asked, as every caller asks the same handful of questions over and over */
143
143
  private cached;
144
- /** Every built-in carrying at least one property of `props`, like {@link SemanticCallTag.File} for the file calls. */
145
- with(props: PropSelector): readonly Identifier[];
144
+ /**
145
+ * Every built-in carrying at least one property of `props`, like {@link SemanticCallTag.File} for the file calls.
146
+ * @param props - The built-in must satisfy at least one of these properties.
147
+ * @param excluding - Drop built-ins that also carry any of these properties.
148
+ */
149
+ with(props: PropSelector, excluding?: PropSelector): readonly Identifier[];
146
150
  /**
147
151
  * Every built-in carrying *every* property of `props`, for the questions a single one cannot answer,
148
152
  * like {@link FileInputProps} for the calls that read a file rather than only write one.
153
+ * @param props - The built-in must satisfy all of these properties.
154
+ * @param excluding - Drop built-ins that also carry any of these properties.
149
155
  */
150
- withAll(props: PropSelector): readonly Identifier[];
156
+ withAll(props: PropSelector, excluding?: PropSelector): readonly Identifier[];
151
157
  /**
152
158
  * Every built-in that states its props but carries none of `props`. With {@link InputProps} this yields
153
159
  * the calls that derive their result from their arguments alone.
@@ -380,16 +380,24 @@ class BuiltInIndex {
380
380
  }
381
381
  return found;
382
382
  }
383
- /** Every built-in carrying at least one property of `props`, like {@link SemanticCallTag.File} for the file calls. */
384
- with(props) {
385
- return this.cached(`with:${function_semantics_1.FunctionSemantics.call.props.key(props)}`, e => function_semantics_1.FunctionSemantics.call.props.hasAny(e, props));
383
+ /**
384
+ * Every built-in carrying at least one property of `props`, like {@link SemanticCallTag.File} for the file calls.
385
+ * @param props - The built-in must satisfy at least one of these properties.
386
+ * @param excluding - Drop built-ins that also carry any of these properties.
387
+ */
388
+ with(props, excluding) {
389
+ const key = `with:${built_in_props_1.CallProps.key(props)}${excluding === undefined ? '' : `!${built_in_props_1.CallProps.key(excluding)}`}`;
390
+ return this.cached(key, e => built_in_props_1.CallProps.hasAny(e, props) && (excluding === undefined || !built_in_props_1.CallProps.hasAny(e, excluding)));
386
391
  }
387
392
  /**
388
393
  * Every built-in carrying *every* property of `props`, for the questions a single one cannot answer,
389
394
  * like {@link FileInputProps} for the calls that read a file rather than only write one.
395
+ * @param props - The built-in must satisfy all of these properties.
396
+ * @param excluding - Drop built-ins that also carry any of these properties.
390
397
  */
391
- withAll(props) {
392
- return this.cached(`all:${function_semantics_1.FunctionSemantics.call.props.key(props)}`, e => function_semantics_1.FunctionSemantics.call.props.hasAny(e) && function_semantics_1.FunctionSemantics.call.props.hasAll(e, props));
398
+ withAll(props, excluding) {
399
+ const key = `all:${built_in_props_1.CallProps.key(props)}${excluding === undefined ? '' : `!${built_in_props_1.CallProps.key(excluding)}`}`;
400
+ return this.cached(key, e => built_in_props_1.CallProps.hasAny(e) && built_in_props_1.CallProps.hasAll(e, props) && (excluding === undefined || !built_in_props_1.CallProps.hasAny(e, excluding)));
393
401
  }
394
402
  /**
395
403
  * Every built-in that states its props but carries none of `props`. With {@link InputProps} this yields
@@ -20,7 +20,6 @@ const edge_1 = require("../graph/edge");
20
20
  const assert_1 = require("../../util/assert");
21
21
  const objects_1 = require("../../util/objects");
22
22
  const vertex_1 = require("../graph/vertex");
23
- const built_in_proc_name_1 = require("../environments/built-in-proc-name");
24
23
  const node_value_1 = require("../eval/resolve/node-value");
25
24
  const string_constants_1 = require("../eval/values/string/string-constants");
26
25
  const r_value_1 = require("../eval/values/r-value");
@@ -253,18 +252,12 @@ function s3ClassOfValue(id, info) {
253
252
  }
254
253
  return undefined;
255
254
  }
256
- /** The value a plain assignment binds to the definition `def`, `undefined` for any other kind of definition (`class(x) <- `, `assign`, a parameter, ...). */
257
- function assignedValueOf(def, graph) {
258
- const vertex = graph.getVertex(def);
259
- const byAssignment = df_helper_1.Dataflow.targetsOf(graph, def, edge_1.EdgeType.DefinedBy).some(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Assignment));
260
- return vertex_1.DfgVertex.isVariableDefinition(vertex) && byAssignment && vertex.source?.length === 1 ? vertex.source[0] : undefined;
261
- }
262
255
  /** The class vectors S3 dispatch may see for the argument at `id`, one per reaching definition, `undefined` unless all are known. */
263
256
  function s3DispatchClassesOf(id, info) {
264
257
  const { graph } = info;
265
258
  const value = r_argument_1.RArgument.valueOf(info.idMap.get(id))?.info.id;
266
259
  const isRead = value !== undefined && vertex_1.DfgVertex.isUse(graph.getVertex(value));
267
- const values = isRead ? df_helper_1.Dataflow.targetsOf(graph, value, edge_1.EdgeType.Reads).map(def => assignedValueOf(def, graph)) : [value];
260
+ const values = isRead ? df_helper_1.Dataflow.targetsOf(graph, value, edge_1.EdgeType.Reads).map(def => df_helper_1.Dataflow.assignedValueOf(def, graph)) : [value];
268
261
  const classes = values.map(v => v === undefined ? undefined : s3ClassOfValue(v, info));
269
262
  return classes.length > 0 && classes.every(assert_1.isNotUndefined) ? classes : undefined;
270
263
  }
@@ -133,6 +133,8 @@ export declare const Dataflow: {
133
133
  * @see {@link Dataflow.calleeIdsOf} - for what a single call calls
134
134
  */
135
135
  readonly callsIn: (this: void, definition: DataflowGraphVertexFunctionDefinition, graph: DataflowGraph) => Generator<[NodeId, DataflowGraphVertexFunctionCall]>;
136
+ /** The value a plain assignment binds to the definition `def`, `undefined` for any other kind of definition (`class(x) <- `, `assign`, a parameter, ...). */
137
+ readonly assignedValueOf: (this: void, def: NodeId, graph: DataflowGraph) => NodeId | undefined;
136
138
  /** Every variable definition of the graph by its unquoted name, in a single pass. */
137
139
  readonly definitionsByName: (this: void, graph: DataflowGraph) => DefaultMap<string, NodeId[]>;
138
140
  /**
@@ -10,6 +10,7 @@ const transitive_side_effects_1 = require("../internal/process/functions/call/bu
10
10
  const node_id_1 = require("../../r-bridge/lang-4.x/ast/model/processing/node-id");
11
11
  const vertex_1 = require("./vertex");
12
12
  const identifier_1 = require("../environments/identifier");
13
+ const built_in_proc_name_1 = require("../environments/built-in-proc-name");
13
14
  const r_base_packages_1 = require("../../util/r-base-packages");
14
15
  const defaultmap_1 = require("../../util/collections/defaultmap");
15
16
  const linker_1 = require("../internal/linker");
@@ -204,6 +205,12 @@ exports.Dataflow = {
204
205
  }
205
206
  }
206
207
  },
208
+ /** The value a plain assignment binds to the definition `def`, `undefined` for any other kind of definition (`class(x) <- `, `assign`, a parameter, ...). */
209
+ assignedValueOf(def, graph) {
210
+ const vertex = graph.getVertex(def);
211
+ const byAssignment = exports.Dataflow.targetsOf(graph, def, edge_1.EdgeType.DefinedBy).some(t => vertex_1.DfgVertex.hasOrigin(graph.getVertex(t), built_in_proc_name_1.BuiltInProcName.Assignment));
212
+ return vertex_1.DfgVertex.isVariableDefinition(vertex) && byAssignment && vertex.source?.length === 1 ? vertex.source[0] : undefined;
213
+ },
207
214
  /** Every variable definition of the graph by its unquoted name, in a single pass. */
208
215
  definitionsByName(graph) {
209
216
  const byName = new defaultmap_1.DefaultMap(() => []);
@@ -252,6 +252,35 @@ function(x) {
252
252
  'package-runtime': {
253
253
  configType: 'PackageRuntimeConfig', ruleType: 'PACKAGE_RUNTIME', testfile: 'cmd-check/lint-package-runtime',
254
254
  example: { code: 'f <- function() 1', files: { DESCRIPTION: ExampleDescription, 'NAMESPACE': 'export(f)\nexport(g)\nexportPattern("^api_")\n' } }
255
+ },
256
+ 'secret-exfiltration': {
257
+ configType: 'SecretExfiltrationConfig', ruleType: 'SECRET_EXFILTRATION', testfile: 'lint-secret-exfiltration',
258
+ example: `
259
+ key <- Sys.getenv("API_KEY")
260
+ server <- function(input, output, session) {
261
+ httr2::request("https://api.example.org") |>
262
+ httr2::req_auth_bearer_token(key)
263
+ httr::GET(input$url, httr::add_headers(Authorization = key))
264
+ output$debug <- renderPrint(Sys.getenv())
265
+ message("calling with ", key)
266
+ message("key set: ", nzchar(key))
267
+ httr::GET(paste0("https://api.example.org/?key=", key))
268
+ }
269
+ `,
270
+ config: { optIn: ['url'] }
271
+ },
272
+ 'process-state-in-session': {
273
+ configType: 'ProcessStateInSessionConfig', ruleType: 'PROCESS_STATE_IN_SESSION', testfile: 'lint-process-state-in-session',
274
+ example: `
275
+ counter <- reactiveVal(0)
276
+ addResourcePath("data", "/srv/data")
277
+ server <- function(input, output, session) {
278
+ user <<- input$name
279
+ options(digits = input$digits)
280
+ counter(counter() + 1)
281
+ output$plot <- renderPlot(plot(load_for(session$user, input$n))) |> bindCache(input$n)
282
+ }
283
+ `
255
284
  }
256
285
  };
257
286
  /** the kinds of issue a rule finds, each rule carries at most one */
@@ -382,7 +382,7 @@ enables quick statistics after each REPL command. Likewise, ${ctx.linkConfig('re
382
382
  const inference = 'df-shape';
383
383
  const exampleCode = 'df <- data.frame(id = 1:3) |>\n filter(df, FALSE)';
384
384
  return `
385
- This query infers all shapes of dataframes within the code using abstract interpretaion. For example, you can use:
385
+ This query infers all shapes of dataframes within the code using abstract interpretation. For example, you can use:
386
386
  ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'absint', inference: inference }], { showCode: true, collapseQuery: true, ctx })}
387
387
 
388
388
  The query optionally also accepts slice criteria to narrow the results to specific nodes. For example:
@@ -390,6 +390,25 @@ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{ type: 'absint', infere
390
390
  `;
391
391
  }
392
392
  });
393
+ (0, doc_query_1.registerQueryDocumentation)('taint', {
394
+ type: 'active',
395
+ shortDescription: 'Returns the taint values inferred for every expression.',
396
+ buildExplanation: async (shell, ctx) => {
397
+ const defs = ['normalization-constant'];
398
+ const exampleCode = `
399
+ x <- c(1 , 2 , 3 , 4 , 5)\n
400
+ y <- scale(x)\n
401
+ z <- mean(y)`;
402
+ return `
403
+ This query infers all taints for one or multiple analysis definitions within the code using taint analysis.
404
+ For example, you can use the following query to get the results of the normalization analysis:
405
+ ${await (0, doc_query_1.showQuery)(shell, exampleCode, [{
406
+ type: 'taint',
407
+ defs: defs
408
+ }], { showCode: true, collapseQuery: true, ctx })}
409
+ `;
410
+ }
411
+ });
393
412
  (0, doc_query_1.registerQueryDocumentation)('compound', {
394
413
  name: 'Compound Query',
395
414
  type: 'virtual',
@@ -12,7 +12,8 @@ const secure_mode_1 = require("../util/secure-mode");
12
12
  const RegexRuleOptions = {
13
13
  'absolute-file-paths': ['absolutePathRegex'],
14
14
  'problematic-inputs': ['consider', 'pipeCommandFunctions'],
15
- 'no-leaked-credentials': ['credentialNamePattern', 'credentialValuePattern']
15
+ 'no-leaked-credentials': ['credentialNamePattern', 'credentialValuePattern', 'credentialCallPattern'],
16
+ 'secret-exfiltration': ['credentialNamePattern', 'credentialValuePattern', 'secretFiles', 'trustedFiles']
16
17
  };
17
18
  /** The given rule config without the {@link RegexRuleOptions} if the secure mode is enabled. */
18
19
  function withoutUntrustedRegexes(ruleName, config) {
@@ -1122,6 +1122,71 @@ export declare const LintingRules: {
1122
1122
  };
1123
1123
  };
1124
1124
  };
1125
+ readonly 'secret-exfiltration': {
1126
+ readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"from", [], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
1127
+ readonly processSearchResult: (_elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/secret-exfiltration").SecretExfiltrationConfig, data: import("..").ReadonlyFlowrAnalysisProvider<import("..").KnownParser>) => Promise<{
1128
+ results: import("./rules/secret-exfiltration").SecretExfiltrationResult[];
1129
+ '.meta': {
1130
+ secretSinkCalls: number;
1131
+ };
1132
+ }>;
1133
+ readonly prettyPrint: {
1134
+ readonly query: (r: import("./rules/secret-exfiltration").SecretExfiltrationResult, metadata: unknown) => string;
1135
+ readonly full: (r: import("./rules/secret-exfiltration").SecretExfiltrationResult, metadata: unknown) => string;
1136
+ };
1137
+ readonly info: {
1138
+ readonly name: "Secret Exfiltration";
1139
+ readonly tags: readonly [import("./linter-tags").LintingRuleTag.Bug, import("./linter-tags").LintingRuleTag.Security, import("./linter-tags").LintingRuleTag.Shiny];
1140
+ readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
1141
+ readonly description: "Finds secrets (environment, keyrings, config, credential files) sent to untrusted hosts, the browser, or logs, and optionally into urls, files, other processes, or language models.";
1142
+ readonly defaultConfig: () => {
1143
+ credentialNamePattern: string;
1144
+ credentialValuePattern: string;
1145
+ sources: never[];
1146
+ declassifiers: never[];
1147
+ sinks: readonly import("../taint-analysis/predefined/secret-analysis").SecretSink[];
1148
+ optIn: never[];
1149
+ controlledInputs: (import("../queries/catalog/input-sources-query/input-types").InputType.Parameter | import("../queries/catalog/input-sources-query/input-types").InputType.File | import("../queries/catalog/input-sources-query/input-types").InputType.Network | import("../queries/catalog/input-sources-query/input-types").InputType.CommandLine | import("../queries/catalog/input-sources-query/input-types").InputType.User)[];
1150
+ fileTrust: import("../taint-analysis/predefined/secret-analysis").FileTrust.None;
1151
+ secretFiles: string;
1152
+ trustedFiles: string;
1153
+ };
1154
+ };
1155
+ };
1156
+ readonly 'process-state-in-session': {
1157
+ readonly createSearch: () => import("../search/flowr-search-builder").FlowrSearchBuilder<"from", [], import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>>;
1158
+ readonly processSearchResult: (_elements: import("../search/flowr-search").FlowrSearchElements<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation, import("../search/flowr-search").FlowrSearchElement<import("../r-bridge/lang-4.x/ast/model/processing/decorate").ParentInformation>[]>, config: import("./rules/process-state-in-session").ProcessStateInSessionConfig, data: import("..").ReadonlyFlowrAnalysisProvider<import("..").KnownParser>) => Promise<{
1159
+ results: import("./rules/process-state-in-session").ProcessStateInSessionResult[];
1160
+ '.meta': {
1161
+ sessionFunctions: number;
1162
+ };
1163
+ }>;
1164
+ readonly prettyPrint: {
1165
+ readonly query: (r: import("./rules/process-state-in-session").ProcessStateInSessionResult, metadata: unknown) => string;
1166
+ readonly full: (r: import("./rules/process-state-in-session").ProcessStateInSessionResult, metadata: unknown) => string;
1167
+ };
1168
+ readonly info: {
1169
+ readonly name: "Process State in Session";
1170
+ readonly tags: readonly [import("./linter-tags").LintingRuleTag.Bug, import("./linter-tags").LintingRuleTag.Security, import("./linter-tags").LintingRuleTag.Shiny];
1171
+ readonly certainty: import("./linter-format").LintingRuleCertainty.BestEffort;
1172
+ readonly description: "Finds per-session Shiny code changing state all sessions share: globals, options, environment variables, the working directory, namespaces, top-level reactive values, shared caches (memoise, bindCache, cachem) whose key misses session values, and resource paths.";
1173
+ readonly defaultConfig: () => {
1174
+ sessionSignatures: string[][];
1175
+ settings: {
1176
+ options: string;
1177
+ 'Sys.setenv': string;
1178
+ 'Sys.unsetenv': string;
1179
+ setwd: string;
1180
+ 'Sys.setlocale': string;
1181
+ 'set.seed': string;
1182
+ 'Sys.umask': string;
1183
+ };
1184
+ sharedState: string[];
1185
+ caches: string[];
1186
+ memoisers: string[];
1187
+ };
1188
+ };
1189
+ };
1125
1190
  };
1126
1191
  export type LintingRuleNames = keyof typeof LintingRules;
1127
1192
  export type LintingRuleMetadata<Name extends LintingRuleNames> = typeof LintingRules[Name] extends LintingRule<infer _Result, infer Metadata, infer _Config, infer _Info, infer _Elements> ? Metadata : never;
@@ -43,6 +43,8 @@ const package_metafiles_1 = require("./rules/cmd-check/package-metafiles");
43
43
  const rd_files_1 = require("./rules/cmd-check/rd-files");
44
44
  const package_data_1 = require("./rules/cmd-check/package-data");
45
45
  const package_runtime_1 = require("./rules/cmd-check/package-runtime");
46
+ const secret_exfiltration_1 = require("./rules/secret-exfiltration");
47
+ const process_state_in_session_1 = require("./rules/process-state-in-session");
46
48
  /**
47
49
  * The registry of currently supported linting rules.
48
50
  * A linting rule can be executed on a dataflow pipeline result using {@link executeLintingRule}.
@@ -89,6 +91,8 @@ exports.LintingRules = {
89
91
  'package-metafiles': package_metafiles_1.PACKAGE_METAFILES,
90
92
  'rd-files': rd_files_1.RD_FILES,
91
93
  'package-data': package_data_1.PACKAGE_DATA,
92
- 'package-runtime': package_runtime_1.PACKAGE_RUNTIME
94
+ 'package-runtime': package_runtime_1.PACKAGE_RUNTIME,
95
+ 'secret-exfiltration': secret_exfiltration_1.SECRET_EXFILTRATION,
96
+ 'process-state-in-session': process_state_in_session_1.PROCESS_STATE_IN_SESSION
93
97
  };
94
98
  //# sourceMappingURL=linter-rules.js.map
@@ -1,8 +1,13 @@
1
+ import type { DataflowGraphVertexFunctionCall } from '../../../dataflow/graph/vertex';
1
2
  import { LintingRuleCertainty } from '../../linter-format';
2
3
  import type { MergeableRecord } from '../../../util/objects';
3
4
  import { LintingRuleTag } from '../../linter-tags';
4
- import type { ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
+ import { NodeId } from '../../../r-bridge/lang-4.x/ast/model/processing/node-id';
6
+ import type { AstIdMap, ParentInformation } from '../../../r-bridge/lang-4.x/ast/model/processing/decorate';
7
+ import type { DataflowInformation } from '../../../dataflow/info';
8
+ import type { ReadOnlyFlowrAnalyzerContext } from '../../../project/context/flowr-analyzer-context';
5
9
  import { type CmdCheckResult } from './cmd-check-util';
10
+ import { RNode } from '../../../r-bridge/lang-4.x/ast/model/model';
6
11
  /** how the code changes the global environment or the search path */
7
12
  export type GlobalEnvironmentModificationKind =
8
13
  /** `assign(..., envir = globalenv())` */
@@ -30,6 +35,14 @@ export interface GlobalEnvironmentModificationMetadata extends MergeableRecord {
30
35
  /** calls of `assign`, `data` and `attach` inspected */
31
36
  readonly consideredCalls: number;
32
37
  }
38
+ /** the variable an `assign` into the global environment writes (`undefined` if not constant) */
39
+ export declare function globalAssignment(call: DataflowGraphVertexFunctionCall, df: DataflowInformation, idMap: AstIdMap, ctx: ReadOnlyFlowrAnalyzerContext): {
40
+ variable?: string;
41
+ } | undefined;
42
+ /** the variable an assignment target writes, looking through replacement calls and accesses (`names(x)`, `x$a`, `x[[1]]`) */
43
+ export declare function targetVariable(lhs: RNode<ParentInformation>): string | undefined;
44
+ /** what a `<<-` in a package function writes: a binding of an enclosing scope, the package namespace, or the global environment */
45
+ export declare function superAssignmentTarget(op: RNode<ParentInformation>, name: string, idMap: AstIdMap, topLevel: ReadonlySet<string>, memo: Map<NodeId, ReadonlySet<string>>): 'enclosing' | 'namespace' | 'global' | 'top-level';
33
46
  /**
34
47
  * Port of the `R CMD check` notes on code that changes the global environment
35
48
  * (`checking R code for possible problems`): `tools:::.check_package_code_assign_to_globalenv`,
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GLOBAL_ENVIRONMENT_MODIFICATION = void 0;
4
+ exports.globalAssignment = globalAssignment;
5
+ exports.targetVariable = targetVariable;
6
+ exports.superAssignmentTarget = superAssignmentTarget;
4
7
  const linter_format_1 = require("../../linter-format");
5
8
  const r_symbol_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
6
9
  const r_number_1 = require("../../../r-bridge/lang-4.x/ast/model/nodes/r-number");
@@ -53,6 +56,15 @@ function denotesGlobalEnv(node, environment, df, idMap, ctx, depth = 0) {
53
56
  return value !== undefined && denotesGlobalEnv(value, df.graph.getVertex(d)?.environment ?? environment, df, idMap, ctx, depth + 1);
54
57
  });
55
58
  }
59
+ /** the variable an `assign` into the global environment writes (`undefined` if not constant) */
60
+ function globalAssignment(call, df, idMap, ctx) {
61
+ const args = function_semantics_1.FunctionSemantics.call.match.toSpec(call.args, EnvironmentWriters.assign);
62
+ const arg = (formal) => r_argument_1.RArgument.valueOf(args.get(formal)?.length === 1 ? idMap.get(args.get(formal)?.[0] ?? '') : undefined);
63
+ const env = call.environment ?? df.environment;
64
+ const target = arg('x');
65
+ const global = denotesGlobalEnv(arg('envir'), env, df, idMap, ctx) || denotesGlobalPos(arg('pos')) || denotesGlobalEnv(arg('pos'), env, df, idMap, ctx);
66
+ return global ? { variable: r_string_1.RString.is(target) ? target.content.str : undefined } : undefined;
67
+ }
56
68
  /** whether a `pos` argument names the global environment, which is the first entry of the search path */
57
69
  function denotesGlobalPos(node) {
58
70
  return (r_number_1.RNumber.is(node) && node.content.num === 1) || (r_string_1.RString.is(node) && node.content.str === '.GlobalEnv');
@@ -181,13 +193,9 @@ exports.GLOBAL_ENVIRONMENT_MODIFICATION = {
181
193
  add(node, 'attach', 'attach() puts an object on the search path, where it masks and is masked by others; access it directly or use with() instead');
182
194
  break;
183
195
  case 'assign': {
184
- const target = valueOf(arg('x'));
185
- const variable = r_string_1.RString.is(target) ? target.content.str : undefined;
186
- if (variable !== undefined && allowed.has(variable)) {
187
- break;
188
- }
189
- if (denotesGlobalEnv(valueOf(arg('envir')), env, df, idMap, ctx) || denotesGlobalPos(valueOf(arg('pos'))) || denotesGlobalEnv(valueOf(arg('pos')), env, df, idMap, ctx)) {
190
- add(node, 'assign', `assign() writes ${variable === undefined ? 'a variable' : `'${variable}'`} into the global environment, which belongs to the user`, variable);
196
+ const global = globalAssignment(call, df, idMap, ctx);
197
+ if (global !== undefined && (global.variable === undefined || !allowed.has(global.variable))) {
198
+ add(node, 'assign', `assign() writes ${global.variable === undefined ? 'a variable' : `'${global.variable}'`} into the global environment, which belongs to the user`, global.variable);
191
199
  }
192
200
  break;
193
201
  }