A free open source IT asset/license management system
Fixed #19536 - double escaping EULA on web UI acceptance
snipe3415930af2af
diff --git a/app/Models/Category.php b/app/Models/Category.phpindex 230b4bddb3..511a630b66 100755--- a/app/Models/Category.php+++ b/app/Models/Category.php@@ -2,7 +2,6 @@namespace App\Models;-use App\Helpers\Helper;use App\Http\Traits\TwoColumnUniqueUndeletedTrait;use App\Models\Traits\Searchable;use App\Presenters\CategoryPresenter;@@ -296,14 +295,19 @@ class Category extends SnipeModel*/public function getEula(){-+ // Route through SnipeModel::sanitizeEulaForRender (protected on+ // the parent) so this override matches SnipeModel::getEula's+ // rendered-output shape: parseEscapedMarkedown + <img> tag strip.+ // Without the strip, callsites that render this method's output+ // (users/print.blade.php, etc.) would emit <img> tags the parent+ // path deliberately blocks per the mail-context LFR/SSRF hardening.if ($this->eula_text) {- return Helper::parseEscapedMarkedown($this->eula_text);+ return $this->sanitizeEulaForRender($this->eula_text);} elseif ((Setting::getSettings()->default_eula_text) && ($this->use_default_eula == '1')) {- return Helper::parseEscapedMarkedown(Setting::getSettings()->default_eula_text);- } else {- return null;+ return $this->sanitizeEulaForRender(Setting::getSettings()->default_eula_text);}++ return null;}/**diff --git a/resources/views/account/accept/create.blade.php b/resources/views/account/accept/create.blade.phpindex 8408dcdcb5..bc467a570b 100644--- a/resources/views/account/accept/create.blade.php+++ b/resources/views/account/accept/create.blade.php@@ -73,7 +73,12 @@@if ($acceptance->checkoutable->getEula())<div class="col-md-12" style="padding-top: 5px; padding-bottom: 15px;"><div style="background-color: rgba(211,211,211,0.25); padding: 10px; border: var(--box-header-bottom-border-color) 1px solid;">- {!! str_replace('<p>', '<p dir="auto">', Helper::parseEscapedMarkedown($acceptance->checkoutable->getEula())) !!}+ {{-- getEula() already returns rendered + sanitized HTML+ (SnipeModel::sanitizeEulaForRender runs parseEscapedMarkedown+ and strips img tags). A second parseEscapedMarkedown pass+ here would strip the block-level tags and re-parse the+ plain text, losing lists / headings / bold. --}}+ {!! str_replace('<p>', '<p dir="auto">', $acceptance->checkoutable->getEula()) !!}</div></div>@endif