|
| 1 - 25 of 25 [Total 1 Pages] |
|
|
should we really disallow html Jun 8, 2009, 06:08 |
1 |
|
well we are making a kind os system where user can submit articles,photos and so on....
we normally use tiny mce as an editor in admin area.....
our principle is filter input and escape output ..we do so...htmlentities ,stripslashes....and mysql_real_escape.... we do data validation as well....type casting ...empty and length check....
now,first question, programmer really seems to fear html code,we found forum allowing only bbcodes, other scripts not allowing html .... so do we really need to disallow users from using html in form data....
2nd question) we have decided to only bbcode only for users for now,does package like tinymce allow disabling html and allowing bbcode only... any problems with this logic?
3rd question) we have seen most big sites making people type the bbcode in comments....what is it advantage...why cannot they put button to generate bbcode as in forum... has it something to take with security....?
any thoughts would be helpful thanks
|
|
|
Jun 8, 2009, 21:51 |
2 |
|
Quote: restricting the tags is not enough - you need to restrict the attributes as well e.g. onclick. once again htmlpurifier is what you need. http://htmlpurifier.org/ |
ya i have downloaded that and having look at it... are you trying to suggest,once we use html purifier ,we can take html input freely. or does it mitigate all known threats till now? (we agree there may be many more threats unless it comes to light) and we have some old scripts running in old php ie 4.3 does the package support php 4.3? i saw it site,it says php5.... any way thanks
|
|
|
Jun 9, 2009, 00:54 |
3 |
|
Quote: ya i have downloaded that and having look at it...
are you trying to suggest,once we use html purifier ,we can take html input freely. or does it mitigate all known threats till now? (we agree there may be many more threats unless it comes to light) |
from the site: "there is nothing else in the wild that offers protection from XSS, standards-compliance, and corrective processing of poorly formed HTML. But don't take my word for it: do your research and try out the demo." Quote: and we have some old scripts running in old php ie 4.3 does the package support php 4.3? i saw it site,it says php5....
any way thanks |
It requires PHP 5 only. BTW PHP 4 is no longer under development nor will any security updates be released.
|
|
|
Jun 9, 2009, 01:19 |
4 |
|
Quote: how and why ...that is what i am trying to know.
Are programmers trying to suggest that, there may be uncountable numbers of threats ,once we allow html which cannot be mitigated(or no one has been able to mitogate all ....) so best idea is to block html .
GENERALLY BBCODE IS EASIER BECAUSE IT AUTOMATICALLY DISALLOWS ANY PURE HTML VERSUS ALLOWING 'SOME' HTML ASIDE FROM SECURITY, THERE'S ALSO LESS SCOPE FOR USERS SCREWING UP LAYOUTS BY ALLOWING <p>, <div> TAGS ETC
what are we trying to say is, ok if there were n(countable) numbers of threats we could just counter those( for eg, disallow script,iframe tags ..so on) and allow html freely...but we are not... so, does it mean that ,if we allow html ,nobody knows how many problems may be there or where the crack attempt may come from...so just block it...
YOU -COULD- ALLOW SOME LIMITED HTML TAGS IF YOUR SERVER-SIDE VALIDATION ENSURES THAT ONLY THE SAFE ONES GET THROUGH E.G. <b>, <i> etc
THE PROBLEMS WOULD ARISE FROM <SCRIPT>, <IFRAME> ETC TAGS, IF YOU CAN BE SURE TO STRIP EVERYTHING THAT COULD DAMAGE THE SITE THEN HTML IS SAFE
ok though tiny mce is client side...it does have strong config option which allows control its behaviors...we were trying to know was,if there were any to control html input...
if i write the javascript function,i will be doing client side once again....so, if i HAVE to do it in server side...there are many php fuctions for it...i would prefer them...
SO DON'T DO CLIENT SIDE VALIDATION, YOU DON'T HAVE TO, AND IT'S NOT REALLY HELPFUL FOR YOUR USERS IN THIS CASE (SINCE THEY WOULDN'T BE CONSCIOUSLY INPUTTING RAW HTML ANYWAY)
SERVER SIDE VALIDATION SHOULD ALWAYS BE DONE REGARDLESS OF WHETHER CLIENT-SIDE VALIDATION IS
ok, what we were trying to ask was, if they both are equivalent ,why are many sites,scripts not choosing the better option (means having button is much easier).... does ,not using button has any significance...? or it is just their negligence.... i have seen those in big sites, even must wordpress and other script comments...
I GUESS SOME PEOPLE ASSUME THEIR USERS HAVE A RUDIMENTARY KNOWLEDGE OF BBCODE OR HTML AND SO DON'T USE THE BUTTONS, THAT'S ALL OR THE PROGRAMMERS WERE TOO LAZY TO INSERT THEM OR DIDN'T HAVE THE JAVASCRIPT KNOWLEDGE
any way thanks for thought just discussion.... |
CAPS again
|
|
|
Jun 9, 2009, 01:49 |
5 |
|
Quote: YOU -COULD- ALLOW SOME LIMITED HTML TAGS IF YOUR SERVER-SIDE VALIDATION ENSURES THAT ONLY THE SAFE ONES GET THROUGH E.G. <b>, <i> etc
THE PROBLEMS WOULD ARISE FROM <SCRIPT>, <IFRAME> ETC TAGS, IF YOU CAN BE SURE TO STRIP EVERYTHING THAT COULD DAMAGE THE SITE THEN HTML IS SAFE |
Discussion is heading towards nowhere...sorry that we were unable to make you understand....we were trying to know bigger things than these general data... Quote: SO DON'T DO CLIENT SIDE VALIDATION, YOU DON'T HAVE TO, AND IT'S NOT REALLY HELPFUL FOR YOUR USERS IN THIS CASE (SINCE THEY WOULDN'T BE CONSCIOUSLY INPUTTING RAW HTML ANYWAY)
SERVER SIDE VALIDATION SHOULD ALWAYS BE DONE REGARDLESS OF WHETHER CLIENT-SIDE VALIDATION IS |
even sorry that we could not make thing clear....it was u who was recommending client side thing to check html...and we were trying to say was if there is no config option to do it,we will do it server side... direct validation seems to be off tropic here... Quote: I GUESS SOME PEOPLE ASSUME THEIR USERS HAVE A RUDIMENTARY KNOWLEDGE OF BBCODE OR HTML AND SO DON'T USE THE BUTTONS, THAT'S ALL OR THE PROGRAMMERS WERE TOO LAZY TO INSERT THEM OR DIDN'T HAVE THE JAVASCRIPT KNOWLEDGE |
to be frank we dont think it is just case of being lazy for such a big sites and big scripts... it would be jumping towards conclusion or answering with out proper evidence... any way research is on... any way thanks for thoughts
|
|
|
Jun 9, 2009, 01:49 |
6 |
|
Quote: we have some old scripts running in old php ie 4.3 |
You have some potential security holes right there. You should consider upgrading to PHP 5 ASAP as that is the only version of PHP still supported and any security holes discovered in any PHP 4 version will never be fixed.
|
|
|
Jun 9, 2009, 01:59 |
7 |
|
Quote: You have some potential security holes right there. You should consider upgrading to PHP 5 ASAP as that is the only version of PHP still supported and any security holes discovered in any PHP 4 version will never be fixed. |
thanks for your suggestion expert. ya,we know/feel php 5 or even php 6 is way to go and we have been doing php 5 mostly mvc in our newer projects... but there are few numbers of sites that we made few years back and most of them were one time job and mostly portal and information sites.... so remaking whole site for them in new version of php is difficult...but what we are doing is manually upgrading things.... for eg using mysqli and other latest principles... more over ,we did have good look at things like sql injection,session hacks,xss when we made those.... so where can be excat problems.... for example... what can be some security holes in php 4.3 we may face... (we donot use any $_REQUEST or require register global on and so on..) so what can be problems for us... ok those sites may be upgraded gradually but doing it once will be problem for us...so any suggestions...
|
|
|
Jun 9, 2009, 02:02 |
8 |
|
Quote: so remaking whole site for them in new version of php is difficult... |
php 5 isn't so different to php 4 that it will require a complete rewrite. just try it out and you could probably fix any issues quite quickly.
|
|
|
Jun 9, 2009, 02:09 |
9 |
|
Quote: php 5 isn't so different to php 4 that it will require a complete rewrite.
just try it out and you could probably fix any issues quite quickly. |
thanks and that is excatly what we are trying to know... means even us,speaking at large,we also dont see much difference in php 4 and 5 .(unless we hadn't covered basic securities things in our php 4.3 coding),means we see in php 5 there are some more function that eases the task the way the things are coded have changed....like mvc ,cake php and many other frameworks ....which allows reusing and php 5 seems to be based on future easy expansion and "dont reinvent the wheel" concept...other than that we dont feel much difference is 4 and 5 so, what excatly are things we should do ?....when we say ..lets change thing to php4 to php5 for security..? any examples..? means ok, earlier projects seems to rely on register globals,$_REQUEST super variable...which use to cause problems..(we dont use those) so ,what can be other problems that php 4.3 was not able to address/solve and we need to change... any function,super varibales, constructs, style that had problem in itself in php 4.3? thanks
|
|
|
Jun 9, 2009, 02:26 |
10 |
|
Quote: thanks and that is excatly what we are trying to know... means even us,speaking at large,we also dont see much difference in php 4 and 5 .(unless we hadn't covered basic securities things in our php 4.3 coding),means we see in php 5 there are some more function that eases the task the way the things are coded have changed....like mvc ,cake php and many other frameworks ....which allows reusing and php 5 seems to be based on future easy expansion and "dont reinvent the wheel" concept...other than that we dont feel much difference is 4 and 5
so, what excatly are things we should do ?....when we say ..lets change thing to php4 to php5 for security..? any examples..? means ok, earlier projects seems to rely on register globals,$_REQUEST super variable...which use to cause problems..(we dont use those)
so ,what can be other problems that php 4.3 was not able to address/solve and we need to change...
any function,super varibales, constructs, style that had problem in itself in php 4.3?
thanks |
the point with security is that php5 in itself is inherently more secure than php4. vulnerabilities that arise are not necessarily a problem with php code but with php itself. php5 extended php4 - it didn't re-define it. there are better ways of doing things in php5, but legacy support is very good. upgrading should be relatively painless. php6 will be a different story with lots of things being taken out completely like register_globals/ safe_mode etc. so u may want to read up on that so that you can be best prepared going forward.
|
|
|
Jun 9, 2009, 03:07 |
11 |
|
Quote: the point with security is that php5 in itself is inherently more secure than php4. vulnerabilities that arise are not necessarily a problem with php code but with php itself. . |
for eg...? you can say it technically ,we do understand php.... giving an example of a problem is better than saying there is a problem... any way thanks
|
|
|
Jun 8, 2009, 06:32 |
12 |
|
Quote: now,first question, programmer really seems to fear html code,we found forum allowing only bbcodes, other scripts not allowing html .... so do we really need to disallow users from using html in form data....
2nd question) we have decided to only bbcode only for users for now,does package like tinymce allow disabling html and allowing bbcode only... any problems with this logic?
3rd question) we have seen most big sites making people type the bbcode in comments....what is it advantage...why cannot they put button to generate bbcode as in forum... has it something to take with security....?
any thoughts would be helpful thanks |
1) User-supplied html code can potentially be harmful if it includes things like javascripts, iframes, divs (which can wreak the layout), but if you restrict the html to things like <b>, <i>, <ul>, <li> and be sure to remove tag attributes I can't see a problem? 2) http://tinymce.moxiecode.com/examples/example_09.phpso - yes however you'd still have to strip any html tags server-side. 3) there's no difference between typing the bbcode and having a button click insert [ b ][ /b ] for example, security shouldn't be compromised if the input is filtered. really a matter of convenience
|
|
|
Jun 9, 2009, 03:58 |
13 |
|
Quote: for eg...?
you can say it technically ,we do understand php....
giving an example of a problem is better than saying there is a problem...
any way thanks |
read thru the changelog to see the issues that get fixed - including security issues: http://www.php.net/ChangeLog-5.php
|
|
|
Jun 10, 2009, 18:08 |
14 |
|
You can also check out this class from pear, it offers pretty good protection against dangerous html. It will just remove the dandgerous tags, leaving the rest of html. I use it in my project and I allow users to submit blog posts with html in them. http://pear.php.net/package/HTML_SafeI also made some changes to this class to make it work nice with php 5, but it will also work as-is, just will throw warnings under E_STRICT
|
|
|
Jun 11, 2009, 01:57 |
15 |
|
Quote: You can also check out this class from pear, it offers pretty good protection against dangerous html. It will just remove the dandgerous tags, leaving the rest of html. I use it in my project and I allow users to submit blog posts with html in them. http://pear.php.net/package/HTML_SafeI also made some changes to this class to make it work nice with php 5, but it will also work as-is, just will throw warnings under E_STRICT |
most recent release was: 2005-12-21 how is this better than htmlpurifier?
|
|
|
Jun 11, 2009, 04:09 |
16 |
|
Right, HTML_Safe has not changed singe December 2005, but there has not been any new html tags added since then and has not been any bugs filed for this package, meaning it works well.
Also, it will work with php 4 and 5
|
|
|
Jun 11, 2009, 04:14 |
17 |
|
Quote: Right, HTML_Safe has not changed singe December 2005, but there has not been any new html tags added since then and has not been any bugs filed for this package, meaning it works well.
Also, it will work with php 4 and 5 |
why is it still in beta, then? and have u heard of HTML 5? + it has warning: WARNING: the last release of this package used package.xml version 1.0, which is deprecated. stinks of abandonware to me.
|
|
|
Jun 11, 2009, 05:45 |
18 |
|
Quote: Right, HTML_Safe has not changed singe December 2005, but there has not been any new html tags added since then and has not been any bugs filed for this package, meaning it works well.
Also, it will work with php 4 and 5 |
The HTML tags might not have changed but the XSS exploits have!
|
|
|
Jun 8, 2009, 10:28 |
20 |
|
Quote: 1) User-supplied html code can potentially be harmful if it includes things like javascripts, iframes, divs (which can wreak the layout), but if you restrict the html to things like <b>, <i>, <ul>, <li> and be sure to remove tag attributes I can't see a problem? |
i clearly understand that but what we are trying to know is.....almost 95 percent people/experts/sites are seems to be saying ,there is no way to be safe with html input...none of scripts allows it(i have not seen any article system that allows html),most big cms doesnot allow html in comments....so it is giving feeling as if there are no ways to cope with html input... even this forum (vbulletin)...why bbcode ..? but not limited html...? i have seen that...one thing we didnt understood was ,by default it would allow html inputs....so some crackers will try those may be typing them...so how can i disable html(whole html) and only allow bbcode in tinymce from config(u may ask ,whats its use then....we will have full editor in admin...and bbcode only editor in public) mind u ,strip_tags is not tinymce solution ....so is it only way...? Quote: 3) there's no difference between typing the bbcode and having a button click insert [ b ][ /b ] for example, security shouldn't be compromised if the input is filtered. really a matter of convenience |
There is huge difference...all people are not computer greek like u ....we have some article readers who are using computer for first time.....(but many have used word processor like ms word...which has bold,italics button)... and saying to type <..b> and close it <../..b> and clicking button (that generate those code) are very different things.... not all knows html....
|
|
|
Jun 8, 2009, 12:46 |
21 |
|
Quote: i clearly understand that but what we are trying to know is.....almost 95 percent people/experts/sites are seems to be saying ,there is no way to be safe with html input...none of scripts allows it(i have not seen any article system that allows html),most big cms doesnot allow html in comments....so it is giving feeling as if there are no ways to cope with html input... even this forum (vbulletin)...why bbcode ..? but not limited html...?
BECAUSE IT IS GENERALLY SAFER TO DISALLOW ALL HTML AND USE BBCODE TO MARK UP CONTENT (PLUS IT'S EASIER THAN MANAGING LIMITED HTML)
i have seen that...one thing we didnt understood was ,by default it would allow html inputs....so some crackers will try those may be typing them...so how can i disable html(whole html) and only allow bbcode in tinymce from config(u may ask ,whats its use then....we will have full editor in admin...and bbcode only editor in public) mind u ,strip_tags is not tinymce solution ....so is it only way...?
TINY MCE IS CLIENT-SIDE - IT WON'T STOP PEOPLE INPUTTING HTML INTO ITS TEXTAREA IF THEY WANT TO, INPUT VALIDATION --MUST-- BE DONE SERVER-SIDE. YOU COULD WRITE A JAVASCRIPT TO SEARCH THE TEXTAREA FOR HTML TAGS BEFORE IT'S SENT TO THE SERVER BUT THIS CAN BE BYPASSED. SERVER SIDE FILTERING WITH STRIP_TAGS OR WHATEVER IS ESSENTIAL
There is huge difference...all people are not computer greek like u ....we have some article readers who are using computer for first time.....(but many have used word processor like ms word...which has bold,italics button)... and saying to type <..b> and close it <../..b> and clicking button (that generate those code) are very different things.... not all knows html....
I WASN'T ARGUING WHAT WAS EASIER FOR USERS, I WAS SAYING THAT FROM A POINT OF VIEW OF SECURITY USING A JAVASCRIPT TO INSERT CODE INTO A TEXTAREA OR ENTERING IT MANUALLY MAKES NO DIFFERENCE AS VALIDATION SHOULD BE HAPPENING SERVER-SIDE ANYWAY
FROM A POINT OF VIEW OF CONVENIENCE IT'S EASIER TO HIGHLIGHT AND CLICK, CERTAINLY
BTW TINYMCE HAS AN MS WORD INTERFACE IF YOUR USERS ARE FAMILIAR WITH THE PROGRAM |
answers IN CAPS
|
|
|
Jun 8, 2009, 14:29 |
22 |
|
HTML is perfectly safe to allow as long as you restrict it to the equivalent tags that BBcode gets converted to.
The important ones to disallow are <script> <iframe> <object> etc which allow anything to be attached into the page.
|
|
|
Jun 8, 2009, 15:25 |
23 |
|
Quote: HTML is perfectly safe to allow as long as you restrict it to the equivalent tags that BBcode gets converted to.
The important ones to disallow are <script> <iframe> <object> etc which allow anything to be attached into the page. |
restricting the tags is not enough - you need to restrict the attributes as well e.g. onclick. once again htmlpurifier is what you need. http://htmlpurifier.org/
|
|
|
Jun 8, 2009, 19:33 |
24 |
|
Quote: restricting the tags is not enough - you need to restrict the attributes as well e.g. onclick. once again htmlpurifier is what you need. http://htmlpurifier.org/ |
Well onclick is JavaScript rather than HTML and so is simply an extension to what I said about restricting scripts.
|
|
|
Jun 8, 2009, 21:42 |
25 |
|
Quote: BECAUSE IT IS GENERALLY SAFER TO DISALLOW ALL HTML AND USE BBCODE TO MARK UP CONTENT (PLUS IT'S EASIER THAN MANAGING LIMITED HTML) |
how and why ...that is what i am trying to know. Are programmers trying to suggest that, there may be uncountable numbers of threats ,once we allow html which cannot be mitigated(or no one has been able to mitogate all ....) so best idea is to block html . what are we trying to say is, ok if there were n(countable) numbers of threats we could just counter those( for eg, disallow script,iframe tags ..so on) and allow html freely...but we are not... so, does it mean that ,if we allow html ,nobody knows how many problems may be there or where the crack attempt may come from...so just block it... Quote: TINY MCE IS CLIENT-SIDE - IT WON'T STOP PEOPLE INPUTTING HTML INTO ITS TEXTAREA IF THEY WANT TO, INPUT VALIDATION --MUST-- BE DONE SERVER-SIDE. YOU COULD WRITE A JAVASCRIPT TO SEARCH THE TEXTAREA FOR HTML TAGS BEFORE IT'S SENT TO THE SERVER BUT THIS CAN BE BYPASSED. SERVER SIDE FILTERING WITH STRIP_TAGS OR WHATEVER IS ESSENTIAL |
ok though tiny mce is client side...it does have strong config option which allows control its behaviors...we were trying to know was,if there were any to control html input... if i write the javascript function,i will be doing client side once again....so, if i HAVE to do it in server side...there are many php fuctions for it...i would prefer them... Quote: I WASN'T ARGUING WHAT WAS EASIER FOR USERS, I WAS SAYING THAT FROM A POINT OF VIEW OF SECURITY USING A JAVASCRIPT TO INSERT CODE INTO A TEXTAREA OR ENTERING IT MANUALLY MAKES NO DIFFERENCE AS VALIDATION SHOULD BE HAPPENING SERVER-SIDE ANYWAY
FROM A POINT OF VIEW OF CONVENIENCE IT'S EASIER TO HIGHLIGHT AND CLICK, CERTAINLY
BTW TINYMCE HAS AN MS WORD INTERFACE IF YOUR USERS ARE FAMILIAR WITH THE PROGRAM |
ok, what we were trying to ask was, if they both are equivalent ,why are many sites,scripts not choosing the better option (means having button is much easier).... does ,not using button has any significance...? or it is just their negligence.... i have seen those in big sites, even must wordpress and other script comments... any way thanks for thought just discussion....
|
|
| 1 - 25 of 25 [Total 1 Pages] |
|
|
|