claude-flow 3.5.23 → 3.5.25

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.
@@ -78,6 +78,10 @@ export async function uploadToGCS(content, options = {}) {
78
78
  const contentId = generateContentId(content);
79
79
  const checksum = crypto.createHash('sha256').update(content).digest('hex');
80
80
  const fileName = options.name || `${contentId}.cfp.json`;
81
+ // Validate filename to prevent path traversal
82
+ if (!/^[a-zA-Z0-9._\-]+$/.test(fileName) || fileName.includes('..')) {
83
+ throw new Error(`Invalid filename: ${fileName}`);
84
+ }
81
85
  const objectPath = config.prefix ? `${config.prefix}/${fileName}` : fileName;
82
86
  // S-1: Validate bucket name and object path to prevent command injection
83
87
  if (!isValidBucketName(config.bucket)) {
@@ -111,8 +115,11 @@ export async function uploadToGCS(content, options = {}) {
111
115
  // Metadata update failed, but upload succeeded
112
116
  }
113
117
  }
114
- // Clean up temp file
115
- fs.unlinkSync(tempFile);
118
+ // Clean up temp file (validate path is within temp dir)
119
+ const resolvedTemp = path.resolve(tempFile);
120
+ if (resolvedTemp.startsWith(path.resolve(tempDir))) {
121
+ fs.unlinkSync(tempFile);
122
+ }
116
123
  const uri = `gs://${config.bucket}/${objectPath}`;
117
124
  const publicUrl = `https://storage.googleapis.com/${config.bucket}/${objectPath}`;
118
125
  console.log(`[GCS] Upload complete: ${uri}`);
@@ -126,9 +133,12 @@ export async function uploadToGCS(content, options = {}) {
126
133
  };
127
134
  }
128
135
  catch (error) {
129
- // Clean up temp file on error
136
+ // Clean up temp file on error (validate path is within temp dir)
130
137
  try {
131
- fs.unlinkSync(tempFile);
138
+ const resolvedTemp = path.resolve(tempFile);
139
+ if (resolvedTemp.startsWith(path.resolve(tempDir))) {
140
+ fs.unlinkSync(tempFile);
141
+ }
132
142
  }
133
143
  catch { /* ignore */ }
134
144
  throw new Error(`GCS upload failed: ${error}`);
@@ -150,13 +160,19 @@ export async function downloadFromGCS(uri, config) {
150
160
  downloadArgs.push(`--project=${cfg.projectId}`);
151
161
  execFileSync('gcloud', downloadArgs, { encoding: 'utf-8', stdio: 'pipe' });
152
162
  const content = fs.readFileSync(tempFile);
153
- fs.unlinkSync(tempFile);
163
+ const resolvedTemp = path.resolve(tempFile);
164
+ if (resolvedTemp.startsWith(path.resolve(tempDir))) {
165
+ fs.unlinkSync(tempFile);
166
+ }
154
167
  console.log(`[GCS] Downloaded ${content.length} bytes`);
155
168
  return content;
156
169
  }
157
170
  catch (error) {
158
171
  try {
159
- fs.unlinkSync(tempFile);
172
+ const resolvedTemp = path.resolve(tempFile);
173
+ if (resolvedTemp.startsWith(path.resolve(tempDir))) {
174
+ fs.unlinkSync(tempFile);
175
+ }
160
176
  }
161
177
  catch { /* ignore */ }
162
178
  console.error(`[GCS] Download failed: ${error}`);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claude-flow/cli",
3
- "version": "3.5.23",
3
+ "version": "3.5.25",
4
4
  "type": "module",
5
5
  "description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",