Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
7 Jul 2017 at 09:13 UTC
Updated:
3 Sep 2019 at 06:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
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 #3
munish.kumar commentedComment #4
Aaron23 commentedHi,
I have reviewed this module. Works good..! and also checked pa review, there are no errors
Thanks
Comment #5
eliechoufani commentedHello, after my review and tests, this module was checked and has no errors.
Thank you.
Comment #6
moinak_dutta commentedHi munishsharma,
Automated Review
[Best practice issues identified by pareview.sh]
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
[No: Does not follow] the guidelines for project length and complexity.
Secure code
[No: List of security issues identified.]
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #7
shashikant_chauhan commentedHi,
Can you specify why you are using hook_form_alter. You have added custom form validation but not validating anything. You are just setting the $_SESSION['user_last_login'] variable. The better way is use of hook_user_login
Comment #8
shashikant_chauhan commentedComment #9
munish.kumar commentedHi Shashikant,
Thanks, for reviewing this module. I am using hook_form_alter in this module because I have to fetch the last login time of the user from a database. In hook_user_login we always get the current login time that means the last login time is updated before hook_user_login invokes. It is a lightweight version so I used hook_form_alter and in the validate function I fetch the login time before it gets updated and stores it into a session variable.
Comment #10
shashikant_chauhan commentedThanks, Munish for explaination. Your module looks good to go. +1 from me.
Comment #11
sharma.amitt16 commentedHello,
I reviewed the module and found no errors. It works perfectly for me. +1 from me.
Good idea to display user last login time...
Comment #12
flashwebcenterHello munishsharma,
Nice module +1, I am sure it will be useful for drupal community. It is light weight and easy to use. I tested the module and everything is working good.
Comment #13
munish.kumar commentedComment #14
munish.kumar commentedComment #15
Cyclonecode commentedNice module. It seems to work fine and the code looks good. The only thing I found was a couple of small issues regarding global variable placement and translation. I added a very small patch to resolve these issues. Aside from this I don't see any reason not to mark this as RTBC.
Automated Review
Pareview does not report any error or warnings.
Manual Review
Individual user account
Yes: Follows
No duplication
Yes: Does not cause
Master Branch
Yes: Follows
Licensing
Yes: Follows
3rd party assets/code
Yes: Follows
README.txt/README.md
Yes: Follows
Code long/complex enough for review
Yes: Follows
Secure code
Yes: Follows
Coding style & Drupal API usage
(*) Major finding, needs work
(+) Release blocker
Rekommendations:
1. I would keep any global and static variables used at the top of each function.
2. Added a patch for untranslated string in block content.
Comment #16
munish.kumar commentedHi @Cyclonecode,
Thanks, for reviewing this module, I have already applied this patch in my latest release. Any Update for +RTBC ?
Comment #17
th_tushar commentedThere is a security finding in the module's code.
$content = isset($_SESSION['user_last_login']) ? '<div class="last-access">' . $label . ' : ' . $_SESSION['user_last_login'] . '</div>' : '';Please go through the https://www.drupal.org/docs/7/security/writing-secure-code/handle-text-in-a-secure-fashion to handle the text in secure fashion.
Comment #18
munish.kumar commentedHi th_tushar,
Thanks for the review, I have go through the link provided by you,
As I understand that to store the text in such a way exactly what the user typed. But in the line below there is no user typed content:
$content = isset($_SESSION['user_last_login']) ? '<div class="last-access">' . $label . ' : ' . $_SESSION['user_last_login'] . '</div>' : '';I have store a value to a variable $content. In the module file you can see that $label is defined right above this line and it is not user typed text(only a string). Could you please explain this security finding to me more precisely so that I can fix this.
Comment #19
th_tushar commentedHi @munishsharma,
Please use
check_plain()function to print the session variable as it can be changed/updated with any malicious code.Thanks!
Comment #20
munish.kumar commentedHi th_tushar,
I think that is the separate case you are talking about. Please correct me If I am wrong, If I use check_plain() function to print the session variable, how can you say that this variable cannot be changed/updated with any malicious code?. If any malicious activity have access to the session variable, then the variable also updated/changed whether we use check_plain() or not. However, if we create our own module that collects user inputs without passing it through a "safe" text filter such as "Plain", we must use this function for sanitation purposes. In this module I do not collect any input from user, So I think there is no need to add this function.
What do you suggest.?
Comment #21
Cyclonecode commentedI do not see any reason not to use
check_plain()to process the session variables? In my opinion it would not hurt.Comment #22
shashwat purav commentedAssigning this issue for Drupal Mumbai Code Sprint Dec 2017.
Comment #23
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.
Comment #24
munish.kumar commentedComment #25
avpadernocheck_plain()should be used when outputting a value that is supposed not to contain HTML markup, but as Writing secure code says, it should be used on user-submitted content. It is true the code I am showing could output<script src="http://malicious.site.com/crack.js" />if a malicious module alter the value of$_SESSION['user_last_login'], but in that case the malicious code could do worse things.In short, the code used from the module and that I shown is correctly not using
check_plain()because it is not outputting any user-submitted value.Comment #26
avpadernoThank you for your contribution!
I am going to update your account so you can opt into security advisory coverage now.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, 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.
I thank all the dedicated reviewers as well.
Comment #27
munish.kumar commentedThanks @kiamlaluno, for updating my account.