Code Explainers

Code explainers tagged #sanitization

ruby
module MarkdownHelper
  ALLOWED_TAGS = %w[
    p br strong em del a ul ol li blockquote code pre
    h1 h2 h3 h4 h5 h6 hr img table thead tbody tr th td

Safely rendering Markdown in a Rails helper

sanitization markdown security
Intermediate 8 steps
python
import bleach
 
ALLOWED_TAGS = [
    "a", "b", "strong", "i", "em", "u",

Sanitizing user HTML with bleach

sanitization xss-prevention whitelisting
Intermediate 5 steps
typescript
import sanitizeHtml from "sanitize-html";
 
interface RichTextOptions {
  allowImages?: boolean;

Building a configurable HTML sanitizer allowlist

sanitization xss-prevention allowlist
Intermediate 7 steps
php
<?php
 
declare(strict_types=1);
 

Validating registration input with filter_var

validation sanitization filter_var
Intermediate 8 steps