@alea-design/cli 0.10.9 → 0.10.10
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/bin/alea.mjs +5 -2
- package/package.json +2 -2
- package/registry.json +1 -1
package/bin/alea.mjs
CHANGED
|
@@ -58,8 +58,10 @@ function install(pkgs) {
|
|
|
58
58
|
try { execSync(cmdline, { cwd, stdio: 'inherit' }); } catch { die(`could not install; run it yourself: ${cmdline}`); }
|
|
59
59
|
}
|
|
60
60
|
// a file path from a registry (the Pro one comes over the network) must stay inside the target folder
|
|
61
|
+
// a name the registry sends ends up in paths and in the generated index.ts, so only plain characters are accepted (QA-557: a name with a line break could inject code)
|
|
62
|
+
const PLAIN_NAME = /^[A-Za-z0-9._-]+$/;
|
|
61
63
|
function safePath(dir, rel) {
|
|
62
|
-
if (typeof rel !== 'string' || !rel || path.isAbsolute(rel) || rel.includes('\\') || rel.includes('\0') || /^[a-zA-Z]:/.test(rel) || rel.split('/').some(seg => seg === '..' || seg === '')) die(`the registry sent a file path outside the folder (${JSON.stringify(String(rel).slice(0, 80))}); nothing was written`);
|
|
64
|
+
if (typeof rel !== 'string' || !rel || path.isAbsolute(rel) || rel.includes('\\') || rel.includes('\0') || /^[a-zA-Z]:/.test(rel) || rel.split('/').some(seg => seg === '..' || seg === '' || !PLAIN_NAME.test(seg))) die(`the registry sent a file path outside the folder (${JSON.stringify(String(rel).slice(0, 80))}); nothing was written`);
|
|
63
65
|
const target = path.resolve(dir, rel);
|
|
64
66
|
if (!target.startsWith(path.resolve(dir) + path.sep)) die(`the registry sent a file path outside the folder (${JSON.stringify(rel.slice(0, 80))}); nothing was written`);
|
|
65
67
|
return target;
|
|
@@ -110,8 +112,9 @@ function writeIndex(dir) {
|
|
|
110
112
|
const exports = [], css = ["/* Alea styles. GENERATED by alea: tokens, base and the components you added. */", "@import './base.css';"];
|
|
111
113
|
if (fs.existsSync(comps)) for (const g of fs.readdirSync(comps).sort()) {
|
|
112
114
|
const gd = path.join(comps, g);
|
|
113
|
-
if (!fs.statSync(gd).isDirectory()) continue;
|
|
115
|
+
if (!PLAIN_NAME.test(g) || !fs.statSync(gd).isDirectory()) continue;
|
|
114
116
|
for (const f of fs.readdirSync(gd).sort()) {
|
|
117
|
+
if (!PLAIN_NAME.test(f)) continue;
|
|
115
118
|
if (/\.tsx?$/.test(f) && !f.endsWith('.d.ts')) exports.push(`export * from './components/${g}/${f.replace(/\.tsx?$/, '')}';`);
|
|
116
119
|
if (f.endsWith('.css')) css.push(`@import './components/${g}/${f}';`);
|
|
117
120
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alea-design/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.10",
|
|
4
4
|
"description": "Copy Alea components into your project: alea init, add, list.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"test": "node scripts/build-registry.mjs && node --test test/*.test.mjs"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@alea-design/motion": "^0.10.
|
|
42
|
+
"@alea-design/motion": "^0.10.10",
|
|
43
43
|
"@types/react-18": "npm:@types/react@^18.3.31",
|
|
44
44
|
"@types/react-dom-18": "npm:@types/react-dom@^18.3.7",
|
|
45
45
|
"lucide-react": "^0.525.0",
|