Skip to content

Commit

Permalink
Fixed: Secure the uploads (OFBIZ-12080)
Browse files Browse the repository at this point in the history
For the same reason I explained to Danny trunk, this renames upload_file_type
to up_load_file_type

# Conflicts handled by
 EditCategory.groovy
 EditProductConfigItemContent.groovy
 ImageUpload.groovy
 EditProductContent.groovy
 EditProductConfigItemContent.ftl
  • Loading branch information
JacquesLeRoux committed Dec 6, 2024
1 parent bf5788b commit 857f85f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ context.imageNameLinkTwo = imageUrlPrefix + "/" + filenameExpander.expandString

forLock = new Object()
contentType = null
fileType = request.getParameter("upload_file_type")
fileType = request.getParameter('up_load_file_type')
if (fileType) {
context.fileType = fileType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ context.tryEntity = tryEntity

forLock = new Object()
contentType = null
fileType = request.getParameter("upload_file_type")
fileType = request.getParameter('up_load_file_type')
if (fileType) {
context.fileType = fileType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ context.tryEntity = tryEntity
// UPLOADING STUFF
forLock = new Object()
contentType = null
String fileType = request.getParameter("upload_file_type")
String fileType = request.getParameter('up_load_file_type')
if (fileType) {

context.fileType = fileType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ context.tryEntity = tryEntity
// UPLOADING STUFF
forLock = new Object()
contentType = null
String fileType = request.getParameter("upload_file_type")
String fileType = request.getParameter('up_load_file_type')
if (fileType) {

context.fileType = fileType
Expand Down
8 changes: 4 additions & 4 deletions applications/product/template/category/EditCategory.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,15 @@ function insertImageName(type,nameValue) {
<h3>${uiLabelMap.ProductCategoryUploadImage}</h3>
</div>
<div class="screenlet-body">
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId!}&amp;upload_file_type=category</@ofbizUrl>" name="imageUploadForm">
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId!}&amp;up_load_file_type=category</@ofbizUrl>" name="imageUploadForm">
<table cellspacing="0" class="basic-table">
<tr><td>
<input type="file" size="50" name="fname"/>
<br />
<span>
<label><input type="radio" name="up_load_file_type_bogus" value="category" checked="checked" onclick='setUploadUrl("<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId}&amp;upload_file_type=category</@ofbizUrl>");'/>${uiLabelMap.ProductCategoryImageUrl}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="linkOne" onclick='setUploadUrl("<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId}&amp;upload_file_type=linkOne</@ofbizUrl>");'/>${uiLabelMap.ProductLinkOneImageUrl}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="linkTwo"onclick='setUploadUrl("<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId}&amp;upload_file_type=linkTwo</@ofbizUrl>");'/>${uiLabelMap.ProductLinkTwoImageUrl}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="category" checked="checked" onclick='setUploadUrl("<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId}&amp;up_load_file_type=category</@ofbizUrl>");'/>${uiLabelMap.ProductCategoryImageUrl}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="linkOne" onclick='setUploadUrl("<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId}&amp;up_load_file_type=linkOne</@ofbizUrl>");'/>${uiLabelMap.ProductLinkOneImageUrl}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="linkTwo"onclick='setUploadUrl("<@ofbizUrl>UploadCategoryImage?productCategoryId=${productCategoryId}&amp;up_load_file_type=linkTwo</@ofbizUrl>");'/>${uiLabelMap.ProductLinkTwoImageUrl}</label>
</span>
<input type="submit" class="smallSubmit" value="${uiLabelMap.ProductUploadImage}"/>
</td></tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ function insertImageName(size,nameValue) {
<h3>${uiLabelMap.ProductUploadImage}</h3>
</div>
<div class="screenlet-body">
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadProductConfigItemImage?configItemId=${configItemId}&amp;upload_file_type=small</@ofbizUrl>" name="imageUploadForm">
<input type="file" size="50" name="fname" />
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadProductConfigItemImage?configItemId=${configItemId}&amp;up_load_file_type=small</@ofbizUrl>" name="imageUploadForm">
<input type="file" size="50" name="fname" accept=".png,.gif,.jpg,.jpeg,.tiff,.tif"/>
<input type="submit" class="smallSubmit" value="${uiLabelMap.ProductUploadImage}" />
</form>
</div>
Expand Down
12 changes: 6 additions & 6 deletions applications/product/template/product/EditProductContent.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -184,19 +184,19 @@ under the License.
};
</script>
<h3>${uiLabelMap.ProductUploadImage}</h3>
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadProductImage?productId=${productId}&amp;upload_file_type=original</@ofbizUrl>" name="imageUploadForm">
<form method="post" enctype="multipart/form-data" action="<@ofbizUrl>UploadProductImage?productId=${productId}&amp;up_load_file_type=original</@ofbizUrl>" name="imageUploadForm">
<table cellspacing="0" class="basic-table">
<tr>
<td width="20%" align="right" valign="top">
<input type="file" size="50" name="fname"/>
</td>
<td>&nbsp;</td>
<td width="80%" colspan="4" valign="top">
<label><input type="radio" name="up_load_file_type_bogus" value="small" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;upload_file_type=small</@ofbizUrl>");'/>${uiLabelMap.CommonSmall}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="medium" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;upload_file_type=medium</@ofbizUrl>");'/>${uiLabelMap.CommonMedium}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="large"onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;upload_file_type=large</@ofbizUrl>");'/>${uiLabelMap.CommonLarge}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="detail" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;upload_file_type=detail</@ofbizUrl>");'/>${uiLabelMap.CommonDetail}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="original" checked="checked" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;upload_file_type=original</@ofbizUrl>");'/>${uiLabelMap.ProductOriginal}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="small" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;up_load_file_type=small</@ofbizUrl>");'/>${uiLabelMap.CommonSmall}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="medium" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;up_load_file_type=medium</@ofbizUrl>");'/>${uiLabelMap.CommonMedium}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="large"onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;up_load_file_type=large</@ofbizUrl>");'/>${uiLabelMap.CommonLarge}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="detail" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;up_load_file_type=detail</@ofbizUrl>");'/>${uiLabelMap.CommonDetail}</label>
<label><input type="radio" name="up_load_file_type_bogus" value="original" checked="checked" onclick='setUploadUrl("<@ofbizUrl>UploadProductImage?productId=${productId}&amp;up_load_file_type=original</@ofbizUrl>");'/>${uiLabelMap.ProductOriginal}</label>
<input type="submit" class="smallSubmit" value="${uiLabelMap.ProductUploadImage}"/>
</td>
</tr>
Expand Down

0 comments on commit 857f85f

Please sign in to comment.