MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Jul 04, 2009, 12:39 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search via SMF
or Google:
modx forums
all of modxcms.com
web
MODxCMS.com
Forums
Help
Login
Register
News
:Read
Frequently Asked Questions (FAQ)
MODx Community Forums
»
Add-ons, Extensions & Elements
»
Creating & Repurposing Content
»
Jot
(Moderator:
bS
)
»
Sanitising HTML
Pages: [
1
]
2
Go Down
« Previous topic
Next topic »
Print
Author
Topic: Sanitising HTML (Read 2711 times)
0 Members and 1 Guest are viewing this topic.
tuatara
Support Subscriber
Posts: 76
Sanitising HTML
«
on:
May 14, 2008, 11:22 PM »
I'm intending to allow HTML in my comments, but I'm wary of introducing XSS vulnerabilities. I was planning to use the
HTML Purifier
library to sanitise the HTML, but I can't see a MODx event that fires when a new comment is posted. Is there any event that will include posting comments? How difficult would it be to add an event into the Jot code?
Thanks for any help ...
Cheers
Matt
Logged
Uncle68
Moderators
Posts: 299
Re: Sanitising HTML
«
Reply #1 on:
May 15, 2008, 04:54 AM »
Sorry, I don't have the answer to you question, but I just wanted to thank you for the tip! Html Purifier solves problems I was struggling with yesterday.
If we have "recommended tools" section on the forum we should put it there.
Logged
Dr. Scotty Delicious
Coding Team
Posts: 1,183
D.F.P.A.
Re: Sanitising HTML
«
Reply #2 on:
Jun 12, 2008, 06:06 AM »
I have a modified version of Jot 1.1.3 which uses HTML purifier.
I wrote an extension class for the purifier that also changes <b> tags to <strong>, <i> tags to <em>, and <s>&<strike> tags to <del>.
I set a require for the extension class in jot.class.inc.php and then call the public static function Purify::Clean($_POST['content']);
It uses HTML Purifier 3.1.0, so of course it is PHP 5 only.
I would be happy to share my modifications with you if you are interested.
See it in action at my site:
http://scottydelicious.com/
-sD-
Dr. Scotty Delicious, DFPA.
Logged
My Blog:
http://scottydelicious.com
tuatara
Support Subscriber
Posts: 76
Re: Sanitising HTML
«
Reply #3 on:
Jun 16, 2008, 03:48 AM »
Quote from: Dr. Scotty Delicious on Jun 12, 2008, 06:06 AM
I would be happy to share my modifications with you if you are interested.
Yes please!
Cheers
Matt
Logged
Dr. Scotty Delicious
Coding Team
Posts: 1,183
D.F.P.A.
Re: Sanitising HTML
«
Reply #4 on:
Jun 16, 2008, 04:36 AM »
First... Safety!
Make a backup of the folder "/assets/snippets/jot/".
Also, remember that this modification will only work on a server running PHP 5.
PHP 4 will throw fatal errors.
Download
my Jot 1.1.3 modifications
.
This archive unzips to a folder with the file "jot.class.inc.php". Upload this file to "/assets/snippets/jot/" and overwrite or replace the existing file.
There is also a folder in the archive called "includes". Upload the contents of this folder to "/assets/snippets/jot/includes/".
This is the class I wrote to purify the post as well as the HTML Purifier 3.1.0 library.
I have modified jot.class.inc.php to include my class and use it as a filter. Additionally, I have modified the jot class to send notifications as HTML instead of as plain text. This gives you a greater deal of flexibility in your notification templates.
-sD-
Dr. Scotty Delicious, DFPA.
Logged
My Blog:
http://scottydelicious.com
davidm
MODx evangelist
Marketing & Design Team
Posts: 7,026
Software is like sex, it's better when it's free !
Re: Sanitising HTML
«
Reply #5 on:
Jun 16, 2008, 08:46 AM »
There is a HTML purifier plugin for MODx, and it has been developped by the author of HTML purifier :
http://htmlpurifier.org/svnroot/htmlpurifier/trunk/plugins/modx.txt
You can also look at this thread :
http://modxcms.com/forums/index.php/topic,6604.0.html
And more recently :
http://htmlpurifier.org/phorum/read.php?3,1866
Logged
.:
nodeo.net
: Pour un web libre, moderne et ouvert ! ::
david-molliere.net
:
Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web
:.
***
Forums modxcms.fr
Participez ŕ l'élaboration du site MODx francophone !
***
! Nouveau !
En live, ne manquez pas les news de modxcms.fr sur Twitter
! Nouveau !
MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accčs pour les utilisateurs finaux.
Config :
Apache 2.2.8 - MySQL 5.0.67 - PHP 5.2.8 | Debian 4.0 (Etch)
Réalisations sous MODx :
|
pargade-notaires.fr
|
soleil.info
|
gican.asso.fr
|
michelez-notaires.com
|
amadom.gerondicap.com
|
jocelyne-violet.net
tuatara
Support Subscriber
Posts: 76
Re: Sanitising HTML
«
Reply #6 on:
Jun 16, 2008, 04:14 PM »
Quote from: davidm on Jun 16, 2008, 08:46 AM
There is a HTML purifier plugin for MODx, and it has been developped by the author of HTML purifier :
Yeah, I tried that. But the plugin works on content edited in the manager, and I'm not at all concerned about what is done in the manager. It's specifically comments that concern me, and the plugin won't do anything to those. (Will it? ... unless I'm missing something?)
Cheers
Matt
Logged
tuatara
Support Subscriber
Posts: 76
Re: Sanitising HTML
«
Reply #7 on:
Jun 16, 2008, 04:16 PM »
Quote from: Dr. Scotty Delicious on Jun 16, 2008, 04:36 AM
I have modified jot.class.inc.php to include my class and use it as a filter. Additionally, I have modified the jot class to send notifications as HTML instead of as plain text. This gives you a greater deal of flexibility in your notification templates.
Thanks Scotty ;-). I have some modifications of my own to Jot so I'll need to merge the two; it'll take me a week or so (I'm taking a break) but I shall report back!
Cheers
Matt
Logged
Dr. Scotty Delicious
Coding Team
Posts: 1,183
D.F.P.A.
Re: Sanitising HTML
«
Reply #8 on:
Jun 16, 2008, 05:44 PM »
Quote from: davidm on Jun 16, 2008, 08:46 AM
There is a HTML purifier plugin for MODx, and it has been developped by the author of HTML purifier [...]
That's true, but it only fires on OnBeforeDocFormSave.
The trouble is, the appropriate events for purifying HTML only seem to be fired in the Manager
I guess what I should try is invoking OnBeforeDocFormSave from Jot.
Quote from: tuatara on Jun 16, 2008, 04:16 PM
Thanks Scotty ;-). I have some modifications of my own to Jot so I'll need to merge the two; it'll take me a week or so (I'm taking a break) but I shall report back!
Cheers
Matt
No problem Matt. I put this together when I was redesigning my site. I thought I was going to provide a WYSIWYG RTE for comments, but I find that HTML Purifiers AutoFormat.AutoParagraph and AutoFormat.Linkify work great, so at this point I am on the fence about adding an RTE.
-sD-
Dr. Scotty Delicious, DFPA.
Logged
My Blog:
http://scottydelicious.com
Ambush Commander
Jr. Member
Posts: 20
Re: Sanitising HTML
«
Reply #9 on:
Jun 16, 2008, 08:35 PM »
Hello Dr. Scotty Delicious,
It's great to see that someone else has stepped up to the plate to have an updated plugin of HTML Purifier for Modx. There is a plugin, but it's somewhat untested as I don't use Modx, and it has problems with HTML Purifier 3.1 (I've got an updated version pending for that).
Would you like me to link to your plugin for Jot on the HTML Purifier home page?
Cheers,
Edward
Logged
Dr. Scotty Delicious
Coding Team
Posts: 1,183
D.F.P.A.
Re: Sanitising HTML
«
Reply #10 on:
Jun 16, 2008, 10:45 PM »
Quote from: Ambush Commander on Jun 16, 2008, 08:35 PM
Hello Dr. Scotty Delicious,
It's great to see that someone else has stepped up to the plate to have an updated plugin of HTML Purifier for Modx. There is a plugin, but it's somewhat untested as I don't use Modx, and it has problems with HTML Purifier 3.1 (I've got an updated version pending for that).
Would you like me to link to your plugin for Jot on the HTML Purifier home page?
Cheers,
Edward
Sure, but it would be good to specifically note that it is not a system wide plugin, but merely a modification of the Jot snippet with a class for purifying the HTML that is passed in by Jot's $comment['content'] variable.
I think what I may do is make another modification of the jot.class.inc.php file to invoke the OnBeforeDocFormSave system event so that a plugin like yours will work with comments. I might also try to put together a plugin that can purify any form submitted on the front end. That might be better for the Jot upgrade path and also a bit more universal so it can be used with the eForm snippet (or any form in the front end).
-sD-
Dr. Scotty Delicious, DFPA.
Logged
My Blog:
http://scottydelicious.com
rthrash
Foundation
Posts: 10,471
Re: Sanitising HTML
«
Reply #11 on:
Jun 17, 2008, 07:27 AM »
Feel free to modify Jot to your heart's content. Armand is letting the community take over the 096x release and making it more functional for the tens of thousands of sites that will still be running that version will be greatly appreciated. You might want to head on over to the JIRA install and start committing to the project itself, too, once you get it sorted to your liking.
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (Revolution Wiki)
|
Fisheye SVN Browser
Dr. Scotty Delicious
Coding Team
Posts: 1,183
D.F.P.A.
Re: Sanitising HTML
«
Reply #12 on:
Jun 17, 2008, 06:42 PM »
Quote from: rthrash on Jun 17, 2008, 07:27 AM
Feel free to modify Jot to your heart's content. Armand is letting the community take over the 096x release and making it more functional for the tens of thousands of sites that will still be running that version will be greatly appreciated. You might want to head on over to the JIRA install and start committing to the project itself, too, once you get it sorted to your liking.
Yeah, no problem.
Well... small problem. I got my Crucible and Fisheye username and password a long time ago. I don't have a clue what it is. can it be reset?
-sD-
Dr. Scotty Delicious, DFPA.
Logged
My Blog:
http://scottydelicious.com
rthrash
Foundation
Posts: 10,471
Re: Sanitising HTML
«
Reply #13 on:
Jun 17, 2008, 07:58 PM »
Yes indeed:
http://svn.modxcms.com/jira/secure/ForgotPassword
!default.jspa but you'll have to recall your username.
Logged
MODx
is a framework that allows web professionals to turn over sites to end-users for daily maintenance without worrying. Community participation and questions are encouraged, especially when you
help us help you
,
read the wiki
, and review snippet parameters even if you have to look at the source. Searching the forums helps, too.
Ryan Thrash
MODx Co-Founder
Principal @
Collabpad
work
productively.
work
intelligently.
work
together.
MODx
Current
|
Dev
|
SVN Root
|
JIRA (Bugs)
|
Confluence (Revolution Wiki)
|
Fisheye SVN Browser
Dr. Scotty Delicious
Coding Team
Posts: 1,183
D.F.P.A.
Re: Sanitising HTML
«
Reply #14 on:
Jun 18, 2008, 05:52 AM »
I posted a full featured plugin here:
http://modxcms.com/HTML-Purifier-for-Forms-Plugin-2096.html
No Jot hackery needed.
-sD-
Dr. Scotty Delicious, DFPA.
Logged
My Blog:
http://scottydelicious.com
Pages: [
1
]
2
Go Up
Print
« Previous topic
Next topic »
Jump to:
Please select a destination:
-----------------------------
Announcements
-----------------------------
=> Important News
=> Security Notices
-----------------------------
Commercial Support
-----------------------------
=> [CS] About Commercial Support
-----------------------------
Development & Coding
-----------------------------
=> Commercial Inquiries & Bounties
=> Core Code
===> MODx Next
===> xPDO
=> Module, Plugin & Snippet Creation and Modification
=> In Development
=> Templates
-----------------------------
Add-ons, Extensions & Elements
-----------------------------
=> Module, Plugin & Snippet Usage
=> General Repository Items Support
=> Navigation & Tagging/Taxonomy
===> Wayfinder & DropMenu
=> Creating & Repurposing Content
===> Ditto
===> Jot
===> Front-end Document Management
=> Users, Authentication & Personalization
===> WebloginPE
===> WebLogin, WebSignup and WebChangePwd
=> Rich Text Editors & File Browser
===> TinyMCE
===> FCKeditor
===> MCPuck File Browser
=> Forms, Form Processing & Anti-Spam
===> eForm
=> Search
===> AjaxSearch
=> E-business
=> Polls, Calendars, Address Book and Community
=> Third-party integrations
=> Images, Videos & Podcasts
===> MaxiGallery
=> Manager, Parser & the Core
===> Backup & Versioning
===> Doc Finder
===> ManagerManager
===> PHx
=> Templates
-----------------------------
Support
-----------------------------
=> Release Support
===> 0.9.6.3
===> 0.9.6.2
===> 0.9.6.1
===> 0.9.6
===> 0.9.5 and earlier
=> General Support
===> MODx 101
===> E-Commerce, E-Marketing, Analytics & SEO
===> Hosting Experiences
===> IIS / Windows Hosting Issues
=> Documentation, Tips & Tricks
===> Documentation Suggestions & Corrections
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Webworker Lounge
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
International Support & Translations
-----------------------------
=> Internationalization
=> Bulgarian
===> Поддръжка
=====> Често задавани въпроси
=====> Инсталация
=====> Модули, Плъгини, Снипети и код
=====> Дизайн и Шаблони
===> Документация, Ръководства и Превод
=====> Документация
=====> Ръководства
=====> Превод
===> Общество
=====> Съобщения
=====> Представете се
=====> Представете сайта си
=====> Дискусии извън MODx
=> Chinese
=> Czech
===> Oznámení
=====> Důleitá oznámení/novinky
=====> Bezpečnost
===> Komunita
=====> Oznámení
=====> Představte se, prosím
=====> Ukázky práce
=====> Různé aneb cokoli co se jinam nehodí
===> Podpora
=====> FAQ (často kladené otázky)
=====> Instalace
=====> Moduly, pluginy, "snippets & code" (ablony zdrojových kódů)
=====> Design & ablony
===> Dokumentace, tutoriály (návody) a překlady
=====> Dokumentace
=====> Tutoriály (návody)
=====> Překlady (lokalizace)
=> Dutch
===> Ondersteuning
=====> Veel gestelde vragen
=====> Modules, Plugins, Snippets & Code
=====> Design & Templates
===> Documentatie, Tutorials en Vertalingen
=====> Documentatie
=====> Tutorials
=====> Vertalingen
===> Community
=====> Aankondigingen
=====> Stel jezelf voor
=====> Site Showcase
=====> De stamkroeg
=> Filipino
===> Suporta
=====> Kadalasang tanong
=====> Instalasyon
=====> Moduler, Maidadagdag, Karagdagang mga Code
=====> Desenyo at Templates
===> Dokumentasyon, Mga Turo, Mga Salin
=====> Dokumentasyon
=====> Mga Turo
=====> Mga Salin
===> Kumunidad
=====> Anunsyo
=====> Ipakilala ang sarili
=====> Ang Galing ng pinoy
=====> Tsismisan atbp
=> Finnish
===> Tuki
=====> UKK
=====> Asennus
=====> Moduulit, liitännäiset, koodinpätkät
=====> Ulkoasu/Sivustopohjat
===> Dokumentaatio, oppaat ja käännökset
=====> Dokumentaatio
=====> Käännökset
=====> Oppaat
===> Yhteisö
=====> Tiedotteet
=====> Esittele itsesi
=====> MODx sivustosi
=====> Kahvihuone
=> French
===> Support
=====> FAQ
=====> Installation
=====> Module, plugin, snippets
=====> Design/Templates
===> Documentation, Tutoriels et Traductions
=====> Documentation
=====> Traduction
=====> Tutoriels
===> Communauté
=====> Annonces
=====> Présentez vous
=====> Vos sites
=====> Le Bistrot Français
=> German
===> Support (de)
=====> FAQ (de)
=====> Installation (de)
=====> Module, Plugins, Snippets & Code (de)
=====> Design & Templates (de)
===> Dokumentation, Tutorials und Übersetzung
=====> Dokumentation
=====> Tutorials (de)
=====> Übersetzung
===> Community (de)
=====> Ankündigungen
=====> Stellt Euch vor
=====> Beispielseiten
=====> Off Topic / Verschiedenes
=> Hebrew
===> הכרזה
=====> חדשות חשובות
=====> אבטחה
===> תמיכה
=====> התקנה
=====> תיעוד, מדריכים ותרגומים
=====> עיצוב ותבניות
=====> שאלות נפוצות
===> תיעוד, מדריכים ותרגומים
=====> תיעוד
=====> מדריכים
=====> תרגומים
===> קהילה
=====> הודעות
=====> הצג את עצמך
=====> אתרים לדוגמא
=====> כללי
=> Irish
=> Italian
===> Supporto
=====> FAQ
=====> Installazione
=====> Moduli, Plugin, Snippet e altro codice
=====> Web Design e Template
===> Documentazione, Tutorial e Traduzione
=====> Documentazione
=====> Tutorial
=====> Traduzione
===> Comunitŕ
=====> Annunci
=====> Presentazioni
=====> Siti in vetrina
=====> Chiacchiere in libertŕ
=> Japanese
===> サポート
=====> 良くある質問
=====> インストール
=====> モジュール・プラグイン・スニペット・本体
=====> デザインやテンプレート
===> マニュアル・テュートリアル・翻訳
=====> マニュアル
=====> 事例集、テュートリアル
=====> 日本語化
===> コミュニティ
=====> お知らせ
=====> MODxサイト展示場
=====> 自己紹介
=====> 雑談
=====> 国産リソース
=> Persian - فارسي
===> پشتيباني
=====> راهنما
=====> نصب
=====> ماژول , پلاگین ها , کد ها و جزییات
=====> طراحی و قالب ها
===> مستند سازی , آموزش ها و ترجمه ها
=====> مستند سازی
=====> آموزش ها
=====> ترجمه ها
===> انجمن ها
=====> اخبار
=====> معرفی کردن خود
=====> نمایش دادن سایت ها
=====> بحث های عمومی و سایر موضوعات
=> Polish
===> Wsparcie
=====> FAQ
=====> Instalacja
=====> Moduły, pluginy, snipety i kod
=====> Wygląd i szablony
===> Dokumentacja, tutoriale i tłumaczenie
=====> Dokumentacja
=====> Tutoriale
=====> Tłumaczenie
===> Społeczność
=====> Ogłoszenia
=====> Przedstaw się
=====> Twój serwis WWW
=====> Hyde Park
=> Portuguese
===> Suporte
=====> FAQ - Dúvidas Frequentes
=====> Instalaçăo
=====> Módulos, Plugins, Snippets e Código
=====> Design e Templates
===> Documentaçăo, Guias e Traduçőes
=====> Documentaçăo
=====> Guias
=====> Traduçőes
===> Comunidade
=====> Anúncios
=====> Apresente-se!
=====> Bar da esquina (fora de tópico)
=====> Portfólio de Sites
=> Russian
===> Поддержка
=====> ЧАВО (FAQ)
=====> Установка
=====> Модули, плагины, сниппеты и код
=====> Дизайны и шаблоны
===> Документация, Уроки, Перевод
=====> Документация
=====> Уроки
=====> Перевод
===> Сообщество
=====> Объявления
=====> Представьтесь публике
=====> Галерея сайтов
=====> Диван
=> Scandanavian
===> Support
=====> Frĺgor och svar
=====> Installation
=====> Moduler, plugins, snippets och kod
=====> Design & sidmallar
===> Dokumentation, guider och översättningar
=====> Dokumentation
=====> Guider
=====> Översättningar
===> Webbgemenskap
=====> Meddelanden
=====> Presentera dig själv
=====> Visa upp dina webbsidor
=====> Ordet fritt
=> Slovak
=> Spanish
===> Soporte
=====> FAQ
=====> Instalación
=====> Modulos, Plugins, Snippets & Código
=====> Diseńo y plantillas
===> Documentación, Tutoriales y Traducciones
=====> Documentatción
=====> Tutoriales
=====> Traducciones
===> Comunidad
=====> Anuncios
=====> Presentaciones personales
=====> Muestra de sitios
=====> El Café
=> Swedish
=> TÜRKÇE (Turkish)
===> Destek
=====> SSS
=====> Kurulum
=====> Modüller, Pluginler, Snippetlar & Kodlar
=====> Dizayn & Temalar
===> Belgeleme, Eğitmenler ve Çeviri
=====> Belgeleme
=====> Eğitmenler
=====> Çeviri
===> Topluluk
=====> Duyurular
=====> Kendinizi Tanıtın
=====> Site Vitrini
=====> Konu Dışı