Skip to content

[DEFECT] File upload validation rejects filenames with '..' in workflow endpoint #33785

Closed

Description

@zJaaal

Description

The IllegalTraversalFilePathValidator is incorrectly rejecting legitimate filenames that contain '..' when uploading files through the workflow actions endpoint. This prevents users from uploading files with valid names like macOS screenshot timestamps.

Steps to Reproduce

  1. Send a POST request to /api/v1/workflow/actions/default/fire/NEW
  2. Include a file in the formData with filename: Screenshot 2025-03-18 at 4.09.02 p.m..png
  3. Observe the security validation error

Current Behavior

The file upload is rejected with:

INFO  util.SecurityLogger - class com.dotcms.security.multipart.IllegalTraversalFilePathValidator : The filename: 'Screenshot 2025-03-18 at 4.09.02 p.m..png' is invalid

Expected Behavior

The file should be accepted since:

  • The '..' appears within the filename itself (part of "p.m."), not as a path component
  • There are no path separators (/ or ) adjacent to the '..'
  • This is a legitimate macOS screenshot filename pattern with time abbreviations

Impact

  • Users cannot upload macOS screenshots with default naming that includes "a.m." or "p.m."
  • Blocks common content creation workflows using screenshots
  • Affects any file with legitimate '..' in the name
  • Creates poor user experience with unclear error messaging

Technical Details

Endpoint: POST /api/v1/workflow/actions/default/fire/NEW
Request Type: multipart/form-data with file upload
Component: com.dotcms.security.multipart.IllegalTraversalFilePathValidator

Root Cause: The validator likely checks for '..' presence without context of whether it's part of a path traversal attempt or just part of the filename.

Suggested Fix: Update validation logic to:

  1. Check if '..' is preceded or followed by path separators (/, )
  2. Allow '..' when it's part of the filename with spaces or other non-path characters
  3. Consider normalizing the path first and checking if it escapes the intended directory
  4. Validate against the actual path component, not the full filename

Example Valid Filenames Being Rejected:

  • Screenshot 2025-03-18 at 4.09.02 p.m..png (macOS screenshot)
  • Meeting notes 3.15.24 ..draft.docx
  • Report Q1..Q2 2024.pdf

Activity

  1. added theissue type on Nov 11, 2025
  2. changed the title [-]False positive: File upload validation rejects filenames with '..' in workflow endpoint[/-] [+][DEFECT] File upload validation rejects filenames with '..' in workflow endpoint[/+] on Nov 11, 2025
  3. moved this from New to Next Sprint in dotCMS - Product Planningon Nov 12, 2025
  4. moved this from Next Sprint to In Progress in dotCMS - Product Planningon Nov 12, 2025
  5. added a commit that references this issue on Nov 12, 2025
  6. github-actions commented on Nov 12, 2025

    @github-actions
    Contributor
  7. added a commit that references this issue on Nov 13, 2025
  8. fabrizzio-dotCMS commented on Nov 13, 2025

    @fabrizzio-dotCMS
    Member

    Note to QA:
    Make sure the test includes a case like the one listed in #21854
    Here's a request that can be used to simulate an attack

    curl --location --request PUT 'http://localhost:8080/api/v1/workflow/actions/default/fire/PUBLISH' \
    --header 'Cookie: access_token=****' \
    --form 'json="{\"contentlet\":
        {
            \"contentType\":\"FileAsset\",
            \"fileName\":\"file-unnamed.png\",
            \"title\":\"title-unnamed.png\",
            \"hostFolder\":\"default\"
        }
    }";type=application/json' \
    --form 'file=@"/Users/lol/Downloads/unnamed.png";filename=../../mi-archivo-custom.png'
    

    Replace **** with a valid token

  9. 13 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions