FlowiseAI/Flowise · error · Error
Invalid SQLite path: path traversal attempt detected
Error message
Invalid SQLite path: path traversal attempt detected
What it means
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.
Source
Thrown at packages/components/src/validator.ts:338
export const validateSQLitePath = (userProvidedPath: string | undefined): string => {
const allowedDirs = getAllowedSQLiteBaseDirs()
const defaultDir = allowedDirs[0]
if (process.env.PATH_TRAVERSAL_SAFETY === 'false') {
if (!userProvidedPath || userProvidedPath.trim() === '') {
return path.join(defaultDir, 'database.sqlite')
}
const bypassPath = userProvidedPath.trim()
return path.isAbsolute(bypassPath) ? bypassPath : path.resolve(path.join(defaultDir, bypassPath))
}
if (!userProvidedPath || userProvidedPath.trim() === '') {
throw new Error('Invalid SQLite path: database path is required')
}
const basePath = userProvidedPath.trim()
if (basePath.includes('..')) throw new Error('Invalid SQLite path: path traversal attempt detected')
if (basePath.toLowerCase().includes('%2e') || basePath.toLowerCase().includes('%2f') || basePath.toLowerCase().includes('%5c'))
throw new Error('Invalid SQLite path: encoded path traversal attempt detected')
// eslint-disable-next-line no-control-regex
if (/\0/.test(basePath) || /[\x00-\x1f]/.test(basePath))
throw new Error('Invalid SQLite path: null bytes or control characters detected')
if (/^[a-zA-Z]:\\/.test(basePath)) throw new Error('Invalid SQLite path: Windows absolute paths are not allowed')
if (/^\\\\[^\\]/.test(basePath)) throw new Error('Invalid SQLite path: UNC paths are not allowed')
if (/^\\\\\?\\/.test(basePath)) throw new Error('Invalid SQLite path: extended-length paths are not allowed')
const resolvedPath = path.isAbsolute(basePath) ? path.resolve(basePath) : path.resolve(path.join(defaultDir, basePath))
if (resolvedPath.includes('..')) throw new Error('Invalid SQLite path: path traversal detected in resolved path')
if (!isPathWithinAllowedSQLiteDirs(resolvedPath, allowedDirs)) {
throw new Error(
`Invalid SQLite path: path must be within allowed directories (${allowedDirs.join(', ')}). Attempted path: ${resolvedPath}`
)
}View on GitHub (pinned to abe4a8601a)
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.
Example fix
// before nodeParams.databasePath = '../../app.db' // after nodeParams.databasePath = 'app.db' // -> ~/.flowise/app.db
Defensive patterns
Strategy: validation
Validate before calling
if (String(databasePath ?? '').includes('..')) throw new Error('SQLite path must not contain ..'); Type guard
const isTraversalFree = (p: unknown): p is string => typeof p === 'string' && !p.includes('..'); Try / catch
try { validateSQLitePath(databasePath) } catch (e) { if (e instanceof Error && /path traversal attempt/.test(e.message)) { databasePath = 'database.sqlite' } else throw e } Prevention
- Use plain filenames so the DB lands under ~/.flowise.
- Set DATABASE_PATH for custom parent dirs.
- Reject '..' in path inputs at the API boundary.
When it happens
Trigger: A Sql Database node is configured with Database Path like '../../app.db', 'data/../secret.db', or any value containing '..'.
Common situations: Relative paths intended to point outside ~/.flowise; config examples copied from tutorials using '../'; filenames containing consecutive dots.
Related errors
- Invalid SQLite path: path traversal detected in resolved pat
- Invalid SQLite path: path must be within allowed directories
- Invalid SQLite path: encoded path traversal attempt detected
- Invalid SQLite path: null bytes or control characters detect
- Invalid SQLite path: Windows absolute paths are not allowed
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/2da70fa868989721.
Report an issue: GitHub.