Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 Feb 2016 at 11:25 UTC
Updated:
14 Jun 2016 at 18:54 UTC
Jump to comment: Most recent
Comments
Comment #2
manikaprasanth commentedAutomated Review
Please fix the pareview issues
http://pareview.sh/pareview/httpgitdrupalorgsandboxjimafisk2525998git
Manual Review
Please use db_select instead of db_query().https://api.drupal.org/api/drupal/includes!database!database.inc/functio...
Please use l() instead of
<a>tags. https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7The 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 #3
PA robot commentedWe are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #4
jimafisk commentedHi manikaprasanth,
Thank you for reviewing my code and being so thorough with your response. I've gone through and updated the code to comply with paraview (http://pareview.sh/pareview/httpgitdrupalorgsandboxjimafisk2525998git). I've also tried to address the following from your manual review:
<a>tags to l() functionsComment #5
jimafisk commentedBonus Links:
Comment #6
jimafisk commentedComment #7
jimafisk commentedComment #8
gotosolr commentedThe module has a bug with deleting pages which are not nodes. Otherwise this looks great. Posting review below.
Automated Review :
Coder found no issues with the project.
Manual Review:
Individual user account
Yes, Follows
No duplication
Yes,Follows
Master Branch
Yes: Follows
Licensing
Yes: Follows.
3rd party assets/code :
Yes, follows
Code long/complex enough for review
Yes, follows
Security Code:
Yes,follows
Comment #9
jimafisk commentedHi gotosolr,
Thank you for taking a look at the code and great catch! I've changed the logic from passing the nid through hook_menu as a page argument to using query parameters to pass the complete path. I did this in order to account for an unknown amount of arguments. After receiving the path to remove from the uncache_pages table via drupal_get_query_parameters() I run an additional check to ensure it's a valid path in case the URL was changed on the front end.
Comment #10
ItangSanjana commentedAutomated Review
No issue.
Manual Review
Seems OK.
Comment #11
Chetan Sharma commentedHi jimafisk,
The module has a bug with deleting pages when site is running inside the folder(Not at root).
'remove' => l(
t("Remove this page from Uncache"),
url("/admin/config/development/uncache/delete"),
array('query' => array('path' => $path))
),
It should be :
Global $base_url;
'remove' => l(
t("Remove this page from Uncache"),
url($base_url."/admin/config/development/uncache/delete"),
array('query' => array('path' => $path))
Comment #12
jimafisk commentedHi ItangSanjana and Chetan Sharma,
Thank you both for reviewing my code. I've added the global $base_url variable to the delete path so it will account for sites that are not at root. Thanks for pointing that out to me!
Comment #13
jimafisk commentedComment #14
nwoodland commentedAutomated Review:
No problems found.
Manual Review:
Module works great! Code is clean and easy to understand. Nice work.
Comment #15
kattekrab commentedComment #16
mpdonadioNext up in my queue.
Comment #17
mpdonadioAutomated Review
Review of the 7.x-1.x branch (commit 3c0c5a0):
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
(*) There is a security problem with this module. Assigning to @th_tushar for PAR security training.
A seprate permission would be nice for this, so that site builders can assign this to non-admins.
In uncache_page_listing_table(), why would the table never exist if the module is installed? Comment needed.
uncache_page_listing_table(), you don't need to pass the $base_url to url(), that is the magic of that function.
In uncache_form_submit(), you don't need to plain the inputs, only when you render them. See https://www.drupal.org/node/28984
Your top-level logic for preventing caching will likely be problematic in the long run. That logic should be in a hook_init(), and use drupal_page_is_cacheable().
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.
Security problem is the blocker. If @th_tushar dosn't find it in a few days, I'll post it.
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 #18
th_tushar commentedHi @jimafisk,
I have manually reviewed your code, found the below issues,
In
uncache_admin_settings()function,All user facing text should be passed through Drupal's
t()function.'#markup' => '<br /><br /><h2>Pages that are currently being Uncached</h2>',should be'#markup' => '<br /><br /><h2>' . t('Pages that are currently being Uncached') . </h2>',In
uncache_page_listing_table()function,The values fetched from the database should be check plained in case of plain text or filtered in case of html content.
'alias' => $alias,should be'alias' => check_plain($alias),as it is a path.Use Drupal's Form API to remove the uncached pages from the list. This should be done using Drupal's
confirm_form(). See Avoid cross-site request forgeries (CSRF).Remove
$base_urlfromurl()function.In
uncache_delete_page()function,This should be done using Drupal's Form API. Move the validation to form validation function.
In
uncache_form()function,'#title' => 'URL',should be'#title' => t('URL'),as it is a user facing text.In
uncache_form_submit()function,$input = check_plain($form_state['values']['uncache_page']);should be$input = $form_state['values']['uncache_page'];User input text should be saved as is, it should only be check plained or filtered while displaying back to user.
Move the validation logic to form validation handler function and use
form_set_error()function to display form errors.Below user facing text should be passed through
t()function.$alias = $alias == "" ? "not set" : $alias;should be$alias = $alias == "" ? t("not set") : $alias;Comment #19
jimafisk commentedHi mpdonadio and th_tushar,
Thank you for the reviews! I appreciate you being so thorough with your feedback; I'm reviewing your comments and making these changes.
Comment #20
jimafisk commentedThanks again @mpdonadio and @th_tushar for looking over my code and helping me realize the security implications of modifying data using GET. I believe the major security issue identified (note this issue is flagged "PAReview: security.") was a CSRF vulnerability, which I've tried to mitigate by using
confirm_form()per th_tushar's instructions. Below I've outlined my attempt fix the issues identified, which are also detailed in my commit messages:Thank you!
Comment #21
bazaalt.organ commentedHi jimafisk,
Just some performance optimizations not really bug:
1. on the admin page this function called twice uncache_get_all_uncached_paths which means it makes two DB selects, you could avoid it if you would use some caching in your function, for example:
on second call it will provide the result from the static variable and so you can save one DB query, but if you still need always get the exact real result you can call your function with TRUE parameter.
2. You can save again another DB query if you get rid of this condition:
sites/all/modules/uncache/uncache.module:255
I think it is unnecessary, because if once you have installed the module the table will exist. (disable module won't remove the table).
3. On frontend you could save code amount if you would move the admin related codes (forms, settings, etc) to an uncache.admin.inc file. In this way that parts would be included only on backend.
I hope my suggestions can help you to make your module better.
Comment #22
klausimanual review:
Although you should definitively fix those issues they are not critical application blockers, looks RTBC to me otherwise. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Assigning to mpdonadio as he might have time to take a final look at this.
Comment #23
damienmckennaThanks for your contribution, Jim!
I updated your account so you can 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 stay 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 #24
jimafisk commentedThank you @bazaalt.organ, @klausi, and @DamienMcKenna for the advice and updated contributor permissions! I'll spend some time implementing your recommendations before promoting Uncache to a full project!