{"record":{"id":"55f4debf46c089ba","repo":"FlowiseAI/Flowise","slug":"invalid-sqlite-path-null-bytes-or-control-charact","errorCode":null,"errorMessage":"Invalid SQLite path: null bytes or control characters detected","messagePattern":"Invalid SQLite path: null bytes or control characters detected","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/validator.ts","lineNumber":343,"sourceCode":"        if (!userProvidedPath || userProvidedPath.trim() === '') {\n            return path.join(defaultDir, 'database.sqlite')\n        }\n        const bypassPath = userProvidedPath.trim()\n        return path.isAbsolute(bypassPath) ? bypassPath : path.resolve(path.join(defaultDir, bypassPath))\n    }\n\n    if (!userProvidedPath || userProvidedPath.trim() === '') {\n        throw new Error('Invalid SQLite path: database path is required')\n    }\n\n    const basePath = userProvidedPath.trim()\n\n    if (basePath.includes('..')) throw new Error('Invalid SQLite path: path traversal attempt detected')\n    if (basePath.toLowerCase().includes('%2e') || basePath.toLowerCase().includes('%2f') || basePath.toLowerCase().includes('%5c'))\n        throw new Error('Invalid SQLite path: encoded path traversal attempt detected')\n    // eslint-disable-next-line no-control-regex\n    if (/\\0/.test(basePath) || /[\\x00-\\x1f]/.test(basePath))\n        throw new Error('Invalid SQLite path: null bytes or control characters detected')\n    if (/^[a-zA-Z]:\\\\/.test(basePath)) throw new Error('Invalid SQLite path: Windows absolute paths are not allowed')\n    if (/^\\\\\\\\[^\\\\]/.test(basePath)) throw new Error('Invalid SQLite path: UNC paths are not allowed')\n    if (/^\\\\\\\\\\?\\\\/.test(basePath)) throw new Error('Invalid SQLite path: extended-length paths are not allowed')\n\n    const resolvedPath = path.isAbsolute(basePath) ? path.resolve(basePath) : path.resolve(path.join(defaultDir, basePath))\n\n    if (resolvedPath.includes('..')) throw new Error('Invalid SQLite path: path traversal detected in resolved path')\n\n    if (!isPathWithinAllowedSQLiteDirs(resolvedPath, allowedDirs)) {\n        throw new Error(\n            `Invalid SQLite path: path must be within allowed directories (${allowedDirs.join(', ')}). Attempted path: ${resolvedPath}`\n        )\n    }\n\n    return resolvedPath\n}\n\n/**","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/validator.ts#L325-L361","documentation":"Thrown by validateSQLitePath (packages/components/src/validator.ts:343) when the SQLite path contains a NUL byte or any control character in 0x00-0x1f. Control chars can truncate or alter paths at the OS layer; Flowise rejects them outright.","triggerScenarios":"A Database Path value contains \\0, tab, newline, or another control char — typically from binary input, terminal copy-paste, or an injected payload.","commonSituations":"Pasting paths from logs/terminals with invisible chars; raw multipart input bound without sanitization; random-string test fixtures.","solutions":["Strip control chars from input before assigning databasePath (replace /[\\x00-\\x1f]/g).","Re-type the path by hand.","Validate the value against /^[\\x20-\\x7e]+$/ at the boundary."],"exampleFix":"// before\nnodeParams.databasePath = rawInput   // stray \\n\n\n// after\nnodeParams.databasePath = rawInput.replace(/[\\x00-\\x1f]/g, '').trim()","handlingStrategy":"validation","validationCode":"if (/[\\x00-\\x1f]/.test(String(databasePath ?? ''))) throw new Error('control characters in DB path');","typeGuard":"const isPrintable = (p: unknown): p is string => typeof p === 'string' && /^[\\x20-\\x7e]+$/.test(p);","tryCatchPattern":"try { validateSQLitePath(databasePath) } catch (e) { if (e instanceof Error && /control characters/.test(e.message)) { databasePath = databasePath.replace(/[\\x00-\\x1f]/g, '') } else throw e }","preventionTips":["Strip control chars from all DB path inputs.","Re-type paths instead of copy-pasting from untrusted sources.","Validate paths against printable-ASCII regex at the boundary."],"tags":["path-traversal","security","validation","sanitization","sqlite","database","flowise"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}