@yamo/cli 1.3.1 → 1.3.2
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/dist/index.js +12 -2
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -134,10 +134,20 @@ program
|
|
|
134
134
|
const files = [{ name: "block.yamo", content }];
|
|
135
135
|
if (outputMatch) {
|
|
136
136
|
const artifactName = outputMatch[1].trim();
|
|
137
|
+
// Security: Check for path traversal patterns in artifact name (Part 3: Security Fixes)
|
|
138
|
+
if (artifactName.includes('..') || artifactName.startsWith('/')) {
|
|
139
|
+
throw new Error(`Invalid artifact name: ${artifactName} (path-like names are not allowed)`);
|
|
140
|
+
}
|
|
137
141
|
const artifactPath = path_1.default.join(path_1.default.dirname(file), artifactName);
|
|
138
|
-
|
|
142
|
+
// Security: Resolve to absolute path and restrict to input file directory
|
|
143
|
+
const resolvedPath = path_1.default.resolve(artifactPath);
|
|
144
|
+
const inputDir = path_1.default.resolve(path_1.default.dirname(file));
|
|
145
|
+
if (!resolvedPath.startsWith(inputDir)) {
|
|
146
|
+
throw new Error(`Artifact path outside allowed directory: ${artifactName}`);
|
|
147
|
+
}
|
|
148
|
+
if (fs_1.default.existsSync(resolvedPath)) {
|
|
139
149
|
console.log(chalk_1.default.cyan(`Bundling output: ${artifactName}`));
|
|
140
|
-
files.push({ name: artifactName, content: fs_1.default.readFileSync(
|
|
150
|
+
files.push({ name: artifactName, content: fs_1.default.readFileSync(resolvedPath, "utf8") });
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
153
|
let encryptionKey = undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamo/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "YAMO Protocol v0.4 - Command-line tools for blockchain integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "tsc && chmod +x dist/index.js",
|
|
18
18
|
"prepublishOnly": "npm run build",
|
|
19
|
-
"start": "node dist/index.js"
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"test": "node --test test/**/*.test.js",
|
|
21
|
+
"test:security": "node --test test/security.test.js"
|
|
20
22
|
},
|
|
21
23
|
"keywords": [
|
|
22
24
|
"yamo",
|