{"record":{"id":"2da70fa868989721","repo":"FlowiseAI/Flowise","slug":"invalid-sqlite-path-path-traversal-attempt-detect","errorCode":null,"errorMessage":"Invalid SQLite path: path traversal attempt detected","messagePattern":"Invalid SQLite path: path traversal attempt detected","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/validator.ts","lineNumber":338,"sourceCode":"export const validateSQLitePath = (userProvidedPath: string | undefined): string => {\n    const allowedDirs = getAllowedSQLiteBaseDirs()\n    const defaultDir = allowedDirs[0]\n\n    if (process.env.PATH_TRAVERSAL_SAFETY === 'false') {\n        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    }","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/validator.ts#L320-L356","documentation":"Thrown by validateSQLitePath (packages/components/src/validator.ts:338) when the supplied SQLite database path contains a literal '..'. Same staged-defense pattern as the vector store helper: Flowise blocks traversal before the path reaches TypeORM/sqlite3 so a node config can't write the DB file outside the allow-list.","triggerScenarios":"A Sql Database node is configured with Database Path like '../../app.db', 'data/../secret.db', or any value containing '..'.","commonSituations":"Relative paths intended to point outside ~/.flowise; config examples copied from tutorials using '../'; filenames containing consecutive dots.","solutions":["Use a plain relative filename (e.g. 'mydb.sqlite') to resolve under ~/.flowise.","Use an absolute path under an allowed dir (~/.flowise or DATABASE_PATH).","Rename any filename containing '..'.","Set DATABASE_PATH to your desired parent dir and keep the filename simple."],"exampleFix":"// before\nnodeParams.databasePath = '../../app.db'\n\n// after\nnodeParams.databasePath = 'app.db'   // -> ~/.flowise/app.db","handlingStrategy":"validation","validationCode":"if (String(databasePath ?? '').includes('..')) throw new Error('SQLite path must not contain ..');","typeGuard":"const isTraversalFree = (p: unknown): p is string => typeof p === 'string' && !p.includes('..');","tryCatchPattern":"try { validateSQLitePath(databasePath) } catch (e) { if (e instanceof Error && /path traversal attempt/.test(e.message)) { databasePath = 'database.sqlite' } else throw e }","preventionTips":["Use plain filenames so the DB lands under ~/.flowise.","Set DATABASE_PATH for custom parent dirs.","Reject '..' in path inputs at the API boundary."],"tags":["path-traversal","security","validation","sqlite","database","flowise","filesystem"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}