Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Feb 2014 at 08:14 UTC
Updated:
22 Oct 2014 at 22:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
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 #2
sandykadam commentedPlease fix the code issues, check below list of errors:
EDIT: removed pareview.sh blob.
Comment #3
tr commented@sandykadam: Please don't change the title on the projects you review! This is the second one I've seen that you changed recently. Also, please DON'T paste the entire pareview output here - link to it instead, like was done in #1.
Comment #4
abogomolov commentedFixed issues.
Comment #5
tr commented@abogomolov: you have to set the issue status back to "Needs review" when you fix problems and want people to take another look at your project.
Comment #6
sandykadam commented@abogomolov
1) In .module file in _backlinkseller_affiliate_block_content() can you use drupal standard functions to create link & image instead of hardcoding html tags, you can use l() check https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7#com...
2) In .install file use drupal standard function for copy file_copy()
2.1) Again hardcode html tag of href use url() or l()
2.2) Use placeholder for strings in t()
3) In backlinkseller.inc file use standard way of coding to handle errors.
3.1) Use try/catch block instead of suppressing error by '@'
3.2) Instead of fsockopen use drupal_http_request().
Comment #7
abogomolov commentedThank you @sandykadam!
I fixed issues 1, 2.1, 2.2.
2. file_copy() requires stdClass as source. But image_load return an "invalid" Object. Ther's no uri attribute. How can I get a valid object from file?
3. I don't want to change the content of this file. It's external code from the provider. I will not break something and speed up updates.
Comment #8
inders commented- No need of === operator here, you can use simple equality operator here.
- you can use switch/case here instead of multiple if/else.
- Please fix coder module reports:-
Comment #9
inders commentedComment #10
abogomolov commentedI changed the if statements and removed HTML from description.
Comment #11
tr commentedIn regards to backlinkseller.inc, you say you don't want to change it because it's "external code from the provider".
Drupal.org does not in general allow third-party code in the repository, and does not allow non-GPL code in the repository. If this is external code from the provider, like you said, then it should not be distributed with your project. Instead, it should be downloaded separately at install time and you should be using the Libraries module.
Regardless, naming the function the same as the module (just plain "backlinkseller") is a bad idea. It should be renamed to something more descriptive.
Likewise, using sockets to implement your own minimally-functional version of the HTTP protocol is a bad idea. What if, for example, a web site uses a proxy server? You have no proxy handling in your HTTP implementation, no redirect handling, etc. etc. You should instead be using drupal_http_request() or cURL for HTTP requests, as mentioned in #6.
Comment #12
abogomolov commentedOk, I talked with the provider and they allowed to rewrite this parts of code.
Now I use drupal_http_request() an renamed the "main" function.
Comment #13
heddnComment #14
heddnfunction backlinkseller_help($path, $arg) {function backlinkseller_menu() {function backlinkseller_block_info() {See last bullet point https://drupal.org/coding-standards/docs#drupal and use Implements hook_foo().
'type' => MENU_NORMAL_ITEM,hook_menu defaults to MENU_NORMAL_ITEM so defining a type is not necessary.
For your hook_block_view, please use $delta as your function variable name: https://api.drupal.org/api/drupal/modules%21block%21block.api.php/functi...
Array formatting should follow this standard: https://drupal.org/coding-standards#array. This means all your hook_menu arrays, etc should be reformatted.
There is no string sanitization for $backlinks. This could lead to lots of bad things, including XSS.
.install file:
copy($source, $target);Consider using Drupal's File API or simply serving up the image from the module itself. https://api.drupal.org/api/drupal/includes%21file.inc/7
variable_set('backlinkseller_site_url', $base_url . '/');This won't work on sites where the base isn't a slash. I see logic that assumes slash in several places of the module.
.inc file:
Unused variable.
.admin.inc file:
Consider using https://api.drupal.org/api/drupal/modules%21system%21system.module/funct...
Comment #15
abogomolov commentedHi heddn,
thank you for your review. I fixed your mentions:
- Edit hook PHPDoc
- Removed not necessary menu type
- Renamed $block_name into $delta
- Reformated all arrays
- Check $backlinks for XSS
- Replaced "/" with $base_path
- Use system_settings_form
- Copy banner with File API
I hope it's good enough now and can be moved to a full project. :)
Comment #16
heddnVery close.
admin.inc:
Are these necessary? I've not seen them used before and I don't see any consistency in the rest of the required form elements.
'#description' => t('This ID you can find on the top of the Backlinkseller Code. ($BACKLINK_SELLER["ID"] = "0123456789.9876543210";)'),Move the example into a replacement so translation is clean.
Using system_settings_form() and backlinkseller_settings_form_submit() at the same time are in conflict.
Never reformat data when storing it i.e. check_plain() on backlinkseller_id. This should happen at page render time. Its part of the golden rule of data in Drupal.
Use theme_image.
$installation_root = $_SERVER['DOCUMENT_ROOT'] . base_path();Use DRUPAL_ROOT. See index.php for an example.
I still don't understand why the images can't be served up from the module itself. Why does it need to be copied to public files?
.inc:
Use drupal's url() function to build the url.
.module:
Get rid of the extra whitespace. No need for an empty attributes array. Build the URL using url(). Actually, use l() to do the whole thing. The image path for the image shouldn't include base_path(). See theme_image.
Whitespace.
Use url(). To get a link to the homepage, use .
Pass the html id through drupal_html_id() to confirm they are unique.
Comment #17
abogomolov commented- Removed aria-required.
- Moved the example into a replacement.
- Reformat data on output.
- Used theme_image() in settings form.
- Replaced $_SERVER['DOCUMENT_ROOT'] with DRUPAL_ROOT.
- Used url() to build an URL.
- Removed whitespaces.
- Used drupal_html_id().
Google don't allow to sell and buy links. So the user of this Service must hide all the identifier. If I serve the image from module directory, everyone see "backlinkseller" in the URL. That's why I need to override the default block IDs and copy the image in an anonymous directory.
Here is the documentation from MDN
Would it be o.k. if I rename the validate & save methods?
Comment #18
heddnI'm not suggesting you should remove ARIA. In fact, it makes sense to add. However, there wasn't consistency within the module for the use of aria-required. I only saw it on a couple of the required form elements.
I don't think that the system_settings_form() is needed if you have a submit handler.
I think this should use
l()for creating the URL.l()internally callsurl()so it accepts all the same parameters.Use
url()to build a url. To provide a url to the homepage, useurl('<front>')Not required, but maybe good to note on the project page and the README that some search engines do not allow the use of link selling and therefore this would be a violation of their terms of service.
Moving back to needs work for conflicting calls to submit handler and system_settings_form() and use of url/l. The rest of the stuff isn't a blocker but highly encouraged.
Comment #19
abogomolov commented@heddn
This was new for me. Thank you.
A realy good idea. Done.
I don't understand this. I don't want to use the page domain. The domain should be configurable. (So you can test the service unter a dev domain.) That's why I chain variable_get('backlinkseller_site_url') and $request_uri
Should I use something like this?
$page_url = url(variable_get('backlinkseller_site_url') . $request_uri)Comment #20
heddnI assume this url is a query string parameter. Use
urlto build up the query string, etc.Comment #21
abogomolov commentedHi heddn, I do this in .inc:86
Comment #22
heddnMarking as RTBC now that
urlis now used. However, there isn't any need to pass variables in the query string through check_plain since it gets urlencoded. I also saw some extra whitespace re-added in that last commit but that isn't a release blocker.Comment #23
abogomolov commentedOh, I realy have some problems to controll the whitespaces. I should search for a D7 preset for PHPStorm... Sorry.
- removed check_plain() in query for url()
- deleted whitespaces
Comment #24
abogomolov commentedComment #25
abogomolov commented@heddn Do you change the status of the ticket? I found this explanation:
Source: http://www.bryanbraun.com/2013/01/12/what-does-rtbc-mean
Comment #26
heddnEveryone can change most statuses. But only someone else should move from needs review to RTBC. PHPStorm (depending on the version) has built in support for Drupal. https://drupal.org/node/1962108
Comment #27
abogomolov commented@heddn Nice! Very good instruction.
Comment #28
abogomolov commentedComment #29
abogomolov commentedComment #30
abogomolov commentedAdded tag: PAReviews: review bonus
Comment #31
abogomolov commentedComment #32
heddnStill a couple coder findings @ http://pareview.sh/pareview/httpgitdrupalorgsandboxabogomolov1645208git-.... However, these are not blockers. Assigning to mpdonadio in case he gets a chance to do a final review.
Comment #33
abogomolov commentedThank you heddn.
I fixed the last issues.
Comment #34
klausiReview of the 7.x-2.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:
The check_plain() usage is a blocker right now, you need to know when to use sanitization and when not. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #35
mpdonadioUnassigning myself as klausi got to it before me.
Comment #36
abogomolov commentedThank you klausi. I fixed the issues.
Could you please check the code again?
Comment #37
mpdonadio@abogomolov , when you have made changes, set the status back to Needs Review. That is what tells the reviews that something is ready. I went ahead and did this.
Comment #38
abogomolov commentedAdded reviews
Comment #39
gaurav.pahuja commentedXSS issues are still there.
Please see screenshots below:
Added following content on Setting page:

URL:admin/config/advertisement/backlinkseller/settings
Added following content to Affilates Page:

URL:admin/config/advertisement/backlinkseller/affiliate
Enabled both the Backlinker blocks:
Getting following two nasty JS popup. You need to sanitize this before rendering, make sure to read https://www.drupal.org/node/28984 again.
Adding PAReview: security tag to this thread. please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #40
abogomolov commentedHi gaurav.pahuja,
thank you for the review.
I fixed the XSS issues.
Comment #41
pushpinderchauhan commentedAssigning to myself for next review, which will hopefully be tonight.
Comment #42
pushpinderchauhan commentedAutomated Review
Review of the 7.x-2.x branch (commit a663b91):
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.
Source: http://pareview.sh/ - PAReview.sh online service
Manual Review
'#default_value' => variable_get('backlinkseller_id'), setting default value would be good.$_SERVER['DOCUMENT_ROOT']still exists, rather use DRUPAL_ROOT.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.
I am not seeing any blocking issues except 3rd party code. All issues mentioned by other reviewers have been addressed. I also tested this module from XSS prospective and it is working fine. Comments and docs are also looks good now. Project page is very well organised.
It looks RTBC to me that I'll do after getting answer on banner images.
Thanks!
Comment #43
abogomolov commentedThank you er.pushpinderrana!
I fixed the part "Coding style & Drupal API usage". In backlinkseller_settings_form_validate() I validate an URL, so I use valid_url() now.
3rd party code
Resource: https://www.backlinkseller.de/affiliate/ (images are currently down but you see the resolutions...)
My translation:
Comment #44
pushpinderchauhan commentedChanges looks good.
Thanks!
Comment #45
klausimanual review:
But that are not critical application blockers, so ...
Thanks for your contribution, abogomolov!
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.