html-sanitizing

PrimeFaces 7.0 <p:textEditor HTML-sanitizer discards text formatting, such as centering

久未见 提交于 2021-01-28 13:52:56
问题 In PrimeFaces 8, it seems to be possible to enable / disable HMTML -sanitizer when using the <p:textEditor component by just specifying secure='false' for disabling it and secure='true' for enabling it. I tried to disable it in PrimeFaces 7.0 like this: <p:textEditor id="quillToolbarId" secure='false' widgetVar="editor2" height="300" value="#{editTemplatesBean.kaufAnbotTemplate}" placeholder="Enter your content"> but the sanitizer still seems to be working. My problem is that whenever I

Angular 5 - sanitizing HTML with pipe

烈酒焚心 提交于 2020-02-02 02:34:06
问题 When i got the warning: "WARNING: sanitizing HTML stripped some content" I did some research and saw people using the pipe below or a pipe that looks like the one below import { Pipe, PipeTransform } from "@angular/core"; import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; @Pipe({ name: 'sanitizeHtml' }) export class SanitizeHtmlPipe implements PipeTransform { constructor(private _sanitizer:DomSanitizer) { } transform(v:string):SafeHtml { return this._sanitizer

htmlspecialchars causing text to disapear

北城以北 提交于 2020-01-04 09:24:30
问题 I encountered a particular string (it's not completely printable, but you can see it below) that causes a htmlspecialchars() to return a zero-length string. Is there any way this can be fixed? $Stmnt = 'SELECT subject_name FROM bans WHERE id = 2321'; $Fetch = $Conn->query($Stmnt); if(!$Fetch) die('Could not query DB'); while($Row = $Fetch->fetch_array(MYSQLI_ASSOC)) { $RawName = $Row['subject_name']; $RawLen = strlen($RawName); echo('RAW NAME: ['.$RawName.']'.', LENGTH: ['.$RawLen.']'.'<br />

htmlspecialchars causing text to disapear

一曲冷凌霜 提交于 2020-01-04 09:24:06
问题 I encountered a particular string (it's not completely printable, but you can see it below) that causes a htmlspecialchars() to return a zero-length string. Is there any way this can be fixed? $Stmnt = 'SELECT subject_name FROM bans WHERE id = 2321'; $Fetch = $Conn->query($Stmnt); if(!$Fetch) die('Could not query DB'); while($Row = $Fetch->fetch_array(MYSQLI_ASSOC)) { $RawName = $Row['subject_name']; $RawLen = strlen($RawName); echo('RAW NAME: ['.$RawName.']'.', LENGTH: ['.$RawLen.']'.'<br />

How do I filter out Dangerous HTML like SO does? [duplicate]

你。 提交于 2020-01-03 18:51:38
问题 This question already has answers here : How to prevent XSS with HTML/PHP? (10 answers) Sanitizing HTML input (4 answers) Closed 6 years ago . I want to provide an HTML editor on my site, but don't want to open myself up to xss or other attacks that come with allowing user-generated HTML. This is pretty similar to what Stack Overflow does. How is the HTML checked/sanitized here so that the styling information still remains, while other, more dangerous stuff (like javascript, iframes, etc.)

Data loss when passing raw HTML from View to Controller in POST request — XSS-safety & information loss

不羁岁月 提交于 2019-12-29 09:36:13
问题 Preamble My use-case includes a front-end WYSIWYG editor. Taking user input in HTML5/CSS format from the CSHTML Front-End View. Receiving the input in the Backend Controller's action via POST request. And finally doing fancy Database stuff with it. Sounds pretty easy. Using this beast of an editor, it's very straightforward and customizable. View WYSIWYG editor textarea nested within a form to send editor's raw HTML data using POST <form class="form" asp-controller="CreationController" asp

Escape non HTML tags in plain text (convert plain text to HTML)

主宰稳场 提交于 2019-12-29 02:05:41
问题 Using Rails, I need to get a plain text and show it as HTML, but I don't want to use <pre> tag, as it changes the format. 回答1: I needed to subclass HTML::WhiteListSanitizer to escape non whitelisted tags (by changing process_node ), monkey patch HTML::Node to don't downcase tags' names and monkey patch HTML::Text to apply <wbr /> word splitting: class Text2HTML def self.convert text text = simple_format text text = auto_link text, :all, :target => '_blank' text = NonHTMLEscaper.sanitize text

MySQL HTML sanitization

[亡魂溺海] 提交于 2019-12-25 08:33:13
问题 I have a website that saves data to a MySQL database Should I escape the HTML upon inserting it into MySQL or upon displaying it on my website? Ideally, I'd like to input raw HTML into my database and just sanitize each time I pull from it. Is there any danger in doing it this way? Example html: <h1>test</h1> 回答1: typically users won't save HTML, but I don't want them to be restricted. Of course that HTML won't be executed. It will just be displayed Should I escape the HTML upon inserting it