Cackle - is a global comment system with the ability to login via popular social networks such as Google+, Facebook, Twitter, LinkedIn, Vkontakte, Odnoklassniki, Mail.ru and many others
This module allows users to use social networks accounts to leave comments.
Cackle module for Drupal
- Adds Cackle comments widget to Drupal's articals or pages.
- Comments indexable by search engines (SEO-friendly)
- Auto-sync (backup) of comments with Cackle and Drupal local database
- Custom html for SEO
- Cackle comments counter for each post
Project page: http://drupal.org/sandbox/cackle/1822808
Git repo: git clone http://git.drupal.org/sandbox/cackle/1822808.git cackle
Drupal version: 7.x
Module version: 7.x-1.x
Reviews of other projects 1:
http://drupal.org/node/1459628#comment-6875122
http://drupal.org/node/1873474#comment-6875134
http://drupal.org/node/1872202#comment-6875080
Reviews of other projects 2:
http://drupal.org/node/1893544#comment-7004352
http://drupal.org/node/1903922#comment-7007170
http://drupal.org/node/1906452#comment-7019470
Reviews of other projects 3:
http://drupal.org/node/1927760#comment-7113142
http://drupal.org/node/1927104#comment-7112968
http://drupal.org/node/1927714#comment-7112758
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | Cackle_XSS.png | 131.49 KB | udaksh |
Comments
Comment #1
cainrus commentedI'm not able to clone your project with these command, maybe you must remove "crackle"(username) from that command.
I just checked your project with PAReview service. Seems like there is no issues. I will try to check it manually.
Comment #2
cackle commentedThank you for your response. I fixed Git repo link.
Comment #3
hernani commentedHey,
I found no problems on automatic review using ventral.
On my manual review:
function cackle_closewindow in cackle.admin.inc does not seem to be ever called.
In cackle.module:42 instead of reading arg(1) and do a node_load, you can access the loaded node using menu_get_object()
Function cackle_output_footer_comment_js is weird, I would recommend to just output a nomal PHP string, instead of doing what you are currently doing.
Function cackle_node_view you probably just need to add the js if you are showing the node in the teaser probably.
Function cackle_admin_settings() the description of the form fields are wrong and repeated.
In cackle.php:
Line 21 is never used:
21 $sql = "select common_value from common where `common_name` = 'last_time'";
In this file there are several functions that don't use correctly the DB Api, no correct definition of tables, and not using drupal_write_record to write in the comments table.
Comment #4
cackle commentedHernani,
thank you for review.
I have fixed major issues that you found:
deleted that
fixed it
deleted
Thank for this important note. Now I use placeholders and brackets for sql tables, like
but I don't use drupal_write_record (). Instead of it I use db_insert(), that seems correctly.
Comment #5
klausiWe are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)
Comment #6
DanZ commentedI recommend you include installation/configuration instructions in the module itself, not just in the project page.
The project page has a typo: "Cofiguration".
Don't use db_query('ALTER TABLE .... Use db_add_field(), instead.
Don't use db_query('SELECT'... Use db_select() instead. See the tutorial on Dynamic queries.
Any time you add something to an existing setup, I'd recommend pre-pending its name with 'cackle_' to avoid conflicts and make it clear what it's for. So, in this case, call the new field 'cackle_user_agent'.
cackleComment() uses a lot of raw HTML and PHP tags to do its thing. It looks like it's for direct output generation. Use Drupal's theme mechanism, instead.
Many of your functions have no comments describing their parameters, for example dbConnect($sql, $insert=FALSE, $table='comment', $array=array()). See http://drupal.org/coding-standards/docs.
Add your class definition/interface files using a 'files[]' line in your .info file. See http://drupal.org/node/542202.
The '#title' field of a form element shows up on the form. So, for your admin form, I'd recommend something more descriptive than 'mc_site', 'site_api_key', and 'account_api_key'. Use normal English. Also, the description for all three is 'The maximum number of links to display in the block,' which appears to be incorrect.
It's good to have the configuration directions in the help. I'd recommend turning 'cackle.me' into a live link.
You should use a more specific administration permission than 'access administration pages'. 'Administer comments and comment settings' is one obvious choice, or add your own permission.
Comment #6.0
DanZ commentedchanged git link
Comment #7
cackle commentedDanZ,
thank you for your review.
I made small refactoring.
I deleted this function, and now using drupal's db_query and db_insert functions.
Fixed it.
Done.
Comment #8
udaksh commentedHi Cackle,
Manual Review :
Try to use template.php for the working inside the function cackleComment() line 183 cackle.php. Also try not to include javascript code inside your php code, instead make a seperate .js file and add that javascript using drupal_add_js().
Your module also seems to be cross site scripting vulnerable. Your module will output the results from database query without sanitization. Results from db_query at line 233 cackle.php are displayed inside the cackleComment() line 183 cackle.php. You should use check_plain($comment->homepage), check_plain($comment->name) line 187 cackle.php and all other similar places.
Thanks
Udaksh
Comment #9
mayank-kamothi commentedHi,cackle
Manual Review:
cackle.module
document.getElementsByTagName('body')[0]).appendChild(mc);
cackle.php
Thanks,
Mayank
Comment #10
cackle commentedHello,
I think you are wrong.
at line 233
I used here static queries, that avoiding SQL injection. See http://drupal.org/node/310072 .
Mayank, thank you. I fixed spaces.
Comment #11
cackle commentedComment #12
udaksh commentedHey cackle,
I was saying about the Cross Site Scripting Vulnerability not SQL Injection. You are correct your module is secure from SQL Injection but it is vulnerable to Cross Site Scripting. For more info on XSS go to https://www.owasp.org/index.php/Cross-site_Scripting_(XSS).
Consider function cackle_block_view() at line 37 in file cackle.module. At line 50 it is calling another function cacke_in(), In this function you are making an object class cackle and calling a member function cackleDisplayComments(). Inside function cackleDisplayComments() at line 211 you are calling another member function listComments(). In this function you are calling getLocalComments() and get the results from database and then you are displaying these results inside function cackleComment(). So the value from the database does not sanitized and if this value contains some XSS like <script>alert("XSS")</script> then it will result into Cross Site Scripting.
I have created a new entry in comment table with name as <script>alert("XSS")</script>. When i enable your module it is resulting into a pop-up. Have a look at the screenshot. You can secure from these vulnerability by using filters like check_plain() at the time of displaying your content.
Hope I make you clear.
Thanks,
Udaksh
Comment #13
DanZ commentedComment #14
cackle commentedHello,
Udaksh thank you for your explanation.
I fixed it as you reccomend by check_plain() function although Cackle also filtering all the fields the users enter when the comment posted.
Thanks.
Cackle
Comment #15
20th commentedManual review
This is not specifically mentioned in the coding standards, but there must be a blank line between function and method declarations.
The whole class, in my opinion, validates one of the Drupal's main ideas: presentation must be separated from functionality.
All HTML should refactored out of the class body into theming-hooks. Preferably, JavaScript snippets should be moved to separate files too.
Your module has an implicit dependency on the curl PHP extension, but it is not mentioned in neither .info file nor in module's documentation. Curl is not required by Drupal, so it may be missing on some hosts. If your module is enabled on such host, it will produce a fatal error.
You must implement hook_requirements() and prevent installation of the module, in the curl extension is not enabled.
Take a look at the simpletest_requirements() function. It has this check.
It is not an error per se, but I really do not like how your module declares itself as Firefox in a curl request. This is not a fair behavior, and it can be detected anyway. You should honestly use something like:
Update: In fact, most of my comments have already been mentioned by previous reviewers. Please fix them.
Comment #16
cackle commentedHello,
fixed
fixed
I created template with html, as you recommended.
Many our clients disable native drupal's comment module, so we built our module independent and so we can't use native comments module functions in our module.
No, we don't use comment module.
We fixed that with $has_curl = function_exists('curl_init') and if client have curl support then module will make a request for cackle.me to get comments, but if no - only javascript widget will be displayed without comment's html for SEO.
We fixed that as you recommend.
Thank you for your useful review.
Comment #17
PDNagilum commentedI liked the module in its simpleness. Quick to install and just as quick to get up and running.
Manual review:
Comment #18
hhhc commentedHi,
manual review:
#1: cackle.module:
put your Javascript code in a dedicated JS file and pass down settings from PHP with Drupal.settings, see http://drupal.org/node/756722
#2: cackle.module, line 76ff:
You don't set a subject for the block.
If I understand correctly you allow this module to work only with the 3 standard content types forum, article and page. If this is intended you should be adding a comment to explain this. But please understand that in bigger projects these 3 CT are only rarely used but extended by custom CT. Dont limit yourself.
#3: cackle.php:
Do you really need to transfer the various versions for Drupal, PHP and the module on every request?
#4: custompage.tpl.php: using ob_start should not be necessary with templates
Comment #19
20th commented@hhhc
It was my suggestion to include versions of everything in the UserAgent string. The reasons why I have advised to do so are:
Of course, the maintainer of this module is free to decide whether or not to send all this information. If you have some reasons to believe that this is a bad idea, perhaps, the UserAgent string can be made less verbose.
Comment #20
klausiPlease note: All user accounts are for individuals. Accounts created for more than one user will be blocked when discovered.
Review of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
manual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #20.0
klausiReviews of other projects:
Comment #21
cackle commentedklausi,
thank you for review.
I fixed the most items you recommended.
Could you please to review it again?
Comment #22
klausiYou have not done any manual review, you just posted the output of an automated review tool. Make sure to read through the source code of the other projects.
manual review:
The permission problem is a minor security blocker, otherwise looks nearly ready to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #23
cackle commentedklausi,
I really try to find problems doing manual review.. somewhere I found.. somewhere not... You can see(on screnshoot) by file change that I really checkout projects during last week. See here -
http://s2.ipicture.ru/uploads/20130205/RstPKrWZ.png
Yes, I know that you found it by the previous review. But I decide not to fix that. These settings (siteId, api keys in Cackle system) on /admin/config/services/cackle should not be access by other users. It is only for administrators. So, I see the http://api.drupal.org/api/drupal/modules!system!system.module/function/s... .. I even create new authenticated user and try to get /admin/config/services/cackle... and "ACCESS DENIED" that ok.. and if I change role to administrator to that user it will be available to edit.
And what is the problem? And why you can't promote this module?
Comment #24
DanZ commentedThe problem is that the permission system has much more depth than that. The other problem is that English is a confusing language.
"access administration pages" means that a user can see at least one administration page, probably with the administration theme overlay. Look at admin/people/permissions. There are many, many possible permissions.
Let's imagine that you put an internal financial report on an administration page. It's not for every visitor to your site. It's just for your accountant. So, you give your accountant access to the administration pages and read access on the report. However, that's all you give him permission for. You don't give him permission to write a blog. You don't give him permission to change the settings of trigger events in your Rules module. You don't give him permission to change the picture on your home page. You don't give him permission to change your Cackle settings. You don't give him permission to delete other people's Cackle posts. You don't want to give him permission for anything but to view that report. When he goes to the administration menu on the administration page, you want him to see only one link to click on there: The financial report.
If you make the Cackle permission "access administration pages", then the accountant who can see your financial report will also be able to administer Cackle. That is the problem. Do not use that permission.
Since this is not dependent on the Comment module, I think it would be best to to create one or more new permissions like "administer Cackle settings" and "administer Cackle posts," then use those.
Comment #25
cackle commentedDanZ, thank you for your explanation. Now I understand the problem.
Can I just change it for "administer site configuration" permission for only administrator access?
Thanks.
Comment #26
DanZ commentedYou're welcome.
It would be better to add new permissions, I think. It's easy. See hook_permission(). You might want something like this:
Put in this hook implementation, and you'll be able to use 'administer cackle settings', 'administer cackle posts', and 'administer own cackle posts' as permissions for your module. You'll be able to give users these permissions without being required to give them permissions to do anything else.
Comment #26.0
DanZ commentedreview links added.
Comment #27
cackle commentedklausi,
I fixed permission problem and other items.
Could you please promote this module to full project?
Comment #28
veeraprasadd commentedHi,
I have reviewed your cackle module. I just found minor issues.
Got error for the first time when I enable cackle module.
Please be mentioned in your documentation saying that enable curl in your server side (php.ini etc).
---------
File : cackle.admin.inc
Line 14: It will be great if you use placeholders for link/string
Please follow example Placeholders
Line 23: Expected ',' for the last form attribute and ')' can move it to next line.
Line 30: Expected ',' for the last form attribute and ')' can move it to next line.
Line 37: Expected ',' for the last form attribute and ')' can move it to next line.
------------
File: cackle.install
Line 19: Expected one blank line.
------------
File: cackle.js
File: counter.js
You may use Drupal.behaviors (http://drupal.org/node/114774#javascript-behaviors)
------------
File: cackle.php
Line 59: Expected one blank line.
Line 70: Expected one blank line.
Other than that I never found any issues while doing manual review.
Regards,
D. Veera Prasad.
www.drup-all.com
Comment #29
cackle commentedveeraprasadd,
thank you for review.
The module can work with and without curl extention. I just have forgotten add curl test before starting synchronization to local db. I just have fixed it.
Also I have mentioned in documentation that comment synchronization will work only with enabled curl extension and in other cases module just adds Cackle comment form.
Thank you for finding this issue.
Comment #30
klausiLooks RTBC to me. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Assigning to tim.plunkett as he might have time to take a final look at this.
Comment #31
klausiNow actually assigning.
Comment #32
jthorson commentedThanks for your contribution, cackle!
I updated your account to let you promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and get involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #33.0
(not verified) commentedAdding reviews links