Skip to content
KitploitKITPLOIT
HerramientasExploitsBlog
Log in
Enviar
HerramientasExploitsBlog
Enviar

¡Herramientas de Hacking, PenTest y Ciberseguridad para tu Arsenal de Seguridad!

Kitploit es un directorio de herramientas de hacking, ciberseguridad y pentesting. Descubre las últimas actualizaciones de proyectos para encontrar vulnerabilidades, analizar sistemas, automatizar pruebas y fortalecer tu seguridad.

FeedsContactoPrivacidad© 2026 Kitploit

Directorio de Herramientas

Categorías

Ver todas las categorías
Loading categories
html-sanitizer — Proporciona una API orientada a objetos para sanear la entrada HTML no confiable y permitir su inserción segura en el DOM de un documento. | Kitploit
Herramientas/GitHubGitHub/symfony/html-sanitizer
Herramientas DefensivasExplotación de Aplicaciones WebSeguridad WebUtilidades y Frameworks
GitHubsymfony/html-sanitizer

html-sanitizer

Proporciona una API orientada a objetos para sanear la entrada HTML no confiable y permitir su inserción segura en el DOM de un documento.

Ver Repositorio
2871428 nov 2026Revisado por Kitploit
Compartir
Sitio web

Componente HtmlSanitizer

El componente HtmlSanitizer proporciona una API orientada a objetos para sanear entradas HTML no confiables para su inserción segura en el DOM de un documento.

Uso

use Symfony\Component\HtmlSanitizer\HtmlSanitizerConfig;
use Symfony\Component\HtmlSanitizer\HtmlSanitizer;

// By default, an element not added to the allowed or blocked elements
// will be dropped, including its children
$config = (new HtmlSanitizerConfig())
    // Allow "safe" elements and attributes. All scripts will be removed
    // as well as other dangerous behaviors like CSS injection
    ->allowSafeElements()

    // Allow all static elements and attributes from the W3C Sanitizer API
    // standard. All scripts will be removed but the output may still contain
    // other dangerous behaviors like CSS injection (click-jacking), CSS
    // expressions, ...
    ->allowStaticElements()

    // Allow the "div" element and no attribute can be on it
    ->allowElement('div')

    // Allow the "a" element, and the "title" attribute to be on it
    ->allowElement('a', ['title'])

    // Allow the "span" element, and any attribute from the Sanitizer API is allowed
    // (see https://wicg.github.io/sanitizer-api/#default-configuration)
    ->allowElement('span', '*')

    // Block the "section" element: this element will be removed but
    // its children will be retained
    ->blockElement('section')

    // Drop the "div" element: this element will be removed, including its children
    ->dropElement('div')

    // Allow the attribute "title" on the "div" element
    ->allowAttribute('title', ['div'])

    // Allow the attribute "data-custom-attr" on all currently allowed elements
    ->allowAttribute('data-custom-attr', '*')

    // Drop the "data-custom-attr" attribute from the "div" element:
    // this attribute will be removed
    ->dropAttribute('data-custom-attr', ['div'])

    // Drop the "data-custom-attr" attribute from all elements:
    // this attribute will be removed
    ->dropAttribute('data-custom-attr', '*')

    // Forcefully set the value of all "rel" attributes on "a"
    // elements to "noopener noreferrer"
    ->forceAttribute('a', 'rel', 'noopener noreferrer')

    // Transform all HTTP schemes to HTTPS
    ->forceHttpsUrls()

    // Configure which schemes are allowed in links (others will be dropped)
    ->allowLinkSchemes(['https', 'http', 'mailto'])

    // Configure which hosts are allowed in links (by default all are allowed)
    ->allowLinkHosts(['symfony.com', 'example.com'])

    // Allow relative URL in links (by default they are dropped)
    ->allowRelativeLinks()

    // Configure which schemes are allowed in img/audio/video/iframe (others will be dropped)
    ->allowMediaSchemes(['https', 'http'])

    // Configure which hosts are allowed in img/audio/video/iframe (by default all are allowed)
    ->allowMediaHosts(['symfony.com', 'example.com'])

    // Allow relative URL in img/audio/video/iframe (by default they are dropped)
    ->allowRelativeMedias()

    // Configure a custom attribute sanitizer to apply custom sanitization logic
    // ($attributeSanitizer instance of AttributeSanitizerInterface)
    ->withAttributeSanitizer($attributeSanitizer)

    // Unregister a previously registered attribute sanitizer
    // ($attributeSanitizer instance of AttributeSanitizerInterface)
    ->withoutAttributeSanitizer($attributeSanitizer)
;

$sanitizer = new HtmlSanitizer($config);

// Sanitize a given string, using the configuration provided and in the
// "body" context (tags only allowed in <head> will be removed)
$sanitizer->sanitize($userInput);

// Sanitize the given string for a usage in a <head> tag
$sanitizer->sanitizeFor('head', $userInput);

// Sanitize the given string for a usage in another tag
$sanitizer->sanitizeFor('title', $userInput); // Will encode as HTML entities
$sanitizer->sanitizeFor('textarea', $userInput); // Will encode as HTML entities
$sanitizer->sanitizeFor('div', $userInput); // Will sanitize as body
$sanitizer->sanitizeFor('section', $userInput); // Will sanitize as body
// ...

Patrocinador

Este paquete está buscando un patrocinador.

¡Ayuda a Symfony patrocinando su desarrollo!

Recursos

  • Contribuir
  • Reportar problemas y enviar Pull Requests en el repositorio principal de Symfony
Descargar herramienta

Herramientas relacionadas

  • wazuh

    Plataforma XDR y SIEM de código abierto para detección de amenazas, análisis de registros, monitoreo de integridad de archivos, evaluación de vulnerabilidades y gestión de cumplimiento normativo en endpoints y cargas de trabajo en la nube.

  • suricata

    Motor de red IDS/IPS/NSM de código abierto para inspección de tráfico en tiempo real, detección y prevención de intrusiones, análisis de protocolos y búsqueda de amenazas basada en reglas.

  • zeek

    Zeek es un potente marco de análisis de redes que es muy diferente del típico IDS que puedas conocer.

Más Populares

Ver todos →

Descubre las herramientas más usadas por nuestra comunidad.

  • 1

    Callisto

    jetp1ane/callisto

    Herramienta automatizada de análisis de vulnerabilidades binarias que descompila ejecutables mediante Ghidra, escanea código pseudo-C con Semgrep y valida los hallazgos usando GPT-3.5-Turbo para reducir falsos positivos.

    2.2k
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    # Aplicación de Ejecución con un Solo Toque GhostLock (CVE-2026-43499)

    844
  • 3

    DFRoot

    a2333c/dfroot

    Herramienta de root para Android para Samsung Galaxy S25 Ultra (SM-S938B) que encadena DirtyFrag CVE-2026-43284 y CVE-2026-43499 para obtener root automáticamente al arrancar mediante KernelSU.

    447
  • 4

    ARTEX

    baarai/artex

    Plataforma de pruebas de penetración autónoma multiagente basada en LLM con agentes planificadores/trabajadores, grafos de activos y de exploración, registro de tráfico MITM y reevaluación de vulnerabilidades.

    383
  • 5

    OsintHunter

    letox4/osinthunter

    🎯 El kit de herramientas OSINT definitivo: grafo de investigación, puntuación de confianza, familias de alias, mapa, línea de tiempo e informes. 49 módulos, más de 400 sitios, sin necesidad de claves API.

    347
  • 6

    wifit3

    derv82/wifit3

    Wifite pero solo USB y multiplataforma.

    328

Explora todas las herramientas

Explora nuestra colección de herramientas

Ver todas las herramientas →