Fixed semgrep error
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 5m56s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m36s

This commit is contained in:
Torsten Schulz (local)
2026-06-14 21:29:53 +02:00
parent 77aabef4a9
commit b69130c2b2
3 changed files with 179 additions and 43 deletions

View File

@@ -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]
})