FlowiseAI/Flowise · error · Error

Invalid path: path traversal attempt detected

Error message

Invalid path: path traversal attempt detected

What it means

Thrown by validateVectorStorePath (packages/components/src/validator.ts:230) when the user-supplied vector store base path contains a literal '..' substring. Flowise runs this check before Faiss/SimpleStore and similar nodes open a directory, so a crafted node config cannot escape ~/.flowise. It is the first staged check (followed by encoded-traversal, control-char, absolute/UNC, and allow-list checks).

Source

Thrown at packages/components/src/validator.ts:230

export const validateVectorStorePath = (userProvidedPath: string | undefined): string => {
    if (process.env.PATH_TRAVERSAL_SAFETY === 'false') {
        if (!userProvidedPath || userProvidedPath.trim() === '') {
            return path.join(getUserHome(), '.flowise', 'vectorstore')
        }
        const bypassPath = userProvidedPath.trim()
        return path.isAbsolute(bypassPath) ? bypassPath : path.resolve(path.join(getUserHome(), '.flowise', bypassPath))
    }

    // If no path provided, use default secure location
    if (!userProvidedPath || userProvidedPath.trim() === '') {
        return path.join(getUserHome(), '.flowise', 'vectorstore')
    }

    const basePath = userProvidedPath.trim()

    // Check for explicit path traversal patterns (..)
    if (basePath.includes('..')) {
        throw new Error('Invalid path: path traversal attempt detected')
    }

    // Check for URL-encoded path traversal
    if (basePath.toLowerCase().includes('%2e') || basePath.toLowerCase().includes('%2f') || basePath.toLowerCase().includes('%5c')) {
        throw new Error('Invalid path: encoded path traversal attempt detected')
    }

    // Check for null bytes and control characters
    if (/\0/.test(basePath) || /[\x00-\x1f]/.test(basePath)) {
        throw new Error('Invalid path: null bytes or control characters detected')
    }

    // Check for Windows-specific absolute paths and UNC paths (even on Unix systems)
    // This prevents cross-platform attack vectors
    if (/^[a-zA-Z]:\\/.test(basePath)) {
        throw new Error('Invalid path: Windows absolute paths are not allowed')
    }
    if (/^\\\\[^\\]/.test(basePath)) {

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Use a simple relative name (e.g. 'myStore') and let Flowise resolve it under ~/.flowise.
  2. Use an absolute path that lives under an allowed dir (~/.flowise or BLOB_STORAGE_PATH).
  3. Rename any filename containing '..' (e.g. 'vec..1' -> 'vec_1').
  4. Set PATH_TRAVERSAL_SAFETY=false to disable all traversal checks (not recommended, security regression).

Example fix

// before
nodeParams.basePath = '../../shared/vectors'

// after
nodeParams.basePath = 'shared-vectors'   // resolves to ~/.flowise/shared-vectors
Defensive patterns

Strategy: validation

Validate before calling

const isSafeRelativePath = (p) => typeof p === 'string' && p.trim() !== '' && !p.includes('..') && !/%2e|%2f|%5c/i.test(p) && !/[\x00-\x1f]/.test(p) && !/^[a-zA-Z]:\\/.test(p) && !/^\\\\[^\\]/.test(p);
if (!isSafeRelativePath(basePath)) throw new Error('basePath failed pre-validation');

Type guard

const isPlainRelativePath = (p: unknown): p is string => typeof p === 'string' && p.trim() !== '' && !p.includes('..') && !/[\\/]/.test(p.trim().split('/').pop() ?? '');

Try / catch

try { const resolved = validateVectorStorePath(basePath) } catch (e) { if (e instanceof Error && e.message.startsWith('Invalid path:')) { /* surface to user */ } else throw e }

Prevention

When it happens

Trigger: A vector store node is configured with a Base Path containing '..', e.g. '../../etc', 'data/../shared', or even a filename with consecutive dots like 'my..store'. Any substring match of '..' trips it.

Common situations: Relative paths intended to point outside the data dir; copy-pasted examples that assume a different CWD; symlink-style '../data' shortcuts; legitimate filenames that happen to contain '..'.

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/68cb45d00702bc4d. Report an issue: GitHub.