Skip to content

Commit

Permalink
Prevent front-end from uploading SVG images to avoid SVG XSS attacks. #…
Browse files Browse the repository at this point in the history
  • Loading branch information
yushine committed Dec 24, 2024
1 parent f007c80 commit 7ccc90d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion innopacks/front/src/Requests/UploadImageRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ public function authorize(): bool
*/
public function rules(): array
{
if (is_admin()) {
$rule = 'required|image|mimes:jpg,png,jpeg,gif,svg,webp|max:4096';
} else {
$rule = 'required|image|mimes:jpg,png,jpeg,gif,webp|max:2048';
}

return [
'image' => 'required|image|mimes:jpg,png,jpeg,gif,svg,webp|max:4096',
'image' => $rule,
'type' => 'required|alpha_dash',
];
}
Expand Down

0 comments on commit 7ccc90d

Please sign in to comment.