# Lucee Antisamy xml support or getsafehtml()

**URL:** <https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905>\
**Category:** support\
**Created:** [April 8, 2022, 6:49am UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905 "2022-04-08T06:49:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jake01](https://dev.lucee.org/letter_avatar_proxy/v4/letter/j/f475e1/32.png) [@Jake01](https://dev.lucee.org/u/Jake01)\
**Post date:** [April 8, 2022, 6:49am UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/1 "2022-04-08T06:49:05Z")

</div>

Hi All,

For sanitizing html what is the best way to follow in Lucee? In CF there is getSafeHTML() and I am currently using antisamy-ebay-xml file. But to use this functionality readily in Lucee without any change in Adobe CF is difficult, is there any blog I can refer to achieve this?

Thanks,  
jk

---

<div class="post-metadata">

**Author:** ![bdw429s](https://dev.lucee.org/user_avatar/dev.lucee.org/bdw429s/32/37_2.png) [@bdw429s](https://dev.lucee.org/u/bdw429s)\
**Post date:** [April 8, 2022, 1:18pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/2 "2022-04-08T13:18:36Z")

</div>

I’ve been using this module since 2014. Long before Adobe added a function for it 😁

> **[FORGEBOX: AntiSamy](https://www.forgebox.io/view/cbantisamy)**
>
> AntiSamy. OWASP AntiSamy Project that provides XSS cleanup operations to ColdBox applications

---

<div class="post-metadata">

**Author:** ![carehart](https://dev.lucee.org/user_avatar/dev.lucee.org/carehart/32/1996_2.png) [@carehart](https://dev.lucee.org/u/carehart)\
**Post date:** [April 8, 2022, 2:32pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/3 "2022-04-08T14:32:52Z")

</div>

“Long before”? It seems worth noting that the getsafehtml function came out with cf11, which was released that same year, 2014. (Indeed, cf11 came out in March, while that cbantisamy module shows having come out in November.)

But perhaps you mean you were using the module before it was released, and if so, fair enough. I just thought it might help some to know the antisamy capabilities were added to ACF in cf11, rather than only recently.

---

<div class="post-metadata">

**Author:** ![bdw429s](https://dev.lucee.org/user_avatar/dev.lucee.org/bdw429s/32/37_2.png) [@bdw429s](https://dev.lucee.org/u/bdw429s)\
**Post date:** [April 8, 2022, 2:50pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/4 "2022-04-08T14:50:16Z")

</div>

Before it was a module, it was a plugin in ColdBox. Don’t let the date on the ForgeBox package make you think it didn’t exist before then 🙂 I don’t know the exact date we released the plugin, but there’s links to it on StackOverflow as early as 2010 and according to [web.archive.org](http://web.archive.org), the docs were created for it in April of that year.

---

<div class="post-metadata">

**Author:** ![carehart](https://dev.lucee.org/user_avatar/dev.lucee.org/carehart/32/1996_2.png) [@carehart](https://dev.lucee.org/u/carehart)\
**Post date:** [April 8, 2022, 3:48pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/5 "2022-04-08T15:48:05Z")

</div>

Ok, and that’s why I added that, “_perhaps you mean you were using the module before it was released, and if so, fair enough_.” 🙂

It’s also why I ended saying my goal was as much to convey that such antisamy integration being built into ACF was not something new–in case that might weigh into any consideration for it to perhaps be added it to Lucee.

But I appreciate also that the existence of the Fb module may be sufficient reason for the ptb to opt NOT to add that as built-in functionality, even for the sake of compatibility. Always a line to be walked in such choices.

---

<div class="post-metadata">

**Author:** ![bdw429s](https://dev.lucee.org/user_avatar/dev.lucee.org/bdw429s/32/37_2.png) [@bdw429s](https://dev.lucee.org/u/bdw429s)\
**Post date:** [April 8, 2022, 4:05pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/6 "2022-04-08T16:05:54Z")

</div>

Right, the long-time existence of the functionality built into Adobe 8 years ago is certainly an indictment of Lucee for never implementing it ([Here’s the ticket](https://luceeserver.atlassian.net/browse/LDEV-838) for voting). But the even longer-time functionality available as drop-in modules available to the community for the last 12 years makes me scratch my head when it’s reported as “difficult”.

For a ColdBox MVC user, you just type

```auto
CommandBox> install cbantisamy

```

and then go refill your coffee. For non-ColdBox users (who made the decision they didn’t need the comforts of a framework), the module is very simple and the code on Github can be easily adapted to work standalone.

@Jake01 That code lives here [GitHub - coldbox-modules/cbantisamy: Leverages the AntiSamy libraries for providing XSS cleanups](https://github.com/coldbox-modules/cbantisamy) and I can help answer any questions you may have if you need to get it running outside of ColdBox.

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [April 8, 2022, 4:07pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/7 "2022-04-08T16:07:02Z")

</div>

the latest ESAPI ext has a new function SanitizeHTML()

> <https://github.com/lucee/extension-esapi/commit/3019d0d3d573ed3d327a5a7cea2533ca4b6f9052>

---

<div class="post-metadata">

**Author:** ![bdw429s](https://dev.lucee.org/user_avatar/dev.lucee.org/bdw429s/32/37_2.png) [@bdw429s](https://dev.lucee.org/u/bdw429s)\
**Post date:** [April 8, 2022, 4:25pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/8 "2022-04-08T16:25:08Z")

</div>

That’s great news. Is there a reason Lucee didn’t follow Adobe’s BIF name, or does `SanitizeHTML()` have a different incompatible API?

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [April 8, 2022, 4:45pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/9 "2022-04-08T16:45:03Z")

</div>

i asked the same question, it uses a different lib, hence the different name

---

<div class="post-metadata">

**Author:** ![carehart](https://dev.lucee.org/user_avatar/dev.lucee.org/carehart/32/1996_2.png) [@carehart](https://dev.lucee.org/u/carehart)\
**Post date:** [April 8, 2022, 4:47pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/10 "2022-04-08T16:47:33Z")

</div>

Of course, only Jake can clarify what was found to be difficult. Perhaps he didn’t know of that Fb module, or perhaps he did. Perhaps he even saw the SanitizeHTML that Zack later mentions. Even if it’s as simple as changing getsafehtml to that or the methods in the Fb module, perhaps the difficulty is if Jake uses the code often.

I only weighed in to share the clarification about it not really being “new” functionality to ACF. I’ll leave the conclusion of the story here to Jake and the rest of you folks. 🙂

---

<div class="post-metadata">

**Author:** ![Terry\_Whitney](https://dev.lucee.org/user_avatar/dev.lucee.org/terry_whitney/32/3322_2.png) [@Terry\_Whitney](https://dev.lucee.org/u/Terry_Whitney)\
**Post date:** [April 8, 2022, 5:01pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/11 "2022-04-08T17:01:13Z")

</div>

The real joke…

> OMG This code, its 10 years old and in production…
> 
> Yup.
> 
> OMG it still works
> 
> Yup.

> Java Developer, Didnt you refactor this? It cant be  
> PHP Developer, WTF!!  
> Python Developer, Um… Never?

Later on in a meeting…

Python Developer, Java Developer & PHP Developer, all screaming to replace the old “Working” code with 99.99999999904 percent uptime

Python Developer - This code is too simple  
Java Developer - This code is too old, it needs new features  
PHP Developer - This is written for children, what moron wrote this code?

CIO - That moron would be me. I expect your applications will start performing to the same standard.

---

<div class="post-metadata">

**Author:** ![Zackster](https://dev.lucee.org/user_avatar/dev.lucee.org/zackster/32/3484_2.png) [@Zackster](https://dev.lucee.org/u/Zackster)\
**Post date:** [April 13, 2022, 9:49pm UTC](https://dev.lucee.org/t/lucee-antisamy-xml-support-or-getsafehtml/9905/12 "2022-04-13T21:49:25Z")

</div>

here’s the ticket for that new feature

[https://luceeserver.atlassian.net/browse/LDEV-3953](https://luceeserver.atlassian.net/browse/LDEV-3953)
