T09 · Insecure Skill Coding Practices
- Location
scripts/chat.js:51- Finding
Extension-Only Image Validation Allows Unintended Local File Disclosure
- Content
View full analysis
{ ``` ### Technical Analysis The `imageToBase64` function determines whether a file is an image solely from its filename extension. It does not inspect file signatures or decoded image structure, reject symbolic links, verify that the path identifies a regular file, restrict access to an approved directory, or impose a file-size limit. Consequently, a file containing arbitrary non-image data can be read ...[truncated 2204 chars]- Remediation
View remediation
MAX_IMAGE_SIZE) { throw new Error('Image exceeds the permitted size'); } // Detect and decode the image format from its contents before transmission. ``` ]]>
