Closed (won't fix)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
9 Jun 2015 at 16:41 UTC
Updated:
29 Jul 2016 at 16:24 UTC
Jump to comment: Most recent
Comments
Comment #1
sanjayk commentedComment #2
sanjayk commentedComment #3
sanjayk commentedComment #4
sanjayk commentedComment #5
sanjayk commentedComment #6
sanjayk commentedComment #7
sanjayk commentedComment #8
braindrift commentedHi sanjayk,
please prepend [D7] to the title of this issue.
According to the documentation of hook_menu() the title is required for a menu item.
You should use a stream wrapper 'public://' to save the image in
div_screenshot_create().You should not have 3rd party libraries (like jquery.plugin.html2canvas.js) in your module.
Please pass the string that is returned by your
div_screenshot_create()through t().You should wrapp your JavaScript Code
You are using
strtotime('now')to generate the file name for the image? What happens if two images are generated in the same second? Better usedrupal_get_token()to generate the image file name, this would also make the file names unpredictable.Best regards
Comment #9
sanjayk commented@braindrift:
Thanks for your review!
I have fix all the issues.
Comment #10
braindrift commentedHi sanjayk,
Security issue: You really should sanitize/validate the
$_REQUEST['str']before using it indiv_screenshot_create()and just copying it into a file.You should name the libraries directory like the library itself (e.g. jquery.html2canvas) and not like your module. Since your module depends on libraries module you should use this module and implement a proper
hook_libraries_info().If you require an other jQuery version than the core you should use jQuery Update and not just load an other jQuery version from an external resource.
Using
drupal_get_token()without an argument would result in the same filename for all images that are generated in the same session. Is that what you wanted? If not then you shoud randomize the filename to pass a dynamic argument (e.g.drupal_get_token(rand()))You should use
file_prepare_directory()to prepare your directory indiv_screenshot_create().Since I have jQuery Update installed I get this:
Please remove the
package = Customand the dubledependencies[] = librariesfrom your info file.Why this menu item?
Your page callback doesn't accept any arguments.
Why this confusing comment?
This function is not implementing any hook.
You are still not using the stream wrapper in
div_screenshot_create():102IMHO this module is not complicated enough to prove your drupal skills.
Best regards
Comment #11
sanjayk commented@braindrift
Thanks for review.
I have fixed all the issues.
Comment #12
sanjayk commentedComment #13
sanjayk commentedComment #14
sanjayk commentedComment #15
th_tushar commentedAutomated Review
[Best practice issues identified by pareview.sh / drupalcs / coder. Please don't copy/paste all of the results unless they are short. If there are a lot, then post a link to the automated review and mention that problems should be addressed.]
Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.
Manual Review
* All user facing text should be passed through translate
t()function. Update user facing text inhook_help()with translate function.* As you are not altering the javascript and using to just include the libraries and javascript files, remove the
div_screenshot_js_alter()and move the code tohook_init()orhook_preprocess_page().* Do not load jquery.plugin.html2canvas.js file if the file is not available. It may cause file not found javascript error.
+ In
div_screenshot_create(), don't just echo strings, usedrupal_set_message()instead.The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
This review uses the Project Application Review Template.
Comment #16
sanjayk commented@th_tushar:
Thanks for the review.
* Added t() function. Update user facing text in hook_help() with translate function.
* Now removed div_screenshot_js_alter() and added div_screenshot_page_build().
* Before load jquery.plugin.html2canvas.js checking module exist or not.
+ Now using drupal_json_output in div_screenshot_create(), instead of echo.
All the issues have fixed.
And also achieved
Code long/complex enough for review
No: Does not follow the guidelines for project length and complexity.
Comment #17
sanjayk commentedComment #18
sanjayk commentedComment #19
sanjayk commentedComment #20
gisleTags are separated by commas, not semicolons.
Comment #21
klausiRemoving review bonus tag, you 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, as requested on the review bonus page.
Comment #22
sanjayk commentedI have done manual review three different project
https://www.drupal.org/node/2755901#comment-11341173
https://www.drupal.org/node/2753119#comment-11341033
https://www.drupal.org/node/2604348#comment-11345187
Comment #23
sanjayk commentedComment #24
hardikpandya commentedHi sanjayk,
My findings for your module as follows:
1) As suggested by braindrift,
Security Issue: You really should sanitize/validate the $_REQUEST['str'] before using it in div_screenshot_create() and just copying it into a file.
2) You should remove the package = Custom from your info file.
3) Suggestion: Instead of using $_REQUEST['str'], you can create a settings form to save div ids and provide capture functionality accordingly.
Thanks
Comment #25
sanjayk commented@hardik.p thanks for review
All changes done
1) As suggested by braindrift,
Security Issue: You really should sanitize/validate the $_REQUEST['str'] before using it in div_screenshot_create() and just copying it into a file.
Done, now I more sanitize code.
2) You should remove the package = Custom from your info file.
Done, Removed
3) Suggestion: Instead of using $_REQUEST['str'], you can create a settings form to save div ids and provide capture functionality accordingly.
I would like to explain functionality. here I am not saving div ids actually here i am getting image string which is created by js. On js file i am submitting a form and in this form passing encode image string. If you still any suggestion please let me know.
Comment #26
manojapare commentedHi @sanjayk,
Manual Review
Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
Yes: Follows Coding style and Drupal API usage standards.
Comment #27
klausiComment #28
klausimanual review:
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #29
PA robot commentedClosing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).
I'm a robot and this is an automated message from Project Applications Scraper.