Repository navigation
4.2.0
Fixes
- Closed an open-redirect in the admin
FileStorageController::delete()action: the?redirect=query string was forwarded straight intoController::redirect(), allowing a 302 to any absolute URL after the destructive action. The handler now only honours relative internal paths (and the existingredirect=refreferer mode). - Hardened
Filesystem\Folder::realpath()against path traversal. After canonicalization the resolved path must stay under the folder'spwd(); absolute paths and..walks that escape the seeded directory now returnfalse. Behaviour change: external callers that previously relied onrealpath()to resolve arbitrary out-of-tree paths will need to construct a freshFolderfor each base. Utility\StorageUtils::fileToUploadedFile{Object,Array}()now throwInvalidArgumentExceptionwhen the source path is not a readable regular file, instead of silently producing a corrupted upload entity fromfilesize() === false.Command\ImageVariantGenerateCommand::getTransformer()no longer drops a configureddataTransformer. The previous logic only assigned the default branch and ignored any configured implementation, leaving the fieldnulland tripping the internalassert().
Improvements
- New allow-list helpers on
Model\Validation\UploadValidationTrait:hasAllowedExtension(array $extensions)— case-insensitive, leading-dot tolerant, accepts bothUploadedFileInterfaceand array shapes.hasAllowedMimeType(array $mimes, bool $sniff = true)— sniffs server-side viafinfoagainst the actual file contents by default, so the client-suppliedContent-Typeheader cannot be spoofed. Pass$sniff = falsefor tests when you need to fall back to the client header.
Command\CleanupCommand::removeOrphanedFiles()allowlist is now an O(1) hash set keyed by absolute path. The previousin_array()walk was O(n*m) and could time out part-way through cleanup on directories with many thousand files, leaving the storage tree inconsistent.- Admin UI is fully CSP-compatible — no inline scripts or styles (#21).
- Renamed the shadowing
entityloop variable inFileAssociationBehavior::findAndRemovePreviousFile()toexistingso the outer parameter is no longer clobbered after the loop.
Full Changelog: 4.1.1...4.2.0