Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
27 Nov 2013 at 23:08 UTC
Updated:
11 Feb 2015 at 20:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxsvaj2145645git
We 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
svajlenka commentedComment #3
svajlenka commentedThanks PA robot! I've fixed those nasty coding standards issues and would like to submit this for review once again!
Comment #4
balagan commentedNice work, looks good to me.
Comment #5
yogeshchaugule8 commentedComment #6
yogeshchaugule8 commentedComment #7
svajlenka commentedThanks yogeshchaugule8, I've addressed those issues.
1. That and the upcoming_content_fetch_nodes method now live in includes/upcoming_content.views.inc
2-4. This was cleaned up, thanks for finding some code that didn't need to stick around!
Comment #8
basant commentedComment #9
svajlenka commentedUnassigning, I reached out to basant a few days ago and haven't heard back.
Comment #10
aroq commentedupcoming_content.install:
"incase" -> "in case"
upcoming_content_pane.inc, line # 79
'#options' => $ct_options,
this variable can be not defined on this stage, probably you need to define it earlier
Comment #11
svajlenka commentedThanks aroq! Those changes have been made
Comment #12
devd commented1- Unabe to configure.
2- Unused file upcoming_content.install.
3- Getting the following warning on first installation of this module.
The Date API requires that you set up the site timezone and first day[warning]
of week settings and the date format settings to function correctly.
4- Please tell me how to use this module. I followed your project description but unable to configure or use it.
Comment #13
svajlenka commentedDevendra-yadav:
1. There is no configuration except for the panel pane this module provides.
2. Very well, I've removed this file.
3. This notice is from the Date module, you should follow the configuration for that module.
4. My project provides a panel pane, if you do not know how to use the page manager, I'd recommend against using this module. My directions on my project page provide instructions for those who can at least add panes to pages. I've provided a little more detail for those a little unfamiliar with panels, etc.
Comment #14
svajlenka commentedComment #15
chalk commented@svajlenka,
It's seems to be incorrect and insecure with AJAX. At first of all you should use 'delivery callback' as 'ajax_deliver' for AJAX in hook_menu(). Also add validation for $content_type to prevent error during field instance getting.
It's bad solution to use $_REQUEST['content_type'] in upcoming_content_bundle_fields_callback().
A lot of comments to functions have non-standard spaces before '/*' symbols.
Comment #16
chalk commentedComment #17
svajlenka commentedChalk, thanks for the AJAX direction!
I took some time and got all sorts of confused digging into the form api ajax callback stuff. I did learn quite a bit about how Drupal AJAX works :).
I've fixed the usage of $_REQUEST, the comment spacing, the delivery callback setting and added validation on $content_type.
Comment #18
artsakenos commentedHello svajlenka,
the module is quite interesting.
Code is well written, I can't find any evident shortcomings. Here a pair of suggestions:
1) Add the module folder name to the repo clone string, e.g.,
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/svaj/2145645.git upcoming_content2) Being not familiar with the page manager module, I'm following instructions to install. I read:
But there, I can only Enable or Edit pages. Editing a page allows me to “add variants” but I don’t see any Add Content or Miscellaneous, to continue the settings. Something I am missing?
Comment #19
a_thakur commentedHi,
Was wondering much of the functionality of the module can be made using views module. Couple of configuration using views we can show *Upcoming Content* based on some filter criteria and create a block of those content and show it on the site.
Comment #20
joachim commented> My project, upcoming_content provides a ctools content_type pane to easily display nodes that are "upcoming", grouped by the time period the site builder chooses
I don't understand what you mean by 'upcoming'.
Also, even if it is accepted that this is an improvement over building a view (which is yet to be shown), it's surely more flexible to expose a block rather than a Panels content pane? That allows site builders to use whatever layout system they want.
Comment #21
svajlenka commented>Editing a page allows me to “add variants” but I don’t see any Add Content or Miscellaneous, to continue the settings. Something I am missing?
Yeah, sorry, you'll need to create a variant if you do not have any.
Regarding as to why this might be used as opposed to views: Not every site builder wants to (or is skillful enough) to create every view for their content. This provides an much easier interface to create a view of content that has a date field that is in the future, grouped by periods of date (week, day, month). Much of the functionality of views could also be made by making extensive use of the database api, but we see views becoming a part of core in 8. This is just another tool to help site builders build with less time spent configuring or coding.
Regarding "upcoming":
Given a content type with a date field, any node whose date field's value is in the future.
Regarding the use of a block over a panel:
A block does not allow for per-instance configuration.
Comment #22
svajlenka commentedComment #23
gisleAutomated Review
The automated review of your project by PAReview has found some issues with your code. As coding standards make sure projects are coded in a consistent style we ask you to please have a look at the report and try to fix them. There are all formatting issues that are simple to fix.
Manual Review
Also, the folowing line does not make sense: 'In the page manager ( /admin/structure/pages ), in a page, under content, click "Add Content"', and I am unable to follow the rest of the instructions.
phpstatement in the.info-file for Drupal 7 unless they specifically need a higher later version of PHP than is required by core. See Writing module .info files and System requirements.date()instead offormat_date(). This may break localization.hook_help(). It is good coding practice to have this hook for every enabled module.The starred items (*) are fairly big issues and warrant going back to Needs Work. The rest of the comments in the code walkthrough are recommendations.
Comment #24
gisleSetting status.
Comment #25
damienmckennaMy primary concern is with the AJAX callback. Under normal circumstances only site admins can access the customization interface for Panels, Panelizer or IPE, thus an AJAX callback would only be accessible by someone with access to one of these interfaces. On the other hand, almost every site grants the anonymous user the 'access content' permission, thus any anonymous user (including bots) could access the AJAX callback and potentially trigger a DDOS attack on the site. I recommend adding an access callback and checking for additional permissions.
For people questioning the value of this module, there are many projects where functionality like this is required, where the editorial team want a simple way of selecting multiple content types and a date filter to show content from that time range. While this module could use some improvements, and such improvements should be handled via issues in its queue, I certainly think it fits a niche that Views cannot fill.
Comment #26
gisleDamienMcKenna, I haven't looked at the AJAX callback yet. I am postponing any detailed review until the instructions about how to set it up are clear. But if you think there is a security problem, you should tag it with
PAReview: security.Also: I am not questioning the value of the module. I just want the overlap with Views made clear on the project page, so that users know what to expect and also know that there is an alternative.
Comment #27
damienmckenna@gisle: No problem. FYI I started writing my review before you'd posted the PAReview, so my comment about the module's value being questioned was more towards joachim.
Comment #28
svajlenka commentedgisle and DamienMcKenna: Thanks for reviewing this and providing such thorough feedback!
I've implemented most of the recommendations you two have outlined. However, I am a little curious if by mentioning that a user will need to create a page variant for a page manager page before they content to the variant would be enough. The chaos tool suite's project page doesn't provide much documentation on using page manager to add content panes. If it did I'd gladly point to that to get past this hurdle.
Regarding the ajax callback's permissions. I've set that to 'administer advanced pane settings'. This should limit access to users who have pane configuration permissions.
Comment #29
gisleJust a brief note (this is not a review). I subscribe to the security list, and from it, I've learned that the security team is not happy about solutons that allow users with "administer something" permissions to carry out XSS or injection attacks. Allowing unsanitized user input, even from an administrator, is IMHO a blocker.
Why don't you just sanitize it?
Comment #30
svajlenka commentedFrom what I understand the ajax callback for my panel pane's settings form was set to allow anonymous access, which could potentially allow for a DDOS. That has been corrected.
The callback's handling of user input should be fine currently. I'm running an array_key_exists against content type machine names with strtolower'd user input. If its a valid content type, the image & date fields it outputs are run through check_plain / filter_xss_admin. I'm not sure what sanitizing that input would do, as I'm not using it anywhere else other than to verify the content type to get field information on. If I'm misunderstanding this, let me know and I'll be happy to sanitize the heck out of it :)
Comment #31
jojonaloha commentedA couple things I notice:
hook_uninstall()inupcoming_content.installto remove your variablestheme/upcoming_content_item.tpl.phpI think you want to useurl()instead ofdrupal_get_path_alias()theme/upcoming_content_item.tpl.phpI think this looks strange:$node->node_title, is that because it's coming from Views? I think you also want to usecheck_plain()when printing that.theme/upcoming_content_item.tpl.phpI think$node->available_dateshould be the configured date field, just like is done with the image field.Comment #32
joachim commented> In theme/upcoming_content_item.tpl.php I think you want to use url() instead of drupal_get_path_alias()
That's true. And additionally, you should also call functions in the preprocessor, rather than in the tpl.
> In theme/upcoming_content_item.tpl.php I think this looks strange: $node->node_title, is that because it's coming from Views? I think you also want to use check_plain() when printing that.
Views sanitizes its output. To be certain that this is fine, try making a node with markup that should be escaped in its title.
> upcoming_content_get_image_fields
This returns full field names. But the TPL prepends 'field_' to them. That seems problematic. It's generally a better idea to store the full names of things to avoid confusion. Here there is the extra complication that not all fields have to have the 'field_' prefix!
> * Define the ctools plugin and it's defaults.
Typo. Should be 'its'.
> Regarding the use of a block over a panel:
> A block does not allow for per-instance configuration.
Fair enough. But I suggest you consider Boxes plugins, at least for your future projects. A panel plugin forces your user to use panels on their site.
Comment #33
svajlenka commentedThanks @jojonaloha and @joachim! I've made those changes to the templates, though I'm using l() to generate the link html instead of url(). I've also sorted out the 'field_' issue by refactoring the view that is generated. I also fixed the $node->available_date issue by correctly using the configured time field in the view.
Thanks so much for you input and time!
Comment #34
gisleAutomated Review
PAReview came up clean.
Manual Review
While this module duplicates trivial use of Views, this module have a different target group (those who don't have the skills to configure Views themselves a prefer a ready to-run-module) and solves the problem in a different way. This is adequately explained on the project page.
One of the steps during Configuration:
I am unable to locate the "Add content" button in a page's variant, see image below.
.info-file. It is reserved for modules that leverages on the Features project. In your case, there should be nopackagestatement in the.info-file. See Module documentation guidelines: Follow package naming conventions.Example: You use
strtolower()instead ofdrupal_strtolower(). This will not properly lowercase an UTF-8 string. .upcoming_content_pane.incyou're callingtime()to get the current timestamp. UseREQUEST_TIMEinstead.The starred item (*) warrants going back to Needs Work. The rest of the comments in the code walkthrough are recommendations.
Comment #35
gisleUpdating status.
Comment #36
damienmckennaYou have to first click the gear icon to the top-left of the pane, that will open a drop-down menu that includes "Add content" as one of the items.
Comment #37
damienmckennaThe "Add content" thing is a basic Panels training issue, I don't think believe it's necessary that this module's README.txt should have to explain how to use Panels, IMHO it should just mention e.g. "A new item will be available under the 'Add content' menu in all Panels-based pages."
Comment #38
gisleNo, but the project page should at least said something like:
"The target audience for this project is experienced Panels users who ..."
If that had been the case, I wouldn't have tried to review it.
I now realize that I am not in the target audience for this project.
I shall to be able to finish my review of this project, so I am taking it off my TODO-list.
Comment #39
svajlenka commentedHey @gisle and @DamienMcKenna! Thanks again for your time and input.
I've made the recommended changes to upcoming_content. I've also updated the project page to include this statement:
Comment #40
jojonaloha commentedIt looks like all the recommendations have been fixed, and there haven't been any new recommendations. I think all that was left was a security review.
I looked through the code and don't see any security issues, as well as ran a Secure Code Review through Coder and it only reported minor style issues:
Since style issues aren't blockers for full project status, I'm marking this as RTBC.
Comment #41
grendzy commentedI skimmed the code for security issues, and it looks good to me. The updates to the AJAX command seem to satisfy DamienMcKenna's concerns. Output goes through appropriate Drupal APIs (render, theme, check_plain, filter_xss), and I see that a filter is present to exclude unpublished content.
Comment #42
kscheirerChecked for security, licensing, Drupal API, and individual account, did not find any problems. Nice work on the security and theming!
Non-blocking issues:
'uid' => REQUEST_TIMEseems like an odd value to useThanks for your contribution, svajlenka!
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.