Overview
When users can specify a custom filename for the downloaded video (once implemented), the filename input must be sanitized to prevent path traversal characters and invalid filename characters.
Risk
Characters like ../, /, \, :, *, ?, ", <, >, | are invalid in filenames on various OS.
Proposed Solution
const sanitizeFilename = (name: string): string => {
return name
.replace(/[<>:"/\\|?*]/g, '') // Remove invalid chars
.replace(/\.\.+/g, '.') // No path traversal
.trim()
.slice(0, 100) // Max length
|| 'output' // Fallback
}
Acceptance Criteria
Overview
When users can specify a custom filename for the downloaded video (once implemented), the filename input must be sanitized to prevent path traversal characters and invalid filename characters.
Risk
Characters like
../,/,\,:,*,?,",<,>,|are invalid in filenames on various OS.Proposed Solution
Acceptance Criteria