Fixed semgrep error
This commit is contained in:
@@ -7,10 +7,17 @@ const sourceExtensions = new Set(['.js', '.mjs', '.ts'])
|
||||
|
||||
const publicWritePattern = /\b(writeFile|appendFile|copyFile|rename|mkdir)\s*\([^)]*(public[/\\](?:data|uploads)|['"`]public['"`]\s*,\s*['"`](?:data|uploads)['"`])/s
|
||||
|
||||
function childPath(dir, name) {
|
||||
if (name !== path.basename(name) || name.includes('/') || name.includes('\\')) {
|
||||
throw new Error(`Ungueltiger Dateiname beim Scannen: ${name}`)
|
||||
}
|
||||
return `${dir}${path.sep}${name}`
|
||||
}
|
||||
|
||||
function walk(dir) {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true })
|
||||
return entries.flatMap((entry) => {
|
||||
const fullPath = path.join(dir, entry.name)
|
||||
const fullPath = childPath(dir, entry.name)
|
||||
if (entry.isDirectory()) return walk(fullPath)
|
||||
return [fullPath]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user