MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / isPathWithinAllowedSQLiteDirs

Function isPathWithinAllowedSQLiteDirs

packages/components/src/validator.ts:301–307  ·  view source on GitHub ↗
(resolvedPath: string, allowedDirs: string[])

Source from the content-addressed store, hash-verified

299}
300
301const isPathWithinAllowedSQLiteDirs = (resolvedPath: string, allowedDirs: string[]): boolean => {
302 const normalizedResolved = normalizePlatformPath(resolvedPath)
303 return allowedDirs.some((allowedDir) => {
304 const normalizedAllowed = normalizePlatformPath(allowedDir)
305 return normalizedResolved === normalizedAllowed || normalizedResolved.startsWith(normalizedAllowed + path.sep)
306 })
307}
308
309/**
310 * Validates and sanitizes a SQLite database file path to prevent path traversal

Callers 1

validateSQLitePathFunction · 0.85

Calls 1

normalizePlatformPathFunction · 0.85

Tested by

no test coverage detected