ezyang / ezyang/htmlpurifier

Lost case of text when using Core.EscapeInvalidTags

Open
#314 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
361
Avg merge
3d 41m
Merged PRs (30d)
2

Description

Hello!

Let's check following code:

$allowedTagsList = [
            'a',
            'p',
            'div',
        ];

$config = HTMLPurifier_Config::createDefault();
$config->set('Core.EscapeInvalidTags', true);
$config->set('HTML.AllowedElements', $allowedTagsList);
$purifier = new HTMLPurifier($config);
$htmlBody = $purifier->purify($htmlBody);

$htmlBody before purifying
<p>Hello! I want attach following xml:</p><p><someGreatTag>someGreatValue</someGreatTag></p>

Expected after purifying
<p>Hello! I want attach following xml:</p><p>&lt;someGreatTag&gt;someGreatValue&lt;/someGreatTag&gt;</p>

But in reality
<p>Hello! I want attach following xml:</p><p>&lt;somegreattag&gt;someGreatValue&lt;/somegreattag&gt;</p>

So, any denied tag lose capitalization (someGreatTag -> somegreattag)

php 7.4.27
htmlpurifier 4.14.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior with the provided PHP snippet using Core.EscapeInvalidTags and HTML.AllowedElements, then trace how the denied tag is handled during purify(). Done means escaped denied tags retain the original capitalization, such as someGreatTag, while the surrounding allowed HTML remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.