Learn

Secure Rendering Defaults

Keep untrusted rendering safe by default and relax only the minimum behavior required for the use case.

Pattern

The secure rendering default stack

Secure defaults work because they layer small, predictable protections instead of relying on one big switch.

1Escape text

Treat text as text so markup is not executed accidentally.

2Strip unsafe tags and handlers

Remove markup behaviors that do not belong in trusted rendered output.

3Allow only needed URI schemes

Keep the protocol surface narrow by default.

4Enable external assets deliberately

Only relax the boundary when the workflow explicitly requires it.

5Surface warnings

Tell the operator what changed so security behavior remains visible.

The safest behavior should also be the easiest behavior to keep.

The safest Cuddler pattern is the simplest one: treat untrusted content as untrusted all the way through rendering.

Pattern

  1. Escape text content.
  2. Strip unsafe tags and event handlers.
  3. Allow only the URI schemes the use case genuinely needs.
  4. Permit external assets only when the workflow explicitly requires them.
  5. Surface warnings so the user understands what changed.

Why It Matters

  • It protects the rendering surface from accidental script execution and unsafe links.
  • It makes the trust boundary obvious to authors and reviewers.
  • It keeps the default behavior useful without silently widening risk.

Use This When

  • documents are authored from mixed-trust sources
  • the output is shared beyond the immediate authoring team
  • you want a conservative baseline that does not require extra explanation