Closed (won't fix)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
15 Mar 2016 at 13:57 UTC
Updated:
1 May 2017 at 16:26 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
saraswathi ravikumar commentedComment #3
saraswathi ravikumar commentedComment #4
PA robot commentedProject 1: https://www.drupal.org/node/2687695
Project 2: https://www.drupal.org/node/2511228
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 #5
PA robot commentedFixed the git clone URL in the issue summary for non-maintainer users.
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 #6
abu-zakham commentedHello sarah ravikumar,
can you provide me module page.
Regards.
Comment #7
abu-zakham commentedHello sarah ravikumar,
Your module isn't work fine, Please see screenshot
I tried to convert 1 Us Dollar to 1 Dinar Jordanian the result is 0, the result should be .708 or something like that.
Best regards.
Comment #8
saraswathi ravikumar commentedComment #9
saraswathi ravikumar commentedComment #10
saraswathi ravikumar commentedHi Abdulla,
The above issue has been fixed. Thank you for reviewing my code.
Thanks,
Sarah.
Comment #11
jabastin arul commentedAutomated Review
[Best practice issues identified by pareview.sh / drupalcs / coder. Please don't copy/paste all of the results unless they are short. If there are a lot, then post a link to the automated review and mention that problems should be addressed.]
Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.
Manual Review
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 #12
jabastin arul commentedComment #13
jabastin arul commentedComment #14
saraswathi ravikumar commentedHi Jabastin,
Thank you for reviewing my code. I have fixed the above issues that you mentioned before.
Thanks,
Sarah.
Comment #15
saraswathi ravikumar commentedComment #16
vikas_jain commentedHello sarah ravikumar,,
Your module works on curl, so please implement "hook_requirements" to check "function_exists('curl_init')".
Thanks.
Comment #17
vikas_jain commentedComment #18
vikas_jain commentedComment #19
klausiIn D8 the Drupal HTTP client service should be used (Guzzle) instead of cURL. But that alone is surely not an application blocker, anything else that you found or should this be RTBC instead?
Comment #20
saraswathi ravikumar commentedHi vikas_jain,
I have added hook_requirements for curl_init. Thank you for reviewing my code.
Thanks,
Sarah.
Comment #21
th_tushar commentedHi @sarah ravikumar,
There are security vulnerabilities found in your code, which are as below,
In
function submitForm(array &$form, FormStateInterface $form_state)function, of file CurrencyConvertForm.phpTo sanitize user input, it should be passed through checkPlain.
$currency_input = $form_state->getValue('currency_convert_amount');As we are expecting numeric value, please update below statement,
if(!empty($currency_input)){to
if (!empty($currency_input) && is_numeric($currency_input)) {The below line is user facing text, it should be passed through
t()function and placeholders should be used to display variable values. Please correct below line,$currency_output = 'The Converted Currency Value : ' . $currency_output;Also, there is a similar module available Yahoo! Finance currency converter. Please check and approach maintainer if you can maintain the Drupal 8 version.
Comment #22
saraswathi ravikumar commentedHi,
I have fixed the security issues that you have mentioned before. Thank you for reviewing my code.
The Yahoo! Finance currency converter is different from this module as it requires currency field as dependency and it does not provide separate block for converter. So i wish to proceed it as a separate module.
Please allow me to contribute currency convert block as separate module.
Thanks,
Sarah.
Comment #23
saraswathi ravikumar commentedComment #24
klausi@th_tushar: no, data should NOT be sanitized when saved to the database in a submit handler: "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" from https://www.drupal.org/node/28984
Make sure to read that article again.
Comment #25
th_tushar commentedHi @sarah ravikumar,
Ignoring #21,
There are security vulnerabilities found in your code, which are as below,
As per the article posted by klausi,
submitForm()function is fine.As we are expecting numeric value, please update below statement,
if(!empty($currency_input)){to
if (!empty($currency_input) && is_numeric($currency_input)) {The below line is user facing text, it should be passed through
t()function and placeholders should be used to display variable values. Please correct below line,$currency_output = 'The Converted Currency Value : ' . $currency_output;Comment #26
saraswathi ravikumar commentedHi th_tushar,
I have already made the following changes in code except the check_plain.
Thank you klausi and th_tushar for reviewing the code.
Thanks,
Sarah.
Comment #27
naveenvalechaThe module uses the yahoo currency converter api to convert the currency value, I would recommend the module should be renamed to yahoo_currency_converter similar like module google_currency_converter which uses the google api to convert the currency.
Comment #28
saraswathi ravikumar commentedHi naveenvalecha ,
Thanks for the recommendation. During my full project release i will rename this module as yahoo currency converter.
Thanks,
Sarah.
Comment #29
saraswathi ravikumar commentedHi,
As i need this module functionality in my drupal site, Please provide me the status of the review soon.
If there is any application blocker for RTBC, Please let me know as soon as possible.
Thanks,
Saraswathi.
Comment #30
xaiwant commented@sarah ravikumar
@file not required
@file is not required for classes, interfaces and traits
/src/Plugin/Block/CurrencyConvertBlock.php
/src/Form/CurrencyConvertForm.php
Comment #31
saraswathi ravikumar commentedHi xaiwant,
Thank you for reviewing my code, The file comments have been removed.
Thanks,
Sarah.
Comment #32
saraswathi ravikumar commentedComment #33
ericpughAutomated Review
Coder returned some minor coding standard issues. (see attached)
Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.
Manual Review
This may be an indicator that currencyOptions should not be in a Controller, it might make more sense to add these as options on the CurrencyConvertForm.
<input type="number" min="1" step="any" />)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.
This review uses the Project Application Review Template.
Hope that's helpful.
Comment #34
ericpughComment #35
saraswathi ravikumar commentedHi ericpugh,
Thank you for reviewing the code. I have made the following changes.
All the coder issues have been fixed.
1. Since it is possible to control the role based permissions in block, I have removed my custom permissions file.
2. Not Replicated.
3. Form error have been translated.
4. Drupal Http Client has been removed in drupal 8. Am looking for other stable and best alternative for curl.
5. Block Dependency have been added.
Thanks,
Sarah.
Comment #36
saraswathi ravikumar commentedComment #37
ericpughGreat Sarah,
To reproduce the error in #2, go to yoursite.co/currency_convert and then check your dblogs.
I was suggesting moving the currencyOptions to the form (rather than the Controller.)
For example, you'd add a method like this to /src/Form/CurrencyConvertForm.php
Then you'd update the form options like this:
This would allow you to completely remove the currency_convert.routing.yml and src/Controller/CurrencyConvertContorller.php (which doesn't seem to do anything else other than provide these select options.
Comment #38
saraswathi ravikumar commentedHi ericpugh,
Thank you for pointing out, I have moved the currency options to form and removed the controller and routing.
I have also used httpClient instead of curl to fetch the data.
Anything else to be fixed?
Thanks,
Sarah
Comment #39
naveenvalecha#28, that's fine.if you'll rename it now you will get to know about the feedback on the renamed code.
Quick review :
Please take a review bonus to get your application review soon.
Comment #40
hesnvabr commentedGit default branch is not set.
Steps to set Default branch:-
1) Edit your project
2) Click the "Default branch" tab
3) Select the desired branch
4) Click Save
In CurrencyConvertController.php file some minor errors in code like semicolon error etc.
Comment #41
saraswathi ravikumar commentedHi,
1. I have removed the controller and move the logic to service/
2. As am using curl to init. i have used hook_requirements.
5. I have created a new service for getting options and to retrieve the data.
6. As you suggested i have used single quotes for currency options.
7. Translation have added to submit button.
8. Number field have been replaced for text field.
Thanks,
Saraswathi.
Comment #42
saraswathi ravikumar commentedComment #43
arun ak commentedHi
In your comment #38 you have mentioned that you are using httpClient instead of curl to fetch the data. But still in you can see
Please check you have committed your code in to repo properly.
Thanks,
ARUN AK
Comment #44
saraswathi ravikumar commentedHi Arun,
I have used curl instead of Http client due to some issues again.
Thanks,
Sarah
Comment #45
jack_ry commentedHi Sarah,
Here are my suggestions,
In your currency convert form.php file(line no. 36), you have used number for #type. So instead of using #maxlength which is for textfield try #max. Also if you are setting the max. value to be max i don't understand the point of mentioning it explicitly. Since it's a number, please set #min to 0, because currently it allows negative value conversion. Make the currency field mandatory, thereby preventing an empty submission.
Comment #46
adam.weingarten commentedHey Sarah,
Reviewed the code. Great start! Have some concrete feedback:
http://cgit.drupalcode.org/sandbox-sarahravikumar-2686979/tree/src/Curre...
You have a catch statement for then the API call fails. However, you aren’t doing anything there. You can respond to the API failure by logging the error and potentially returning some sort of message to the end user that something went wrong.
Additionally you might want to add a check for rate limits: https://developer.yahoo.com/search/rate.html
http://cgit.drupalcode.org/sandbox-sarahravikumar-2686979/tree/src/Form/...
Ideally you should be using dependency injection here. Instead of using the global service container.
http://cgit.drupalcode.org/sandbox-sarahravikumar-2686979/tree/src/Form/...
Need to add some sort of form validation here.
http://cgit.drupalcode.org/sandbox-sarahravikumar-2686979/tree/src/Plugi...
Need to have meaningful note. “Provides my custom block” is a little generic.
Highly recommend using guzzle. It's a bit more standard. It's there out of the box with core and you can remove you hook requirements!
http://cgit.drupalcode.org/sandbox-sarahravikumar-2686979/tree/src/Curre...
Skimming the code there are some outstanding drupal coding standard issues:
FILE: ...ten/client-repos/wfmd8/currency_convert/currency_convert.install
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...en/client-repos/wfmd8/currency_convert/src/CurrencyConverter.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
2 | ERROR | [x] Namespaced classes, interfaces and traits should
| | not begin with a file doc comment
18 | ERROR | [x] Whitespace found at end of line
161 | ERROR | [x] Expected 1 blank line after function; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...nt-repos/wfmd8/currency_convert/src/Form/CurrencyConvertForm.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
FILE: ...wfmd8/currency_convert/src/Plugin/Block/CurrencyConvertBlock.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
1 | ERROR | [x] The PHP open tag must be followed by exactly one
| | blank line
2 | ERROR | [x] There must be one blank line after the namespace
| | declaration
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Comment #47
cbccharlie commentedHi sarah,
What problems do you have with httpclient? I've done a quick test changing curl by httpclient and I don't see any errors.
On the other hand, I think an interesting improvement would be that the form was with ajax. What do you think?
Comment #48
deepanker_bhalla commentedHi sarah ravikumar,
Kindly see the automated review of your project as its showing some errors and warnings. Meanwhile, i am using your project and will let you know if found any errors.
Link: https://pareview.sh/node/1580
Comment #49
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.