@eagleoutice/flowr 2.16.7 → 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 (106) 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/identifier.d.ts +1 -1
  20. package/dataflow/environments/query-fn-props.d.ts +9 -3
  21. package/dataflow/environments/query-fn-props.js +13 -5
  22. package/dataflow/environments/reference-to-maybe.js +1 -6
  23. package/dataflow/fn/class-declaration.js +1 -8
  24. package/dataflow/graph/dataflowgraph-builder.d.ts +4 -4
  25. package/dataflow/graph/df-helper.d.ts +2 -0
  26. package/dataflow/graph/df-helper.js +7 -0
  27. package/dataflow/graph/graph.js +3 -10
  28. package/dataflow/graph/vertex.d.ts +1 -1
  29. package/dataflow/hooks.d.ts +1 -1
  30. package/dataflow/info.d.ts +3 -3
  31. package/dataflow/internal/linker.js +1 -1
  32. package/dataflow/internal/process/functions/call/built-in/built-in-ambient-state.d.ts +2 -2
  33. package/dataflow/internal/process/functions/call/built-in/built-in-library.d.ts +1 -1
  34. package/dataflow/internal/process/functions/call/built-in/built-in-try-catch.js +1 -7
  35. package/dataflow/processor.d.ts +1 -1
  36. package/documentation/wiki-linter.js +29 -0
  37. package/documentation/wiki-query.js +20 -1
  38. package/linter/linter-executor.js +2 -1
  39. package/linter/linter-rules.d.ts +65 -0
  40. package/linter/linter-rules.js +5 -1
  41. package/linter/rules/cmd-check/global-environment-modification.d.ts +14 -1
  42. package/linter/rules/cmd-check/global-environment-modification.js +15 -7
  43. package/linter/rules/no-leaked-credentials.d.ts +1 -0
  44. package/linter/rules/no-leaked-credentials.js +3 -3
  45. package/linter/rules/process-state-in-session.d.ts +71 -0
  46. package/linter/rules/process-state-in-session.js +267 -0
  47. package/linter/rules/secret-exfiltration.d.ts +80 -0
  48. package/linter/rules/secret-exfiltration.js +183 -0
  49. package/package.json +1 -1
  50. package/project/flowr-analyzer.d.ts +6 -0
  51. package/project/flowr-analyzer.js +4 -0
  52. package/project/plugins/file-plugins/files/flowr-namespace-file.d.ts +2 -0
  53. package/project/plugins/file-plugins/files/flowr-namespace-file.js +22 -3
  54. package/project/sigdb/decompress.d.ts +4 -0
  55. package/project/sigdb/decompress.js +60 -25
  56. package/project/sigdb/manifest.d.ts +1 -1
  57. package/project/sigdb/manifest.js +2 -5
  58. package/project/sigdb/reader.js +15 -6
  59. package/project/sigdb/sigdb-download.d.ts +3 -7
  60. package/project/sigdb/sigdb-download.js +71 -72
  61. package/queries/catalog/taint-query/taint-query-executor.d.ts +7 -0
  62. package/queries/catalog/taint-query/taint-query-executor.js +30 -0
  63. package/queries/catalog/taint-query/taint-query-format.d.ts +29 -0
  64. package/queries/catalog/taint-query/taint-query-format.js +124 -0
  65. package/queries/query.d.ts +12 -1
  66. package/queries/query.js +2 -0
  67. package/taint-analysis/builder/domain.d.ts +14 -0
  68. package/taint-analysis/builder/domain.js +69 -0
  69. package/taint-analysis/builder/report-template.d.ts +50 -0
  70. package/taint-analysis/builder/report-template.js +46 -0
  71. package/taint-analysis/builder/taint-analysis-definition.d.ts +108 -0
  72. package/taint-analysis/builder/taint-analysis-definition.js +128 -0
  73. package/taint-analysis/builder/taint-analysis.d.ts +124 -0
  74. package/taint-analysis/builder/taint-analysis.js +93 -0
  75. package/taint-analysis/builtin-index-bridge.d.ts +20 -0
  76. package/taint-analysis/builtin-index-bridge.js +48 -0
  77. package/taint-analysis/eval/eval.d.ts +1 -0
  78. package/taint-analysis/eval/eval.js +124 -0
  79. package/taint-analysis/eval/instrumentation.d.ts +59 -0
  80. package/taint-analysis/eval/instrumentation.js +124 -0
  81. package/taint-analysis/finite-domain.d.ts +41 -0
  82. package/taint-analysis/finite-domain.js +118 -0
  83. package/taint-analysis/function-categories.d.ts +31 -0
  84. package/taint-analysis/function-categories.js +61 -0
  85. package/taint-analysis/logger.d.ts +1 -0
  86. package/taint-analysis/logger.js +6 -0
  87. package/taint-analysis/predefined/determinism.d.ts +6 -0
  88. package/taint-analysis/predefined/determinism.js +14 -0
  89. package/taint-analysis/predefined/normalization.d.ts +17 -0
  90. package/taint-analysis/predefined/normalization.js +150 -0
  91. package/taint-analysis/predefined/predefined.d.ts +12 -0
  92. package/taint-analysis/predefined/predefined.js +18 -0
  93. package/taint-analysis/predefined/randomness-analysis.d.ts +6 -0
  94. package/taint-analysis/predefined/randomness-analysis.js +124 -0
  95. package/taint-analysis/predefined/secret-analysis.d.ts +77 -0
  96. package/taint-analysis/predefined/secret-analysis.js +165 -0
  97. package/taint-analysis/predefined/security-analysis.d.ts +7 -0
  98. package/taint-analysis/predefined/security-analysis.js +91 -0
  99. package/taint-analysis/taint-mapping.d.ts +86 -0
  100. package/taint-analysis/taint-mapping.js +70 -0
  101. package/taint-analysis/taint-resolve.d.ts +26 -0
  102. package/taint-analysis/taint-resolve.js +86 -0
  103. package/taint-analysis/taint-visitor.d.ts +80 -0
  104. package/taint-analysis/taint-visitor.js +82 -0
  105. package/util/flowr-version.d.ts +1 -1
  106. package/util/flowr-version.js +2 -2
@@ -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
  }
@@ -2,6 +2,7 @@ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
2
  import type { MergeableRecord } from '../../util/objects';
3
3
  import { LintingRuleTag } from '../linter-tags';
4
4
  import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
+ export declare const defaultCredentialValuePattern: string;
5
6
  export interface NoLeakedCredentialsResult extends LintingResult {
6
7
  readonly variableName: string;
7
8
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NO_LEAKED_CREDENTIALS = void 0;
3
+ exports.NO_LEAKED_CREDENTIALS = exports.defaultCredentialValuePattern = void 0;
4
4
  const linter_format_1 = require("../linter-format");
5
5
  const flowr_search_builder_1 = require("../../search/flowr-search-builder");
6
6
  const range_1 = require("../../util/range");
@@ -17,7 +17,7 @@ const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
17
17
  const df_helper_1 = require("../../dataflow/graph/df-helper");
18
18
  const defaultCredentialNamePattern = '(?:passw(?:or)?d|authorization|passphrase|(?:^|[_.])pass(?:$|[_.])|pwd|secret|api[_.]?key|access[_.]?key|(?:^|[_.])token$|api[_.]?token|access[_.]?token|auth[_.]?token|bearer[_.]?token|private[_.]?key|credential|(?:^|[_.])pat$)';
19
19
  const defaultCredentialCallPattern = '(?:auth|login|signin|credential|password|secret|token|key_?set)';
20
- const defaultCredentialValuePattern = '(?:(?<![A-Za-z0-9_])|(?<=\\\\[nrt]))(?:' +
20
+ exports.defaultCredentialValuePattern = '(?:(?<![A-Za-z0-9_])|(?<=\\\\[nrt]))(?:' +
21
21
  '(?:AKIA|AIPA|ASIA|AROA)[A-Z0-9]{16}' + // AWS access key IDs (exact 20-char format)
22
22
  '|gh[psoar]_[A-Za-z0-9_]{10,}' + // GitHub Classic/App/OAuth/Actions tokens
23
23
  '|github_pat_[A-Za-z0-9_]{10,}' + // GitHub fine-grained PATs
@@ -158,7 +158,7 @@ exports.NO_LEAKED_CREDENTIALS = {
158
158
  certainty: linter_format_1.LintingRuleCertainty.BestEffort,
159
159
  defaultConfig: () => ({
160
160
  credentialNamePattern: defaultCredentialNamePattern,
161
- credentialValuePattern: defaultCredentialValuePattern,
161
+ credentialValuePattern: exports.defaultCredentialValuePattern,
162
162
  credentialCallPattern: defaultCredentialCallPattern
163
163
  })
164
164
  }
@@ -0,0 +1,71 @@
1
+ import { type LintingResult, LintingRuleCertainty } from '../linter-format';
2
+ import type { MergeableRecord } from '../../util/objects';
3
+ import { LintingRuleTag } from '../linter-tags';
4
+ import type { ParentInformation } from '../../r-bridge/lang-4.x/ast/model/processing/decorate';
5
+ /** Ways per-session code changes process-wide state: `<<-` and `assign` to globals, `assignInNamespace`, setters like `options`, top-level reactive values, cache keys missing session values, and `addResourcePath` */
6
+ export declare enum ProcessStateChange {
7
+ GlobalSuperAssignment = "global-superassignment",
8
+ GlobalAssign = "global-assign",
9
+ NamespacePatch = "namespace-patch",
10
+ ProcessSetting = "process-setting",
11
+ SharedState = "shared-state",
12
+ CacheKey = "cache-key",
13
+ ResourcePath = "resource-path"
14
+ }
15
+ export interface ProcessStateInSessionResult extends LintingResult {
16
+ readonly change: ProcessStateChange;
17
+ /** the function or variable changing the state */
18
+ readonly name: string;
19
+ /** what to use instead */
20
+ readonly suggestion: string;
21
+ }
22
+ export interface ProcessStateInSessionConfig extends MergeableRecord {
23
+ /** parameter lists marking a session function (Shiny server or module), all of one must be present */
24
+ readonly sessionSignatures: readonly (readonly string[])[];
25
+ /** process-wide setters, with what to use instead */
26
+ readonly settings: Readonly<Record<string, string>>;
27
+ /** functions creating state, shared when called at the top level */
28
+ readonly sharedState: readonly string[];
29
+ /** cache constructors */
30
+ readonly caches: readonly string[];
31
+ /** memoisers */
32
+ readonly memoisers: readonly string[];
33
+ }
34
+ export interface ProcessStateInSessionMetadata extends MergeableRecord {
35
+ /** functions run per session */
36
+ readonly sessionFunctions: number;
37
+ }
38
+ export declare const PROCESS_STATE_IN_SESSION: {
39
+ readonly createSearch: () => import("../../search/flowr-search-builder").FlowrSearchBuilder<"from", [], ParentInformation, import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>>;
40
+ readonly processSearchResult: (_elements: import("../../search/flowr-search").FlowrSearchElements<ParentInformation, import("../../search/flowr-search").FlowrSearchElement<ParentInformation>[]>, config: ProcessStateInSessionConfig, data: import("../..").ReadonlyFlowrAnalysisProvider<import("../..").KnownParser>) => Promise<{
41
+ results: ProcessStateInSessionResult[];
42
+ '.meta': {
43
+ sessionFunctions: number;
44
+ };
45
+ }>;
46
+ readonly prettyPrint: {
47
+ readonly query: (r: ProcessStateInSessionResult, metadata: unknown) => string;
48
+ readonly full: (r: ProcessStateInSessionResult, metadata: unknown) => string;
49
+ };
50
+ readonly info: {
51
+ readonly name: "Process State in Session";
52
+ readonly tags: readonly [LintingRuleTag.Bug, LintingRuleTag.Security, LintingRuleTag.Shiny];
53
+ readonly certainty: LintingRuleCertainty.BestEffort;
54
+ 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.";
55
+ readonly defaultConfig: () => {
56
+ sessionSignatures: string[][];
57
+ settings: {
58
+ options: string;
59
+ 'Sys.setenv': string;
60
+ 'Sys.unsetenv': string;
61
+ setwd: string;
62
+ 'Sys.setlocale': string;
63
+ 'set.seed': string;
64
+ 'Sys.umask': string;
65
+ };
66
+ sharedState: string[];
67
+ caches: string[];
68
+ memoisers: string[];
69
+ };
70
+ };
71
+ };
@@ -0,0 +1,267 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PROCESS_STATE_IN_SESSION = exports.ProcessStateChange = void 0;
4
+ const linter_format_1 = require("../linter-format");
5
+ const flowr_search_builder_1 = require("../../search/flowr-search-builder");
6
+ const range_1 = require("../../util/range");
7
+ const linter_tags_1 = require("../linter-tags");
8
+ const model_1 = require("../../r-bridge/lang-4.x/ast/model/model");
9
+ const r_binary_op_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-binary-op");
10
+ const r_function_call_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-call");
11
+ const r_function_definition_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-function-definition");
12
+ const r_access_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-access");
13
+ const r_symbol_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-symbol");
14
+ const r_expression_list_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-expression-list");
15
+ const r_parameter_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-parameter");
16
+ const r_pipe_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-pipe");
17
+ const r_string_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-string");
18
+ const r_argument_1 = require("../../r-bridge/lang-4.x/ast/model/nodes/r-argument");
19
+ const vertex_1 = require("../../dataflow/graph/vertex");
20
+ const edge_1 = require("../../dataflow/graph/edge");
21
+ const df_helper_1 = require("../../dataflow/graph/df-helper");
22
+ const identifier_1 = require("../../dataflow/environments/identifier");
23
+ const linter_util_1 = require("../linter-util");
24
+ const function_semantics_1 = require("../../dataflow/fn/function-semantics");
25
+ const arrays_1 = require("../../util/collections/arrays");
26
+ const linker_1 = require("../../dataflow/internal/linker");
27
+ const cmd_check_util_1 = require("./cmd-check/cmd-check-util");
28
+ const global_environment_modification_1 = require("./cmd-check/global-environment-modification");
29
+ /** Ways per-session code changes process-wide state: `<<-` and `assign` to globals, `assignInNamespace`, setters like `options`, top-level reactive values, cache keys missing session values, and `addResourcePath` */
30
+ var ProcessStateChange;
31
+ (function (ProcessStateChange) {
32
+ ProcessStateChange["GlobalSuperAssignment"] = "global-superassignment";
33
+ ProcessStateChange["GlobalAssign"] = "global-assign";
34
+ ProcessStateChange["NamespacePatch"] = "namespace-patch";
35
+ ProcessStateChange["ProcessSetting"] = "process-setting";
36
+ ProcessStateChange["SharedState"] = "shared-state";
37
+ ProcessStateChange["CacheKey"] = "cache-key";
38
+ ProcessStateChange["ResourcePath"] = "resource-path";
39
+ })(ProcessStateChange || (exports.ProcessStateChange = ProcessStateChange = {}));
40
+ const SessionLocal = 'session$userData or a value created within the server function';
41
+ /** the functions reading what a setter changes */
42
+ const SettingReaders = { 'options': ['getOption', 'options'], 'Sys.setenv': ['Sys.getenv'], 'Sys.unsetenv': ['Sys.getenv'], 'setwd': ['getwd'], 'Sys.setlocale': ['Sys.getlocale'] };
43
+ const MagrittrPipe = new Set(['%>%']);
44
+ const parentOf = (model_1.RNode.directParent);
45
+ const argValue = (r_argument_1.RArgument.valueOf);
46
+ const argumentValue = (call, name) => argValue(r_argument_1.RArgument.findNamed(call.arguments, name));
47
+ /** the value a plain assignment binds to the definition `def` */
48
+ const assigned = (def, graph, idMap) => idMap.get(df_helper_1.Dataflow.assignedValueOf(def, graph) ?? '');
49
+ const references = (node, graph) => [node.info.id, ...df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads)];
50
+ const extendsPath = (path, prefix) => path.startsWith(prefix) && (path.length === prefix.length || '$('.includes(path[prefix.length]));
51
+ /** whether the call is undone when its function exits, as in `op <- options(x = 1); on.exit(options(op))` */
52
+ function restoredOnExit(call, name, idMap) {
53
+ const fn = idMap.get(model_1.RNode.strictlyEnclosingFunction(call.info.id, idMap) ?? -1);
54
+ let restored = false;
55
+ model_1.RNode.visitAst(r_function_definition_1.RFunctionDefinition.is(fn) ? fn.body : undefined, n => {
56
+ if (r_function_call_1.RFunctionCall.isNamed(n, 'on.exit')) {
57
+ model_1.RNode.visitAst(n, inner => {
58
+ restored ||= r_function_call_1.RFunctionCall.isNamed(inner, name);
59
+ });
60
+ }
61
+ return restored || r_function_definition_1.RFunctionDefinition.is(n);
62
+ });
63
+ return restored;
64
+ }
65
+ /** variables bound at the top level to a call of `creators`, by id */
66
+ function topLevelOf(nodes, idMap, creators) {
67
+ return new Map(nodes.flatMap(n => r_binary_op_1.RBinaryOp.is(n) && ['<-', '='].includes(n.operator) && r_symbol_1.RSymbol.is(n.lhs) && r_function_call_1.RFunctionCall.isNamed(n.rhs, new Set(creators))
68
+ && model_1.RNode.strictlyEnclosingFunction(n.info.id, idMap) === undefined ? [[n.lhs.info.id, identifier_1.Identifier.getName(n.lhs.content)]] : []));
69
+ }
70
+ const fieldName = (access) => access.access.length === 1 ? (0, linker_1.accessedFieldName)(argValue(access.access[0]), r_access_1.RAccess.isNamed(access)) : undefined;
71
+ /** the path a symbol is read by, e.g., `session$user$name` or `rv()` */
72
+ function readPath(symbol, idMap) {
73
+ let path = identifier_1.Identifier.getName(symbol.content);
74
+ for (let cur = symbol, parent = parentOf(cur, idMap); parent !== undefined; cur = parent, parent = parentOf(cur, idMap)) {
75
+ const field = r_access_1.RAccess.is(parent) && parent.accessed === cur ? fieldName(parent) : undefined;
76
+ const read = r_function_call_1.RFunctionCall.isNamed(parent) && parent.functionName === cur && parent.arguments.length === 0;
77
+ if (field === undefined && !read) {
78
+ break;
79
+ }
80
+ path += field === undefined ? '()' : `$${field}`;
81
+ }
82
+ return path;
83
+ }
84
+ /** session values (parameters, reactive state, globals and settings a session writes) an expression reads, as paths; definitions are followed */
85
+ function sessionDependence(graph, idMap, sessions, stateCreators, writtenGlobals, changedSettings) {
86
+ const inSession = (id) => sessions.some(s => (0, cmd_check_util_1.isWithin)(id, s, idMap));
87
+ const isSessionValue = (def) => {
88
+ const node = idMap.get(def);
89
+ const param = r_parameter_1.RParameter.is(node) ? node : node && parentOf(node, idMap);
90
+ return r_parameter_1.RParameter.is(param) ? sessions.includes(param.info.parent ?? -1) : inSession(def) && r_function_call_1.RFunctionCall.isNamed(assigned(def, graph, idMap), stateCreators);
91
+ };
92
+ /* reads without a resolved definition (reactives and function bodies run later) use the definitions in scope */
93
+ const byName = df_helper_1.Dataflow.definitionsByName(graph);
94
+ const inScope = (symbol) => byName.get(identifier_1.Identifier.getName(symbol.content)).filter(d => {
95
+ const scope = model_1.RNode.strictlyEnclosingFunction(d, idMap);
96
+ return scope === undefined || (0, cmd_check_util_1.isWithin)(symbol.info.id, scope, idMap);
97
+ });
98
+ const expanded = new Map();
99
+ const ofDefinition = (def) => {
100
+ if (!expanded.has(def)) {
101
+ expanded.set(def, new Set());
102
+ expanded.set(def, of(assigned(def, graph, idMap)));
103
+ }
104
+ return expanded.get(def) ?? new Set();
105
+ };
106
+ const of = (root) => {
107
+ const paths = new Set();
108
+ model_1.RNode.visitAst(root, n => {
109
+ const parent = parentOf(n, idMap);
110
+ if (!r_symbol_1.RSymbol.is(n) || vertex_1.DfgVertex.isVariableDefinition(graph.getVertex(n.info.id)) || (r_argument_1.RArgument.is(parent) && r_access_1.RAccess.isNamed(parentOf(parent, idMap)))) {
111
+ return;
112
+ }
113
+ const reader = r_function_call_1.RFunctionCall.isNamed(parent) && parent.functionName === n ? parent : n;
114
+ const read = df_helper_1.Dataflow.targetsOf(graph, reader.info.id, edge_1.EdgeType.Reads);
115
+ const defs = read.length > 0 ? read : inScope(n);
116
+ const name = identifier_1.Identifier.getName(n.content);
117
+ if (writtenGlobals.has(name) || (reader !== n && changedSettings.has(name)) || defs.some(isSessionValue)) {
118
+ paths.add(readPath(n, idMap));
119
+ }
120
+ else {
121
+ defs.forEach(d => ofDefinition(d).forEach(p => paths.add(p)));
122
+ }
123
+ });
124
+ return paths;
125
+ };
126
+ return {
127
+ inSession,
128
+ /** session values `value` depends on that `key` misses */
129
+ missing: (value, key) => {
130
+ const keyPaths = key.flatMap(k => [...of(k)]);
131
+ return (0, arrays_1.uniqueArray)(value.flatMap(v => [...of(v)])).filter(p => !keyPaths.some(k => extendsPath(p, k) || extendsPath(k, p)));
132
+ }
133
+ };
134
+ }
135
+ /** whether a cache argument names a shared cache, calls create fresh ones unless a function returns a shared one */
136
+ function sharedCache(arg, graph, idMap, inSession, absent) {
137
+ if (arg === undefined || r_string_1.RString.is(arg)) {
138
+ return arg === undefined ? absent : arg.content.str !== 'session';
139
+ }
140
+ else if (r_function_call_1.RFunctionCall.isNamed(arg)) {
141
+ return (0, cmd_check_util_1.calledDefinitions)(graph, arg.info.id, idMap).some(fn => sharedCache(r_expression_list_1.RExpressionList.is(fn.body) ? fn.body.children.at(-1) : fn.body, graph, idMap, inSession, false));
142
+ }
143
+ const defs = df_helper_1.Dataflow.targetsOf(graph, arg.info.id, edge_1.EdgeType.Reads);
144
+ return r_symbol_1.RSymbol.is(arg) && (defs.length === 0 || defs.some(d => !inSession(d)));
145
+ }
146
+ /** the expression `bindCache` caches when it is piped into it */
147
+ function pipedInto(call, idMap) {
148
+ const parent = parentOf(call, idMap);
149
+ const outer = r_argument_1.RArgument.is(parent) ? parentOf(parent, idMap) : undefined;
150
+ return r_pipe_1.RPipe.is(parent) ? parent.rhs === call ? parent.lhs : undefined
151
+ : r_function_call_1.RFunctionCall.isNamed(outer, MagrittrPipe) && argValue(outer.arguments[1]) === call ? argValue(outer.arguments[0]) : undefined;
152
+ }
153
+ /** a write to a shared cache: by `bindCache`, a function a memoiser wraps, or `$set` of a cache */
154
+ function cacheWrite(node, graph, idMap, inSession, caches, memoisers) {
155
+ if (r_function_call_1.RFunctionCall.isNamed(node, new Set(['bindCache']))) {
156
+ const args = node.arguments.filter(a => a === r_function_call_1.EmptyArgument || a.name?.content !== 'cache').map(argValue);
157
+ const piped = pipedInto(node, idMap);
158
+ return sharedCache(argumentValue(node, 'cache'), graph, idMap, inSession, true) ? { name: 'bindCache', value: [piped ?? args[0]], key: piped === undefined ? args.slice(1) : args, fix: 'bindCache keys that include %s, or cache = "session"' } : undefined;
159
+ }
160
+ else if (r_function_call_1.RFunctionCall.isNamed(node)) {
161
+ const direct = r_function_call_1.RFunctionCall.isNamed(node, new Set(['memoizedCall']));
162
+ const memo = direct ? node : df_helper_1.Dataflow.targetsOf(graph, node.info.id, edge_1.EdgeType.Reads).map(d => assigned(d, graph, idMap)).find(v => r_function_call_1.RFunctionCall.isNamed(v, memoisers));
163
+ if (!r_function_call_1.RFunctionCall.is(memo) || (!direct && inSession(memo.info.id) && !sharedCache(argumentValue(memo, 'cache'), graph, idMap, inSession, false))) {
164
+ return undefined;
165
+ }
166
+ const wrapped = argValue(memo.arguments[0]);
167
+ const fn = r_symbol_1.RSymbol.is(wrapped) ? df_helper_1.Dataflow.targetsOf(graph, wrapped.info.id, edge_1.EdgeType.Reads).map(d => assigned(d, graph, idMap)).find(r_function_definition_1.RFunctionDefinition.is) : wrapped;
168
+ const args = direct ? memo.arguments.slice(1) : node.arguments;
169
+ const omitted = new Set();
170
+ model_1.RNode.visitAst(argumentValue(memo, 'omit_args'), n => {
171
+ if (r_string_1.RString.is(n)) {
172
+ omitted.add(n.content.str);
173
+ }
174
+ });
175
+ const left = [...function_semantics_1.FunctionSemantics.call.match.toNames(args, r_function_definition_1.RFunctionDefinition.is(fn) ? (0, cmd_check_util_1.formalNames)(fn) : [])].filter(([p]) => omitted.has(p)).map(([, a]) => a);
176
+ return {
177
+ name: identifier_1.Identifier.getName(node.functionName.content),
178
+ value: [r_function_definition_1.RFunctionDefinition.is(fn) ? fn.body : undefined, ...left.map(a => a.value)],
179
+ key: args.filter(a => a === r_function_call_1.EmptyArgument || !left.includes(a)).map(argValue),
180
+ fix: `arguments to ${identifier_1.Identifier.getName(node.functionName.content)} that include %s, or a cache per session`
181
+ };
182
+ }
183
+ const called = r_function_call_1.RFunctionCall.is(node) ? node.calledFunction : undefined;
184
+ const cache = r_access_1.RAccess.isNamed(called) && fieldName(called) === 'set' ? references(called.accessed, graph).map(d => caches.get(d)).find(n => n !== undefined) : undefined;
185
+ return cache === undefined || !r_function_call_1.RFunctionCall.is(node) ? undefined : { name: cache, value: [argValue(node.arguments[1])], key: [argValue(node.arguments[0])], fix: 'a key that includes %s, or a cache per session' };
186
+ }
187
+ exports.PROCESS_STATE_IN_SESSION = {
188
+ createSearch: () => flowr_search_builder_1.Q.from([]),
189
+ processSearchResult: async (_elements, config, data) => {
190
+ const df = await data.dataflow();
191
+ const ast = await data.normalize();
192
+ const idMap = ast.idMap;
193
+ const nodes = (0, cmd_check_util_1.projectNodes)(ast);
194
+ const sessions = nodes.filter(n => r_function_definition_1.RFunctionDefinition.is(n) && config.sessionSignatures.some(sig => sig.every(p => (0, cmd_check_util_1.formalNames)(n).includes(p)))).map(n => n.info.id);
195
+ const inSession = (node) => sessions.some(s => (0, cmd_check_util_1.isWithin)(node.info.id, s, idMap));
196
+ const shared = topLevelOf(nodes, idMap, config.sharedState);
197
+ const scopes = new Map();
198
+ const results = [];
199
+ const add = (node, change, name, suggestion) => results.push({ ...(0, linter_util_1.at)(node), change, name, suggestion });
200
+ for (const [id, vertex] of df.graph.verticesOfType(vertex_1.VertexType.FunctionCall)) {
201
+ const node = idMap.get(id);
202
+ const fn = identifier_1.Identifier.getName((0, linter_util_1.builtInOf)(df.graph, id) ?? '');
203
+ if (fn === 'addResourcePath' && node !== undefined) {
204
+ add(node, ProcessStateChange.ResourcePath, fn, 'serve the files from the www directory of the app, or check that every client may see the directory');
205
+ }
206
+ if (!r_function_call_1.RFunctionCall.is(node) || !inSession(node)) {
207
+ continue;
208
+ }
209
+ const global = fn === 'assign' ? (0, global_environment_modification_1.globalAssignment)(vertex, df, idMap, data.inspectContext()) : undefined;
210
+ if (config.settings[fn] !== undefined && node.arguments.length > 0 && !restoredOnExit(node, fn, idMap)) {
211
+ add(node, ProcessStateChange.ProcessSetting, fn, config.settings[fn]);
212
+ }
213
+ else if (fn === 'assignInNamespace' || fn === 'assignInMyNamespace') {
214
+ add(node, ProcessStateChange.NamespacePatch, fn, 'pass the changed behavior as an argument instead of patching the namespace');
215
+ }
216
+ else if (global !== undefined) {
217
+ add(node, ProcessStateChange.GlobalAssign, global.variable ?? fn, SessionLocal);
218
+ }
219
+ }
220
+ for (const node of nodes.filter(inSession)) {
221
+ const symbol = r_binary_op_1.RBinaryOp.is(node) && ['<-', '=', '<<-'].includes(node.operator) && r_access_1.RAccess.is(node.lhs) ? node.lhs.accessed : r_function_call_1.RFunctionCall.isNamed(node) && node.arguments.length > 0 ? node : undefined;
222
+ const variable = symbol && references(symbol, df.graph).map(d => shared.get(d)).find(n => n !== undefined);
223
+ const target = r_binary_op_1.RBinaryOp.is(node) && (node.operator === '<<-' || node.operator === '->>') ? (0, global_environment_modification_1.targetVariable)(node.operator === '->>' ? node.rhs : node.lhs) : undefined;
224
+ if (variable !== undefined) {
225
+ add(node, ProcessStateChange.SharedState, variable, `create '${variable}' within the server function, or key it by the session`);
226
+ }
227
+ else if (target !== undefined && (0, global_environment_modification_1.superAssignmentTarget)(node, target, idMap, new Set(), scopes) === 'global') {
228
+ add(node, ProcessStateChange.GlobalSuperAssignment, target, SessionLocal);
229
+ }
230
+ }
231
+ const writtenGlobals = new Set(results.filter(r => r.change === ProcessStateChange.GlobalSuperAssignment || r.change === ProcessStateChange.GlobalAssign).map(r => r.name));
232
+ const changedSettings = new Set(results.filter(r => r.change === ProcessStateChange.ProcessSetting).flatMap(r => SettingReaders[r.name] ?? []));
233
+ const dependence = sessionDependence(df.graph, idMap, sessions, new Set(config.sharedState), writtenGlobals, changedSettings);
234
+ const caches = topLevelOf(nodes, idMap, config.caches);
235
+ for (const node of nodes.filter(inSession)) {
236
+ const write = cacheWrite(node, df.graph, idMap, dependence.inSession, caches, new Set(config.memoisers));
237
+ const missing = write === undefined ? [] : dependence.missing(write.value, write.key);
238
+ if (write !== undefined && missing.length > 0) {
239
+ add(node, ProcessStateChange.CacheKey, write.name, write.fix.replace('%s', missing.join(', ')));
240
+ }
241
+ }
242
+ return { results: results.toSorted((a, b) => range_1.SourceLocation.compare(a.loc, b.loc)), '.meta': { sessionFunctions: sessions.length } };
243
+ },
244
+ prettyPrint: (0, linter_format_1.prettyPrint)(result => `${result.change} by ${result.name} at ${range_1.SourceLocation.format(result.loc)}`, result => `${result.name} changes the state all sessions share (${result.change}) at ${range_1.SourceLocation.format(result.loc)}; instead, use ${result.suggestion}`),
245
+ info: {
246
+ name: 'Process State in Session',
247
+ tags: [linter_tags_1.LintingRuleTag.Bug, linter_tags_1.LintingRuleTag.Security, linter_tags_1.LintingRuleTag.Shiny],
248
+ certainty: linter_format_1.LintingRuleCertainty.BestEffort,
249
+ 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.',
250
+ defaultConfig: () => ({
251
+ sessionSignatures: [['input', 'output']],
252
+ settings: {
253
+ 'options': 'withr::with_options or withr::local_options',
254
+ 'Sys.setenv': 'withr::with_envvar or withr::local_envvar',
255
+ 'Sys.unsetenv': 'withr::with_envvar or withr::local_envvar',
256
+ 'setwd': 'absolute paths, or withr::with_dir',
257
+ 'Sys.setlocale': 'withr::with_locale',
258
+ 'set.seed': 'withr::with_seed',
259
+ 'Sys.umask': 'withr::with_umask'
260
+ },
261
+ sharedState: ['reactiveValues', 'reactiveVal'],
262
+ caches: ['cache_mem', 'cache_disk', 'cache_layered'],
263
+ memoisers: ['memoise', 'memoize', 'addMemoization']
264
+ })
265
+ }
266
+ };
267
+ //# sourceMappingURL=process-state-in-session.js.map