Closed (won't fix)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
14 May 2014 at 12:45 UTC
Updated:
10 Jan 2016 at 23:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
maijs commentedMy review of the module:
search_replace_blocks_menus_menu()isMENU_LOCAL_TASKrather thanMENU_NORMAL_ITEM). Description attribute for the menu link is also missing."Please Select Atleast One Checkbox!". My suggestion is to use form element with type#checkboxeswith#titleattribute "Search and replace in following locations" with two options "Custom block body" and "Menu title" and#requiredattribute set toTRUEso that user knows that at least one of checkboxes needs to be checked.search_replace_blocks_menus_input_form_validate()will not be necessary.search_replace_blocks_menus_form_submit_oneandsearch_replace_blocks_menus_form_submit_twoand their function comments stateSubmission handler for node_generator_input_form form.which is not descriptive enough of what the functions do.search_replace_blocks_menus_form_submit_oneandsearch_replace_blocks_menus_form_submit_twofunctions invokedrupal_set_message()with unsanitised output which has security implications.search_replace_blocks_menus_form_submit_twofunction perform submitted value validation (if ($form_state['values']['replace_string'] == '') { .. }) which should be done in validation handler function.search_replace_blocks_menus_permission()should be capitalised.Notice: Undefined variable: key in search_replace_blocks_menus_form_submit_one() (line 95 of /Sites/search_menus/drupal/sites/all/modules/search_replace_blocks_menus/search_replace_blocks_menus.admin.inc)." is thrown if user searches for certain text in block body but no matches are found.Comment #2
maijs commentedComment #3
ankitgarg commentedI have fixed most the suggestions please review.
if possible please provide more information on point 8 i.e "search_replace_blocks_menus_form_submit_one and search_replace_blocks_menus_form_submit_two functions invoke drupal_set_message() with unsanitised output which has security implications."
Thanks in advance.
Comment #4
ankitgarg commentedComment #5
maijs commentedankitgarg,
1. Regarding unsanitised output. Try checking "Search Or Replace In Menus Title" and enter
<script>alert('Boom!');</script>in Search field. A javascript will be executed in your browser.2. Upon form submission checkboxes are not preserving their state, that is, their "check" state is not populated.
3.
drupal_set_title(t('Replace In Blocks And Menus.'))insearch_replace_blocks_menus_input_form()form function is redundant as page title is already set by the menu system.Comment #6
PA robot commentedProject 1: https://drupal.org/node/2267323
Project 2: https://drupal.org/node/2262881
As successful completion of the project application process results in the applicant being granted the 'Create Full Projects' permission, there is no need to take multiple applications through the process. Once the first application has been successfully approved, then the applicant can promote other projects without review. Because of this, posting multiple applications is not necessary, and results in additional workload for reviewers ... which in turn results in longer wait times for everyone in the queue. With this in mind, your secondary applications have been marked as 'closed(duplicate)', with only one application left open (chosen at random).
If you prefer that we proceed through this review process with a different application than the one which was left open, then feel free to close the 'open' application as a duplicate, and re-open one of the project applications which had been closed.
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #7
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 #8
ankitgarg commentedThanks Maijs for clarification. Please Review.
Thanks again.
Comment #9
ankitgarg commentedAny Update?
Comment #10
ankitgarg commentedComment #11
ankitgarg commentedComment #12
kunalgautam commentedModule is working for me. Great work
Comment #13
mpdonadioThe XSS concern in the first comment has not been addressed.
If I use the replacement text
<script>alert('XSS')</script>I get alerts, I suspect from the manual output build to the drupal_set_message(). See https://www.drupal.org/writing-secure-code I only tested with block body, please also test the menu title handler.
Once you take care of that I will do a full review.
Please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #14
gbisht commentedNice module.
But please make these small changes:
Removing review bonus tag, you can add it again after reviewing another 3 projects.
Comment #15
ankitgarg commented@mpdonadio - The XSS concern is fixed please review.
@gulab.bisht - Changes are done.
Comment #16
gwprod commentedYou have a lot of string literals not wrapped in t().
For example, in search_replace_blocks_menus.admin.inc on line 98:
Would probably be better as this:
Comment #17
gwprod commentedIt could also afford to have more detailed inline comments.
Comment #18
mpdonadioDon't forget to set the status when you are done a review. See https://www.drupal.org/node/532400 for more info.
Also, it does help to use the review template, https://groups.drupal.org/node/427683, to make sure you cover all of the necessary points needed by a review.
I have not done a full review of this (I stopped a while ago when I found the XSS issues), widespread lack of t() and widespread non-use of API functions is a valid reason to go back to Needs Work.
Comment #19
gwprod commentedComment #20
ankitgarg commentedHi gwprod/mpdonadio
@mpdonadio - XSS issue is fixed please review.
@gwprod - Changes are made.
Thanks.
Comment #21
coderider commentedHi

my link 1i test this module manually and found some bugs/errors.
there is no methode for handling with HTML or special characters.
see in image frist link is replace by your module.
before its = replace and replace with
replace
and result is <h1>replace<h1>
and see the second one
its add by manually and its showing tags as it is. its mean your module behavior and drupal default behavior is not same.
second one if you strip all HTML tags and i am using Menu HTML then whats happened.
then you get this issue: your module is not compatible with Menu THML.
2 . you are using like query.
'%' . db_like($tmp) . '%', 'LIKE'what should be happened.
i have menu
another link
link
unlink
now replace link with unlink
i want to replace only the second one but result is
another link become => another unlink
link become => unlink
unlink become => ununlink
also its effect my other menus also.
same in block body replace.
i have 10 block and need changes in only one block its not posible with this module.
i think you need alot of work with these issues
Comment #22
ankitgarg commented@coderider - Thanks for your suggestions. Below are my responses for your issues.
1. For menu replacement i am using strip all HTML tags as Menu HTML support is out of scope for my module.
2. I have update the module, now additional checkbox "Match whole word" is there.
3. For replacing string in selected menu and block, we will give this feature in future releases.
Thanks.
Comment #23
nostop8 commentedAutomated Review
No issues found.
Manual Review
Comment #24
ankitgarg commentedHi Volodymyr,
Thanks for your kind support. Your Given patch works perfectly and i have learnt a lot. Thank again.
Comment #25
sumitmadan commentedHi Ankit,
I don't know if this module is useful or not. But I like the UI you provided.
There are some points :
Comment #26
ankitgarg commentedHello Sumit,
Thanks for your suggestions. I have update the module, now additional checkbox " Case-Insensitive Replace" is there.
Thanks.
Comment #27
klausiRemoving automated reviews, 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 #28
klausiReview of the 7.x-1.x branch (commit 0016154):
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:
So the wrong check_plain() usage is a blocker right now. The review bonus tag is already removed, you can add it again if you have done another 3 reviews of other projects.
Comment #29
ankitgarg commentedHi klausi,
Thanks for your valuable review. i updated module as your suggestions please review. Thanks again.
Comment #30
crstnkal commentedHello,
Comment #31
franksj commentedNot adding anything myself but setting back to Needs Work after @Christina Kal's review.
Comment #32
ankitgarg commentedHi Christina Kal,
Thanks for your review. Module is updated according your feedback please look.
Thanks.
Comment #33
ankitgarg commentedComment #34
mpdonadioPlease don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #35
maen commentedI tested the module:
I made a custom block called "custom test" with content "My first test". I saved it in first sidebar.
Then in admin/config/system/replace-blocks-menus I searched "first":
Result:
Then I tried to replace with "second".
Result:
The block is gone and in block administration I can see that the body content is removed.
I assume this is not what you want to???
Then I went through your code from line 149 - 158:
In fact you write that at least one checkbox has to activated! So I would write this in your from description and make an activated checkbox as default, or you take radio buttons or a multi select from field. Doesn't matter.
Here's the code to make your module more secure!
Comment #36
monojnath commentedHi
Great job.!!
I downloaded and used your module.
It works fine for me.
Only, I have to clear the cache to reflect the changes.
Also, it would be great if you document your project properly.
Please visit "https://www.drupal.org/node/2190239".
It would be great if provide the description of what your module does a bit more ea
And I have seen some new issues logged by "http://pareview.sh/pareview/httpgitdrupalorgsandboxankitgarg2262793git".
So, please fix these and good luck :).
Comment #37
melvix commentedREADME.txt
The module description could be improved by changing it from:
This module Search and replace a string in all custom added block body and menus title.to something more clear like:
This module will search and replace text on custom block bodies and all menu titles.Also it was not clear to me from the description in README.txt if the module would search only custom menu titles or not. As it turns out, it searches all menu titles.
Not a blocker, but you might want to change this if you want people to use your module.
Coding style & Drupal API usage
+ I got the same result as maen in #35. I created a new block, searched for text in its body, then attempted to perform a replace. The result was an error:
Notice: Undefined variable: body in search_replace_blocks_menus_form_submit_two() (line 161 of ../sites/all/modules/contrib/search_replace_blocks_menus/search_replace_blocks_menus.admin.inc).And the block was changed so that I had to resave it for it to behave normally.
* The form would be improved by adding some descriptive text at the top and #description text to the checkboxes. It isn't clear what is going to happen when I click the Search button and it REALLY isn't clear what a disaster it could be when I click the Replace button.
At the very least, add a bit of warning above the Replace button that will give users an idea of what kind of damage they could potentially do. The replace function is extremely dangerous and should be labeled as such.
Comment #38
melvix commentedComment #39
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.