From 4bad915c09b2fb908534bd8ed1b8a99ecdc4066b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 10 Nov 2021 12:28:47 +0100 Subject: [PATCH] Fix flash info html save and display - require kwaadpepper/crud-policies version 0.2.0 --- app/Http/Middleware/XssSanitizer.php | 2 ++ composer.json | 2 +- composer.lock | 14 +++++----- config/crud-policies.php | 11 ++++++++ config/purifier.php | 29 ++++++++++++++------ resources/sass/back.scss | 6 ++++ resources/views/front/flashes/show.blade.php | 6 ++-- resources/views/layouts/frontend.blade.php | 1 + 8 files changed, 52 insertions(+), 19 deletions(-) diff --git a/app/Http/Middleware/XssSanitizer.php b/app/Http/Middleware/XssSanitizer.php index f76446e..a76735b 100644 --- a/app/Http/Middleware/XssSanitizer.php +++ b/app/Http/Middleware/XssSanitizer.php @@ -18,7 +18,9 @@ class XssSanitizer $inputs = $request->all(); array_walk_recursive($inputs, function (&$input, $name) use ($params) { if (in_array($name, $params)) { + // dd($input); $input = clean($input); + // dd($input); } else { $input = strip_tags($input); } diff --git a/composer.json b/composer.json index 84e9a8a..66ca7a6 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "htmlmin/htmlmin": "^8.0", - "kwaadpepper/crud-policies": "^0.1.16", + "kwaadpepper/crud-policies": "^0.2.0", "kwaadpepper/enum": "^2.0", "kwaadpepper/exception-handler": "^0.0.1", "kwaadpepper/image-resizer": "^0.0.3", diff --git a/composer.lock b/composer.lock index 5db9bef..864c162 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cc3bd882d3df0ba824d42cd9c8da2380", + "content-hash": "aa6a451b2a130545431f84b00225801f", "packages": [ { "name": "asm89/stack-cors", @@ -1763,16 +1763,16 @@ }, { "name": "kwaadpepper/crud-policies", - "version": "0.1.22", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/Kwaadpepper/crud-policies.git", - "reference": "fb3c8e2ee065f9ed102db90394838b255d06cc15" + "reference": "46a43a1f191e8dc3ddf9cc76f97d4cc3998ddbdd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/fb3c8e2ee065f9ed102db90394838b255d06cc15", - "reference": "fb3c8e2ee065f9ed102db90394838b255d06cc15", + "url": "https://api.github.com/repos/Kwaadpepper/crud-policies/zipball/46a43a1f191e8dc3ddf9cc76f97d4cc3998ddbdd", + "reference": "46a43a1f191e8dc3ddf9cc76f97d4cc3998ddbdd", "shasum": "" }, "require": { @@ -1821,9 +1821,9 @@ ], "support": { "issues": "https://github.com/Kwaadpepper/crud-policies/issues", - "source": "https://github.com/Kwaadpepper/crud-policies/tree/0.1.22" + "source": "https://github.com/Kwaadpepper/crud-policies/tree/0.2.0" }, - "time": "2021-10-22T10:14:13+00:00" + "time": "2021-11-10T11:22:31+00:00" }, { "name": "kwaadpepper/enum", diff --git a/config/crud-policies.php b/config/crud-policies.php index 34254a7..4dee55a 100644 --- a/config/crud-policies.php +++ b/config/crud-policies.php @@ -9,6 +9,17 @@ return [ */ 'urlPrefix' => 'crud-policies', + /** + * You shall protect routes + * These are applied to crud routes directly as middlewares + */ + 'middlewares' => [ + \App\Http\Middleware\EncryptCookies::class, + \App\Http\Middleware\PreventRequestsDuringMaintenance::class, + \Illuminate\Session\Middleware\StartSession::class, + 'auth:web' + ], + /** * The public path where are stored * crud-policies asset files diff --git a/config/purifier.php b/config/purifier.php index fd1b7e1..5b44644 100644 --- a/config/purifier.php +++ b/config/purifier.php @@ -25,24 +25,23 @@ return [ 'cacheFileMode' => 0755, 'settings' => [ 'default' => [ + 'HTML.SafeIframe' => true, // For iframes + 'URI.SafeIframeRegexp' => "%^(http://|https://|//)(vimeo.com)%", 'HTML.Doctype' => 'HTML 4.01 Transitional', - 'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]', - 'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align', + 'HTML.Allowed' => 'h1[style],h2[style],h3[style],h4[style],h5[style],h6[style],figure[class|style],oembed[url],div[style],b,strong,i,em,u,a[href|title],ul[style],ol[style],dl[style],li,p[style],br,span[style|class],img[width|height|alt|src|style|class],iframe[src|width|height|class|frameborder|style],table[style],thead,tbody,th,tr,td,hr', + 'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align,list-style-type,float,width,height', 'AutoFormat.AutoParagraph' => false, - 'AutoFormat.RemoveEmpty' => true, - 'AutoFormat.RemoveEmpty.RemoveNbsp' => true, - ], - 'test' => [ - 'Attr.EnableID' => 'true', + 'AutoFormat.RemoveEmpty' => false, + 'AutoFormat.RemoveEmpty.RemoveNbsp' => false, ], "youtube" => [ "HTML.SafeIframe" => 'true', - "URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%", + "URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|vimeo.com/)%", ], 'custom_definition' => [ 'id' => 'html5-definitions', 'rev' => 1, - 'debug' => false, + 'debug' => true, 'elements' => [ // http://developers.whatwg.org/sections.html ['section', 'Block', 'Flow', 'Common'], @@ -59,6 +58,7 @@ return [ // http://developers.whatwg.org/grouping-content.html ['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'], ['figcaption', 'Inline', 'Flow', 'Common'], + ['oembed', 'Inline', 'Flow', 'Common'], // http://developers.whatwg.org/the-video-element.html#the-video-element ['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [ @@ -95,13 +95,24 @@ return [ ['tr', 'width', 'Text'], ['tr', 'height', 'Text'], ['tr', 'border', 'Text'], + ['figure', 'class', 'Text'], + ['figure', 'style', 'Text'], + ['oembed', 'url', 'Text'], + ['span', 'style', 'Text'], + ['img', 'style', 'Text'], ], ], 'custom_attributes' => [ ['a', 'target', 'Enum#_blank,_self,_target,_top'], + ['ol', 'style', 'Text'], + ['figure', 'style', 'Text'], + ['img', 'style', 'Text'], + ['span', 'style', 'Text'], + ['oembed', 'url', 'Text'], ], 'custom_elements' => [ ['u', 'Inline', 'Inline', 'Common'], + ['oembed', 'Inline', 'Inline', 'Common'], ], ], diff --git a/resources/sass/back.scss b/resources/sass/back.scss index ec8bb2d..75716a2 100644 --- a/resources/sass/back.scss +++ b/resources/sass/back.scss @@ -1,3 +1,9 @@ @import "_import"; @import "layouts/backend/top_nav"; + +// ckeditor fix with to navbar +.ck .ck-sticky-panel .ck-sticky-panel__content_sticky { + position: fixed !important; + top: 3.6rem !important; +} diff --git a/resources/views/front/flashes/show.blade.php b/resources/views/front/flashes/show.blade.php index 02bfd57..8d31aa6 100644 --- a/resources/views/front/flashes/show.blade.php +++ b/resources/views/front/flashes/show.blade.php @@ -20,7 +20,9 @@

{{ $flash->title }}

{{ $flash->created_at->format('d/m/Y') }}

-

{!! $flash->content !!}

+
+
{!! clean($flash->content) !!}
+
@@ -35,4 +37,4 @@ -@endsection \ No newline at end of file +@endsection diff --git a/resources/views/layouts/frontend.blade.php b/resources/views/layouts/frontend.blade.php index 76608ba..5391b64 100644 --- a/resources/views/layouts/frontend.blade.php +++ b/resources/views/layouts/frontend.blade.php @@ -3,6 +3,7 @@ @include('layouts.frontend.head') @stack('styles') + @crudPoliciesCSS() @include("layouts.frontend.header")