Problem/Motivation

The settings form accepts ../x as File directory. validateDirectory() only trims slashes, so files would be written to public://../x.

Steps to reproduce

  1. Set File directory to ../x on the settings form.
  2. Save. It is accepted.

Proposed resolution

Refuse . and .. segments and absolute paths with a field error.

Remaining tasks

  • ✅ File an issue
  • ❌ Addition/Change/Update/Fix
  • ❌ Testing to ensure no regression
  • ➖ Automated unit/functional testing coverage
  • ➖ Developer Documentation support
  • ➖ User Guide Documentation support
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ❌ Reviewed by a human
  • ❌ Code review by maintainers
  • ❌ Full testing and approval
  • ❌ Credit contributors
  • ❌ Review with the product owner
  • ✅ Update Release Notes
  • ✅ Release

User interface changes

  • Before (1.0.x): a file directory of ../x is saved.
     a file directory of ../x is saved.
  • After: ../x is refused with a field error.
     ../x is refused with a field error.

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • N/A

AI-Generated: Yes

CommentFileSizeAuthor
#3 3634862-after.png92.62 KBrajab natshah
#3 3634862-before.png110.03 KBrajab natshah

Issue fork ai_media-3634862

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
StatusFileSize
new110.03 KB
new92.62 KB

  • rajab natshah committed cb03193a on 1.0.x
    fix: #3634862 Refuse a file directory that leaves the files folder
    
rajab natshah’s picture

Issue summary: View changes
Status: Active » Fixed
Issue tags: +ai_media-1.0.0-rc1

✅ Released ai_media-1.0.0-rc1

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.