T09 · Insecure Skill Coding Practices
- Location
scripts/serve.js:369- Finding
Unauthenticated Public Exposure of Agent Memory Through Cloudflare Tunnel
- Content
View full analysis
{ // Start cloudflared tunnel const tunnel = spawn('cloudflared', ['tunnel', '--url', `http://localhost:${PORT}`], { stdio: ['ignore', 'pipe', 'pipe'], }); let urlFound = false; function checkForURL(data) { const text = data.toString(); const match = text.match(/https:\/\/[a-z0-9-]+\.trycloudflare\.com/); ``` `scripts/serve.js:134-159`: ```js // Scan files const files = []; const memoryMd = path.join(WORKSPACE, 'MEMORY.md'); if (fs.existsSync(memoryMd)) files.push(memoryMd); const memoryDir = path.join(WORKSPACE, 'memory'); if (fs.existsSync(memoryDir)) { for (const f of fs.readdirSync(memoryDir)) { if (f.endsWith('.md')) files.push(path.join(memoryDir, f)); } } const issuesDir = path.join(WORKSPACE, '.issues'); if (fs.existsSync(issuesDir)) { for (const f of fs.readdirSync(issuesDir)) { if (f.endsWith('.md')) files.push(path.join(issuesDir, f)); } } const soulMd = path.join(WORKSPACE, 'SOUL.md'); if (fs.existsSync(soulMd)) files.push(soulMd); // Parse each file const fileNodeIds = {}; for (const file of files) { try { const content = fs.readFileSync(file, 'utf-8'); const rel = path.relative(WORKSPACE, file); const ids = parseMarkdownSections(content, rel); fileNodeIds[rel] = ids; } catch (e) { /* skip unreadable */ } } ``` `scripts/serve.js:369-383`: ```js const server = http.createServer((req, res) => { if (req.url === '/api/data') { const data = parseMemoryFiles(); res.writeHead(200, { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' }); res.end(JSON.stringify(data)); } else { res.writeHead(200, { ...[truncated 3042 chars]- Remediation
View remediation
