Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions skills/company-research/scripts/compile_report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ for (const file of files) {
const fields = parseFrontmatter(content);
if (!fields) continue;
const body = parseBody(content);
const slug = file.replace('.md', '');
// Sanitize slug to prevent path traversal via crafted filenames
// (e.g. "../../etc/evil.md" → "evilevil" without "../" components)
const slug = file.replace('.md', '').replace(/\.\./g, '').replace(/[\\/]/g, '');
companies.push({ ...fields, body, slug, file });
}

Expand Down Expand Up @@ -351,6 +353,6 @@ console.log(join(dir, 'index.html'));

// Open in browser if requested
if (shouldOpen) {
const { execSync } = await import('child_process');
try { execSync(`open "${join(dir, 'index.html')}"`); } catch {}
const { execFileSync } = await import('child_process');
try { execFileSync('open', [join(dir, 'index.html')]); } catch {}
}
7 changes: 4 additions & 3 deletions skills/event-prospecting/scripts/compile_report.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ function readMdDir(p) {
const fields = parseFrontmatter(content);
if (!fields) return null;
const body = parseBody(content);
const slug = f.replace('.md', '');
// Sanitize slug to prevent path traversal via crafted filenames
const slug = f.replace('.md', '').replace(/\.\./g, '').replace(/[\\/]/g, '');
return { ...fields, body, slug, file: f };
}).filter(Boolean);
}
Expand Down Expand Up @@ -907,6 +908,6 @@ console.error(JSON.stringify({
console.log(join(dir, 'index.html'));

if (shouldOpen) {
const { execSync } = await import('child_process');
try { execSync(`open "${join(dir, 'index.html')}"`); } catch {}
const { execFileSync } = await import('child_process');
try { execFileSync('open', [join(dir, 'index.html')]); } catch {}
}