@withone/cli 2.14.3 → 2.14.4

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.
@@ -3223,7 +3223,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
3223
3223
  if (flowStack.includes(resolvedKey)) {
3224
3224
  throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
3225
3225
  }
3226
- const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-SRO6YL62.js");
3226
+ const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-PUFQASEJ.js");
3227
3227
  const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
3228
3228
  const subContext = await executeFlow(
3229
3229
  subFlow,
@@ -3330,7 +3330,7 @@ function resolveBashEnv(envConfig, context, stepId) {
3330
3330
  os2.tmpdir(),
3331
3331
  `one-flow-${stepId}-${key}-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}.json`
3332
3332
  );
3333
- fs4.writeFileSync(tmp, json, { encoding: "utf-8" });
3333
+ fs4.writeFileSync(tmp, json, { encoding: "utf-8", mode: 384 });
3334
3334
  tempFiles.push(tmp);
3335
3335
  out[key] = tmp;
3336
3336
  continue;
@@ -3768,9 +3768,21 @@ var RUNS_DIR = ".one/flows/.runs";
3768
3768
  var LOGS_DIR = ".one/flows/.logs";
3769
3769
  function ensureDir(dir) {
3770
3770
  if (!fs5.existsSync(dir)) {
3771
- fs5.mkdirSync(dir, { recursive: true });
3771
+ fs5.mkdirSync(dir, { recursive: true, mode: 448 });
3772
3772
  }
3773
3773
  }
3774
+ var PRIVATE_FILE_MODE = 384;
3775
+ var PRIVATE_DIR_MODE = 448;
3776
+ function restrictMode(p, mode) {
3777
+ try {
3778
+ fs5.chmodSync(p, mode);
3779
+ } catch {
3780
+ }
3781
+ }
3782
+ function persistableState(state) {
3783
+ if (!state.context) return state;
3784
+ return { ...state, context: { ...state.context, env: {} } };
3785
+ }
3774
3786
  function generateRunId() {
3775
3787
  return crypto.randomBytes(6).toString("hex");
3776
3788
  }
@@ -3789,6 +3801,8 @@ var FlowRunner = class _FlowRunner {
3789
3801
  this.flowKey = flow.key;
3790
3802
  ensureDir(RUNS_DIR);
3791
3803
  ensureDir(LOGS_DIR);
3804
+ restrictMode(RUNS_DIR, PRIVATE_DIR_MODE);
3805
+ restrictMode(LOGS_DIR, PRIVATE_DIR_MODE);
3792
3806
  this.statePath = path6.join(RUNS_DIR, `${flow.key}-${this.runId}.state.json`);
3793
3807
  this.logPath = path6.join(LOGS_DIR, `${flow.key}-${this.runId}.log`);
3794
3808
  const resolvedInputs = { ...inputs };
@@ -3831,10 +3845,15 @@ var FlowRunner = class _FlowRunner {
3831
3845
  msg,
3832
3846
  ...data
3833
3847
  };
3834
- fs5.appendFileSync(this.logPath, JSON.stringify(entry) + "\n");
3848
+ fs5.appendFileSync(this.logPath, JSON.stringify(entry) + "\n", { mode: PRIVATE_FILE_MODE });
3835
3849
  }
3836
3850
  saveState() {
3837
- fs5.writeFileSync(this.statePath, JSON.stringify(this.state, stripStepsAlias, 2));
3851
+ fs5.writeFileSync(
3852
+ this.statePath,
3853
+ JSON.stringify(persistableState(this.state), stripStepsAlias, 2),
3854
+ { mode: PRIVATE_FILE_MODE }
3855
+ );
3856
+ restrictMode(this.statePath, PRIVATE_FILE_MODE);
3838
3857
  }
3839
3858
  createEventHandler(externalHandler) {
3840
3859
  return (event) => {
@@ -4169,6 +4188,7 @@ export {
4169
4188
  getStepTypeDescriptor,
4170
4189
  getNestedStepsKeys,
4171
4190
  generateFlowGuide,
4191
+ persistableState,
4172
4192
  stripStepsAlias,
4173
4193
  FlowRunner,
4174
4194
  resolveFlowPath,
@@ -7,12 +7,13 @@ import {
7
7
  listFlows,
8
8
  loadFlow,
9
9
  loadFlowWithMeta,
10
+ persistableState,
10
11
  resolveFlowPath,
11
12
  saveFlow,
12
13
  stripStepsAlias,
13
14
  summarizeFlowInputs,
14
15
  walkSteps
15
- } from "./chunk-IM3OA7CU.js";
16
+ } from "./chunk-33KUKSRH.js";
16
17
  import "./chunk-44CV5IMX.js";
17
18
  import "./chunk-Q6PWTATS.js";
18
19
  import "./chunk-XUAUDMQE.js";
@@ -25,6 +26,7 @@ export {
25
26
  listFlows,
26
27
  loadFlow,
27
28
  loadFlowWithMeta,
29
+ persistableState,
28
30
  resolveFlowPath,
29
31
  saveFlow,
30
32
  stripStepsAlias,
package/dist/index.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  validateActionInput,
41
41
  walkSteps,
42
42
  writeCache
43
- } from "./chunk-IM3OA7CU.js";
43
+ } from "./chunk-33KUKSRH.js";
44
44
  import {
45
45
  memSqlCommand
46
46
  } from "./chunk-TSMVFVQ3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withone/cli",
3
- "version": "2.14.3",
3
+ "version": "2.14.4",
4
4
  "description": "CLI for managing One",
5
5
  "type": "module",
6
6
  "files": [