@salesforce/cli 2.158.7 → 2.159.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.
- package/README.md +1 -1
- package/node_modules/basic-ftp/dist/Client.js +2 -2
- package/node_modules/basic-ftp/dist/safePathNames.d.ts +6 -0
- package/node_modules/basic-ftp/dist/safePathNames.js +52 -0
- package/node_modules/basic-ftp/package.json +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ const parseControlResponse_1 = require("./parseControlResponse");
|
|
|
11
11
|
const parseList_1 = require("./parseList");
|
|
12
12
|
const parseListMLSD_1 = require("./parseListMLSD");
|
|
13
13
|
const ProgressTracker_1 = require("./ProgressTracker");
|
|
14
|
+
const safePathNames_1 = require("./safePathNames");
|
|
14
15
|
const StringWriter_1 = require("./StringWriter");
|
|
15
16
|
const transfer_1 = require("./transfer");
|
|
16
17
|
// Use promisify to keep the library compatible with Node 8.
|
|
@@ -647,8 +648,7 @@ class Client {
|
|
|
647
648
|
async _downloadFromWorkingDir(localDirPath) {
|
|
648
649
|
await ensureLocalDirectory(localDirPath);
|
|
649
650
|
for (const file of await this.list()) {
|
|
650
|
-
|
|
651
|
-
if (hasInvalidName) {
|
|
651
|
+
if (!(0, safePathNames_1.isSafePathName)(file.name)) {
|
|
652
652
|
const safeName = JSON.stringify(file.name);
|
|
653
653
|
this.ftp.log(`Invalid filename from server listing, will skip file. (${safeName})`);
|
|
654
654
|
continue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
/**
|
|
3
|
+
* Returns true if a name from a directory listing can only refer to an entry directly inside a
|
|
4
|
+
* local directory when joined with its path.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isSafePathName(name: string, localPath?: typeof path): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isSafePathName = isSafePathName;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
/**
|
|
39
|
+
* Returns true if a name from a directory listing can only refer to an entry directly inside a
|
|
40
|
+
* local directory when joined with its path.
|
|
41
|
+
*/
|
|
42
|
+
function isSafePathName(name, localPath = path) {
|
|
43
|
+
if (!name || name === "." || name === ".." || name.includes("/")) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (localPath.sep === "\\") {
|
|
47
|
+
// Windows also separates with "\", reads ":" as a drive (older Node joins "." and "C:" to
|
|
48
|
+
// "C:", see CVE-2025-23084) and ignores trailing dots and spaces, so ".. " acts like "..".
|
|
49
|
+
return !/[\\:]/.test(name) && !/^[. ]+$/.test(name);
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/cli",
|
|
3
3
|
"description": "The Salesforce CLI",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.159.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bin": {
|
|
7
7
|
"sf": "./bin/run.js",
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
"@opentelemetry/core": "3.0.0",
|
|
252
252
|
"@opentelemetry/resources": "3.0.0",
|
|
253
253
|
"@opentelemetry/semantic-conventions": "1.44.0",
|
|
254
|
-
"basic-ftp": "6.2.
|
|
254
|
+
"basic-ftp": "6.2.6"
|
|
255
255
|
},
|
|
256
256
|
"repository": "salesforcecli/cli",
|
|
257
257
|
"scripts": {
|