The Stitchz Social Login module adds the option to authenticate with one or more of the 20+ social identities providers supported by Stitchz.net. Stitchz Social Login provides a single, simple interface that maintains all your social identity provider information safely and securely (and encrypted while at rest). Using Stitchz saves you from having to integrate and manage each identity provider individually.
Any user account can connect one or more social identities to their account and use them to login in with (before or after their account is created).
You can enhance user personalization on your site by leveraging social profile data provided to you with every login in a standard format. Stitchz currently supports the portablecontacts schema.
Stitchz.net home page: http://www.stitchz.net/
Project Page: https://www.drupal.org/sandbox/stitchzdotnet/2321765
Pareview: http://pareview.sh/pareview/httpgitdrupalorgsandboxstitchzdotnet2321765git
Git Clone: git clone --branch 7.x-3.x http://git.drupal.org/sandbox/stitchzdotnet/2321765.git stitchz_social_login
Demo credentials:
App Url: https://drupal.stitchz.net/
ApiKey: 635491725586335445
AppSecret: bHzQWNiuCzgHGUhkdJUDnGXQRcUeO+g3
Return Url: http://localhost/stitchz_social_login/auth
Reviews of other projects:
https://www.drupal.org/node/2327911#comment-9198749
https://www.drupal.org/node/2348261#comment-9202921
https://www.drupal.org/node/2343299#comment-9202953
Additional reviews of other projects:
https://www.drupal.org/node/2358547#comment-9258401
https://www.drupal.org/node/2303639#comment-9258905
https://www.drupal.org/node/2289027#comment-9260561
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | validation_fail.jpg | 26.92 KB | pushpinderchauhan |
| #25 | display_output1.jpg | 9.08 KB | pushpinderchauhan |
| #25 | display_output.jpg | 8.41 KB | pushpinderchauhan |
| #20 | fatal_error_social.jpg | 11.63 KB | pushpinderchauhan |
| #20 | XSS.png | 31.59 KB | pushpinderchauhan |
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxstitchzdotnet2321765git
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
stitchzdotnet commentedFixed the handful of minor errors reported by pareview.sh. No errors found in the last review. http://git.drupal.org/sandbox/stitchzdotnet/2321765.git
Comment #3
abogomolov commentedHI stitchzdotnet,
I would put every (sub)module in a custom directory.
I would also separate the templates in an directory.
In your queries you select direct from the stitchz_social_login_identities table. This wouldn't work if Drupal was installed with a prefix. (See an example: https://api.drupal.org/comment/7019#comment-7019)
Comment #4
stitchzdotnet commentedThanks abogomolov. I've taken your recommendations and incorporated them into the module.
Comment #5
pkamerakodi commentedHi,
Is the git clone command valid, because i am not able to clone the code
Prajwal
Comment #6
stitchzdotnet commentedHi pkamerakodi
Yes the git clone is valid. It will create a new sub-directory named, "2321765", in the directory you're currently in.
git clone --branch 7.x-3.x http://git.drupal.org/sandbox/stitchzdotnet/2321765.git
Cloning into '2321765'...
remote: Counting objects: 187, done.
remote: Compressing objects: 100% (187/187), done.
remote: Total 187 (delta 129), reused 0 (delta 0)
Receiving objects: 100% (187/187), 83.60 KiB | 0 bytes/s, done.
Resolving deltas: 100% (129/129), done.
Checking connectivity... done
Comment #7
stitchzdotnet commentedComment #8
piyuesh23 commentedDon't think you need to explicitly call drupal_install_schema in hook_install or drupal_uninstall_schema in hook_uninstall. They are automatically taken care of in Drupal7.
Convert db_query in D7 Database api.
Comment #9
stitchzdotnet commentedHi piyuesh23
Thanks for your feedback. I've removed the unnecessary calls to hook_install/hook_uninstall for the drupal_install_schema/drupal_uninstall_schema and cleaned up left over pareview.sh findings.
Regarding the hook_user_delete, since there is a join in the query I'm unable to convert the db_query to db_delete without splitting the query into two which I'd like to avoid.
Thanks!
Comment #10
stitchzdotnet commentedComment #11
stitchzdotnet commentedComment #12
stitchzdotnet commentedComment #13
stitchzdotnet commentedComment #14
rishi.kulshreshthaAutomated Review
Best practice issues identified by pareview.sh seems to be clean.
Manual Review
git clone --branch 7.x-3.x http://git.drupal.org/sandbox/stitchzdotnet/2321765.git stitchz_social_loginThe 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.
This review uses the Project Application Review Template.
Comment #15
klausiThat are not application blockers, anything else that you found or should this be RTBC instead?
Comment #16
rishi.kulshreshtha@klausi, you are correct. Thanks for the correction!
Except the README section this module is perfect. Hence moving it to RTBC.
Thanks for contributing to Drupal @stitchzdotnet
Comment #17
stitchzdotnet commentedComment #18
stitchzdotnet commentedThanks Rishi and klausi, I've updated the README per your findings.
Comment #19
pushpinderchauhan commentedAssigning to myself for next review.
Comment #20
pushpinderchauhan commentedAutomated Review
Best practice issues identified by pareview.sh / drupalcs / coder. None.
Review of the 7.x-3.x branch (commit b2592e7):
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
<script>alert('XSS');</script>in the admin settings form, get a nasty javascript popup. You need to sanitize this before rendering, make sure to read https://www.drupal.org/node/28984 again.In given code apikey and redirect_uri variables coming form user provided input and you are directly rendering without sanitize that's why these popup coming. Also check the same for other places too in your code.
stitchz login primaary key. Some fields having length 2000, really required, comment needed?'apikey' => check_plain($values['apikey']),. This should happen at page render time. Its part of the golden rule of data in Drupal. You should only escape variables if you are actually printing them.cache_clear_all();why you need this? You are using this function 8 times in your module. Comment needed.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.
Please don't remove the security tag, we keep that for statistics and to show examples of security problems.
Comment #21
stitchzdotnet commentedHi er.pushpinderrana
Thanks for the detailed code review. I've addressed the findings and added additional inline comments where necessary.
Thanks again!
Comment #22
mccrodp commentedAll issues found were minor, so I am leaving at Needs Review for further reviewers to verify all is ok. Looks good to me.
Automated Review
Review of the 7.x-3.x branch (commit a605543):
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 = '';seems pointless as it is always overwritten in the if/else. The same is in line 204 of addin module.$redirecturiis used in addin module after being set in line 113.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.
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 #23
stitchzdotnet commentedHi mccrodp
Thanks for code review. I've made the necessary modifications and inline comments to the code.
Thanks!
Comment #24
pushpinderchauhan commentedAssigning to myself for another review.
Comment #25
pushpinderchauhan commentedI started to review your code again but found lot of check_plain() taken place in your code that shows still you need to know where Sanitization functions are required to escape string. You can not use these functions at every place, in one line I would say Filter on output, not input.
See https://www.drupal.org/node/28984 and https://www.drupal.org/node/263002 again.
(*) stitchz_social_login_config_settings_form(): In this form, for every element you are using check_plain() to set default value that's wrong. When handling data, the golden rule is to store exactly what the user typed. When a user edits a post they created earlier, the form should contain the same things as it did when they first submitted it. This means that conversions are performed when content is output, not when saved to the database.
I have input
<script>alert("XSS APP Key")</script>in apikey field and after successful form submission it looks like<script>alert("XSS APP Key")</script>Input
<script>alert("XSS APP")</script>in Social Login Notes field, it looks like<p>alert("XSS APP")</p>(*) stitchz_social_login_admin_check_is_valid_api_url() : Wrong way to validate rather use hook_validate(). Because if user have input some values, due to this function all user input values reset with default values if validation fails that cause inflammation to end user.
(*) stitchz_social_login_authorization_handler_save_oauth_credentials(): Why are you using db_query() for update instead use db_update().
(+) drupal_add_css() still exists at 5 places in your code rather use #attached.
One more thing either address or at least comment the issues pointed out in #20.
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'll stop there as this project is huge...
Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.
Comment #26
stitchzdotnet commentedHi er.pushpinderrana
Thanks again for your code review. I've addressed the findings per your recommendations and pushed the code for additional review.
Originally, I included my comments with respect to comment #20 in my GIT commit. I've re-posted them below with some further explanation:
substr with drupal_substr().
In response to #22 (originally included in GIT commit), thanks again mccrodp, my comments are below:
In response to #25 (originally included in GIT commit), my comments are below:
#25.2 - Added hook_validate in place of standalone function
#25.3 - Replaced complex join and update utilizing db_query with db_update.
#25.4 - Replaced all drupal_add_css() with [#attached]
Hope this clarifies the code changes made in response to comments #20, #22, & #25.
Thanks again for all your efforts.
Comment #27
stitchzdotnet commentedComment #28
stitchzdotnet commentedComment #29
stitchzdotnet commentedComment #30
stitchzdotnet commentedComment #31
pushpinderchauhan commentedAutomated Review
Review of the 7.x-3.x branch (commit b0dfcd0):
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
My blocking issues from #25 have been addressed, looks great improvement. Good Job!
$arr['host']is not checked before use. See http://php.net/manual/en/function.isset.php.!$user->uid) to check whether user is anonymous, rather use user_is_anonymous().http://static01.stitchz.net/images/logo-55x40.png, can you point me usage of this image is OK, not violating third party content policy. See https://www.drupal.org/node/422996 again and confirm the same.return drupal_goto('user/' . $uid . '/social_login_accounts');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 little bit unsure about third point as 3rd party code and Licensing issues are major blocker, want clarification from your side. Apart from this, I am not seeing any blocker.
Thanks!
Comment #32
stitchzdotnet commentedThanks er.pushpinderrana for your code review. I've addressed the findings per your recommendations and pushed the code for review.
Comment #33
nomorecaptcha commentedAutomated Review
I had reviewed the plugin there is no issue in it. Link
Manual Review
Individual user account
Yes: Follows
No duplication
Yes: Does not cause.
Licensing
N/A
3rd party assets/code
N/A.
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
Yes: Meets the security requirements. List of security issues identified.
Comment #34
pushpinderchauhan commentedAssigning to myself for next review.
Comment #35
pushpinderchauhan commentedAutomated Review
Review of the 7.x-3.x branch (commit 79c6be8):
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
'#markup' => t('Connect your Drupal site with Stitchz Login by completing the fields below, sync your providers list, then click Save. The below information should be copied directly from your <a href="https://login.stitchz.net/">Stitczh Login Application Settings</a>.'),do not create link markup yourself, use url() or l() instead. Do correct this at other places too in your code.
See:
$provider_htmlvariable contains<img>tag directly at number of places in your code instead use theme() or theme_image().something like this
echo theme('image', array('path' => drupal_get_path('module', 'stitchz_social_login') . '/images/logo-55x40.png'));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.
@stitchzdotnet, I am not seeing any blocking issues so further moving to RTBC but you should fix fourth point before stable release of this project.
I tested this module functionality and it works as intended. Also inline comments and To Dos docs looks good to me.
As this module is huge, I believe it needs another pair of eyes. Assigning to mpdonadio for a second look if he has time.
Comment #36
mpdonadioI just want to give a status update that this is in review. The code weighs in at nearly three thousand lines. This take a while to review. I have a first pass done, and have not found anything major, but I have several things I want to double check from a security perspective (mainly the actual authentication process and the API calls out).
Comment #37
mpdonadioAutomated Review
Review of the 7.x-3.x branch (commit 79c6be8):
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
(skipping the stuff already covered in the review template and just doing a code walkthrough)
.info files don't need quotes around things.
In stitchz_social_login_addin_block_view(), since you are checking for the anon user, you may want to set explicit DRUPAL_CACHE_PER_ROLE on the block.
stitchz_social_login_addin_format_provider_list() should return a render array any not markup; #markup should really be avoided for anything complex. Also similar places elsewhere.
I think stitchz_social_login_addin_display_provider_list() missues #prefix a little bit...
stitchz_social_login_addin_menu(), you don't need to specify the file for the callback when it is in the same file as the hook.
stitchz_social_login_addin_profile_accounts() is missing the @return in the docblock.
stitchz_social_login_addin_get_user_identities() can likely use one of the ->fetchAll() variants instead of looping over ther results.
Your URL building should really use the Drupal functions for building it up rather than string concatenation.
(+) stitchz_social_login_addin_format_provider_list(), there is some untranslated text towards the bottom (Powered By). Double check the module for untranslated strings.
stitchz_social_login_addin_add_identity(), use user_is_logged_in().
In stitchz_social_login_addin_add_identity(), how can you be logged in and not be logged in at the same time? Something looks weird with this logic.
stitchz_social_login_addin_add_identity(), avoid splitting strings across lines (this is a valid exception for PAReview).
stitchz_social_login_addin_prepare_and_send_v1_request(), use drupal_http_build_query()
stitchz_social_login_addin_prepare_and_send_v1_request(), cURL is not a better option. Use the Drupal API whenever you can.
stitchz_social_login_addin_prepare_and_send_v1_request(), why the double JSON decode? Comment needed.
stitchz_social_login_authorization_handler_response_reader(), remove the commented out code
stitchz_social_login_config_settings_form(), $base_url is almost never needed directly. Use url() to make an absolute URL if needed.
(*) In your requests to HTTP requests out (eg, stitchz_social_login_addin_prepare_and_send_v1_request) your usage of check_plain is wrong. These functions are for escaping things going to user output. These aren't. Also, you should really build up the query string with drupal_http_build_query().
(*) I can't totally trace this out, but I think you have a security problem in stitchz_social_login_addin_format_provider_list() and similar places with the authentication_url. You should be using url() to build up the URL instead of doing so manually. By doing this dangerous protocols will be stripped via drupal_strip_dangerous_protocols(), and you will be sure your parameters get handled properly.
The starred items (*) are fairly big issues and warrant going back to Needs Work (these are the only things that I see that must be fixed; and should be fairly easy to get this approved). 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 #38
stitchzdotnet commentedHi er.pushpinderrana & mpdonadio
Thank you for your code review. I've addressed the findings per your recommendations and pushed the code for review.
Comment #39
klausiReview of the 7.x-3.x branch (commit f9d0db0):
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:
But otherwise looks ready to me.
Since this was RTBC already and the comments seem to be addressed ...
Thanks for your contribution, stitchzdotnet!
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 #40
stitchzdotnet commentedklausi, thanks for your review and comments. I will be implementing your suggestions/findings prior to moving my project out of sandbox mode.
I'd also like to thank everyone for your help in reviewing, commenting, providing feedback, offering suggestions, etc. You all are a truly dedicated group of knowledgeable developers, I tip my hat to you all.