Skip to content

A free open source IT asset/license management system

Fixes #4457 - use un-escaped CSS for custom CSS styles

snipeedcd3afc3ea4
diff --git a/app/Models/Setting.php b/app/Models/Setting.php
index b0d032da90..751faa80f5 100755
--- a/app/Models/Setting.php
+++ b/app/Models/Setting.php
@@ -89,6 +89,18 @@ class Setting extends Model
}
+ /**
+ * Escapes the custom CSS, and then un-escapes the greater-than symbol
+ * so it can work with direct descendant characters for bootstrap
+ * menu overrides like:
+ *
+ * .skin-blue .sidebar-menu>li.active>a, .skin-blue .sidebar-menu>li:hover>a
+ *
+ * Important: Do not remove the e() escaping here, as we output raw in the blade.
+ *
+ * @return string escaped CSS
+ * @author A. Gianotto <[email protected]>
+ */
public function show_custom_css()
{
$custom_css = Setting::getSettings()->custom_css;
diff --git a/resources/views/layouts/default.blade.php b/resources/views/layouts/default.blade.php
index 58f6acae54..e52a2d8f95 100644
--- a/resources/views/layouts/default.blade.php
+++ b/resources/views/layouts/default.blade.php
@@ -52,7 +52,7 @@
@endif
@if ($snipeSettings->custom_css)
- {{ $snipeSettings->show_custom_css() }}
+ {!! $snipeSettings->show_custom_css() !!}
@endif
@endif
@media (max-width: 400px) {