Move created packages out of webroot #12114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prerequisites
Description
PR #11654 already moved the
umbraco/Data/Packages/createdPackages.config
file into the database, but the new service still saved the actualpackage.xml
/package.zip
into the media folder in the webroot (wwwroot/media/created-packages
). PR #11783 unintentionally changed this towwwroot/created-packages
(because of the leading slash on theConstants.SystemDirectories.CreatedPackages
, making it relative to the webroot).By saving these files inside the webroot, they are automatically downloadable by everyone (if you can guess the package name). This has always been the case, but because the package manifest can contain sensitive data (author names, dates, unpublished content, source code of templates/views/partial views, etc.), I would argue we simply shouldn't do this.
This PR ensures the created packages are now stored in
umbraco/Data/CreatedPackages
. If you've already created packages in the backoffice, those won't be moved and can still be downloaded, because the package file path is retrieved from the package manifest:Umbraco-CMS/src/Umbraco.Web.BackOffice/Controllers/PackageController.cs
Line 138 in 8eb3ef6
To test:
package.xml
orpackage.zip
is created and the previous file is cleaned up