T09 · Insecure Skill Coding Practices
- Location
assets/server.js:61- Finding
Unauthenticated network clients can overwrite persistent PRD data ## Remediation Suggestions - Bind to `127.0.0.1` by default and require explicit configuration for remote access. - Enforce authentication and page-level authorization on every write request. - Replace wildcard CORS with an explicit trusted-origin policy. Treat origin validation as an additional control, not a substitute for authentication. - Validate the request schema and allowed page identifiers before writing files. - Enforce request-size limits and retain recoverable revisions of overwritten data.
- Content
View full analysis
Vulnerability Details
File Location:
assets/server.js:61–98,135
Vulnerability Type: Missing server-side authentication and authorization
Risk Level: HighTechnical Analysis
The HTTP server permits requests from any origin and writes caller-supplied PRD records without authenticating the caller.
javascript const server = http.createServer((req, res) => { res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'); res.setHeader('Access-Control-Allow-Headers', 'Content-Type'); if (req.method === 'OPTIONS') { res.writeHead(204); res.end(); return; } const parsed = new URL(req.url, `http://${req.headers.host}`); const pathname = decodeURIComponent(parsed.pathname); if (pathname === '/api/save-prd' && req.method === 'POST') { let body = ''; req.on('data', chunk => { body += chunk; }); req.on('end', () => { try { const payload = JSON.parse(body);The write path uses request-controlled page identifiers and record contents:
javascript const jsDir = path.join(BASE_DIR, 'assets', 'js'); fs.mkdirSync(jsDir, { recursive: true }); const clean = safeName(payload.page); const htmlName = clean + '.html'; const file = path.join(jsDir, `prd-data-${clean}.js`); fs.writeFileSync(file, buildDataFile(htmlName, payload.data, payload.versionRegistry), 'utf-8'); if (payload.allData && typeof payload.allData === 'object') { fs.writeFileSync(path.join(jsDir, 'prd-data-all.json'), JSON.stringify(payload.allData, null, 2), 'utf-8'); }The listener does not specify a loopback host:
javascript server.listen(PORT, () => {Consequently, the service is not restricted to localhost by default. Actual remote reachability depends on operating-system networking and firewall rules. The frontend editor restrictions do not protect this direct HTTP endpoint.
Attack Path
- The user starts the supplied local persistence server.
- A ...[truncated 1010 chars]
