CVS edit link for anupom.gogoi
Hi,I am Anupom Gogoi from India. I am using Drupal from the last 1 and half years. I have created lots of module for different client. Now i want to contribute those module back to drupal.org.
I want to create a module innerfade_block using jquery innerfade plugin. Through this module, user can create a innerfade block where they can include as many existing block as they want. I want use same functionality like the QuickTab module.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | innerfade_blocks.zip | 17.39 KB | anupom.gogoi |
| #3 | innerfade_blocks.zip | 17.37 KB | anupom.gogoi |
| #1 | innerfade_blocks.zip | 13.23 KB | anupom.gogoi |
Comments
Comment #1
anupom.gogoi commentedHi,
Please review the module.
Thanks
Comment #2
AjK commentedThe link really should be embedded thus:-
Can you confirm that $row->title should not be run through check_plain()? In fact, there are other places where the "title" field from the database are not escaped.
The theme template doesn't provide any output filtration, as a module writer that's your responsibility and I don't see any in your module.
If the output filtration isn't an issue and your confident there's no XSS problems them some comments in the code would be a good idea so reviewers have a better understanding of your intent.
Comment #3
anupom.gogoi commented1. I am now using l() to create the link.
2. I have tested the code using special characters. So, check_plain() is not an issue.
3. I am now using drupal_substr() instead of PHP's native substr() function.
4. I have tested the code and did not found any XSS problems. Also i have added comments in all the functions.
Please review the updated code.
Thanks for the quick review.
Comment #4
AjK commentedAlas, I installed your module and then entered :-
<script>alert('XSS!')</script>
as block titles and bingo, it ran.
If you create a new block and use the above as the title you'll find it's escaped.
So I'm not convinced at all about your assurance that filtering is not needed. I would suggest spending some time reading http://drupal.org/writing-secure-code.
Comment #5
anupom.gogoi commentedHi,
I am now using filter_xss() api. Thanks for pointing me to a great api. I think this will fixed the issue now.
Thanks
Comment #6
anupom.gogoi commentedComment #7
AjK commentedAs a reviewer it always concerns me that after pointing out the documentation regarding security issues someone can digest it all in 38minutes.
For example, in http://drupal.org/node/149117#comment-1605360 you show the following example:-
With your new found knowledge could you tell me what's wrong with that advice?
Comment #8
AjK commentedComment #9
anupom.gogoi commentedFrom my point of view, there is not any wrong on the above code. We can add check_plain before $o['title']. But it is not required because it could contain unsafe values but FAPI will pass through check_plain() before displaying to user (http://drupal.org/node/28984).
I have created 2 page node using "
<script>alert('XSS!')</script>" and "This is Anupom's node" as title and put following code in a custom module:And this did not give any errors. Also I have checked the source code. There i found that FAPI automatically converts
"
<script>alert('XSS!')</script>" to"<script>alert('XSS!')</script>"and "This is anupom's content" to plain text string.
Comment #10
avpadernoEvery input coming from the user must be checked, every times it is used in HTML output, or SQL queries.
Comment #11
avpadernoComment #12
AjK commentedOK, here's my problem.
This is the biggest issue. You have failed to spot the two related security issues with:-
And for those wondering what's up, here's what it ought to look like:-
This corrects the two access by-pass violations, the first being the "status = 1", you shouldn't list unpublished nodes as that would leak the title and secondly the use of db_rewrite_sql() to ensure the selection of nodes follows Drupal's access system. Also, since "page" is a fixed string and not a variable there's little point using the %s placeholder here.
There are other API related issues also. Such as what if another module dynamically altered the node title in some way? If you select it directly from the database table {node} you've bypassed that entirely. That's why we have an API and node_load().
Additional information can be found on my blog page: http://stellartech.co.uk/node/9
For a CVS account to be approved it's pretty much mandatory to have a good understanding of writing secure code and Drupal's API. I suggest you take some time out to find out more about this and re-apply at a future date.
Comment #13
avpaderno