FlowiseAI/Flowise · warning · Error
Invalid SQLite path: path traversal detected in resolved pat
Error message
Invalid SQLite path: path traversal detected in resolved path
What it means
Thrown by validateSQLitePath (packages/components/src/validator.ts:350) when the resolved absolute path still contains '..' after path.resolve(). path.resolve normally collapses '..', so hitting this branch means an unusual absolute-path shape slipped past the earlier substring check.
Source
Thrown at packages/components/src/validator.ts:350
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}`
)
}
return resolvedPath
}
/**
* Restricts SQL executed against a SQLite database opened via validateSQLitePath to a
* single read-only SELECT/WITH statement.
*
* The Sql Database Chain hands LLM-generated SQL directly to TypeORM's raw query
* executor with no statement-type filtering. Without this guard, a compromised or
* malicious LLM response can run `ATTACH DATABASE`/`VACUUM INTO`/bare `PRAGMA` to write
* arbitrary files anywhere the process can write, bypassing validateSQLitePath (whichView on GitHub (pinned to abe4a8601a)
Solutions
- Run path.normalize() on the candidate path before passing it in.
- Build the path from trusted segments rather than string concatenation.
- Use a relative filename so it resolves cleanly under ~/.flowise.
Example fix
// before
nodeParams.databasePath = concatAbsPath // residual '..'
// after
const { path } = require('path')
nodeParams.databasePath = path.normalize(concatAbsPath) Defensive patterns
Strategy: validation
Validate before calling
const { normalize } = require('path');
const candidate = normalize(String(databasePath ?? ''));
if (candidate.includes('..')) throw new Error('DB path still contains .. after normalize'); Type guard
const isNormalized = (p: unknown): p is string => typeof p === 'string' && !normalize(p).includes('..'); Try / catch
try { validateSQLitePath(databasePath) } catch (e) { if (e instanceof Error && /resolved path/.test(e.message)) { databasePath = normalize(databasePath) } else throw e } Prevention
- path.normalize() DB paths before submission.
- Build paths with path.join, not string concatenation.
- Use plain filenames to avoid the absolute-path edge branch.
When it happens
Trigger: An absolute path that path.resolve does not fully normalize — rare; typically a hand-assembled or edge-case absolute path.
Common situations: Programmatic path concatenation; platform-specific quirks; effectively an internal safety net rather than a routine config error.
Related errors
- Invalid SQLite path: path traversal attempt detected
- Invalid SQLite path: path must be within allowed directories
- Invalid path: path traversal detected in resolved path
- Invalid SQLite path: encoded path traversal attempt detected
- Invalid SQLite path: null bytes or control characters detect
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/ad67124ad68f11eb.
Report an issue: GitHub.