Closed (fixed)
Project:
Drupal.org security advisory coverage applications
Component:
module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
16 Mar 2023 at 04:57 UTC
Updated:
24 Apr 2023 at 03:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
vishal.kadamThank you for applying! Reviewers will review the project files, describing what needs to be changed.
Please read Review process for security advisory coverage: What to expect for more details and Security advisory coverage application checklist to understand what reviewers look for. Tips for ensuring a smooth review gives some hints for a smoother review.
To reviewers: Please read How to review security advisory coverage applications, What to cover in an application review, and Drupal.org security advisory coverage application workflow.
While this application is open, only the user who opened the application can make commits to the project used for the application.
Reviewers only describe what needs to be changed; they don't provide patches to fix what reported in a review.
Comment #3
vishal.kadamComment #4
vishal.kadam1. Fix phpcs issues. You can use the PHPCS tool for checking and resolving issues.
2. FILE: tmgmt_wordsonline.info.yml
Remove these lines. It will be added automatically by the packaging script.
core_version_requirement: ^8 || ^9 || ^10Drupal Core versions before 8.7.7 do not recognize the core_version_requirement: key.
3.
mainand1.0.0are wrong branch names, as branch names end with the literal .x. That branch needs to be removed.4. README.md file is empty. Please take a moment to make your README.md follow the guidelines.
Comment #5
luannguyen commentedThanks . I will fix it.
Comment #6
avpadernoComment #7
rassoni commentedphp -d memory_limit=4G vendor/bin/phpstan analyse modules/contrib/wordsonline_connectorPHPSTAN issues
Comment #8
rassoni commentedComment #9
avpaderno(The branch name is 1.0.x, not 1.0.0.)
Comment #10
luannguyen commentedComment #11
luannguyen commentedthe reported has been fixed
Comment #12
vishal.kadamThere are PHPCS issues.
Comment #13
luannguyen commentedThe reported has been fixed.
Do I need to fix the warning?
Comment #14
vishal.kadamYes, PHPCS warnings also need to fix.
Comment #15
luannguyen commentedthe reported has been fixed
Comment #16
vishal.kadam@luannguyen
I have reviewed the changes, and they look fine to me.
Let’s wait for other reviewers to take a look and if everything goes fine, you will get the role.
Thanks
Comment #17
luannguyen commentedThanks for your feedback, Vishal.kadam.
Do you know how long we need to wait?
Thanks.
Hello Rassoni,
Please help to review again.
Thanks
Comment #18
rassoni commented@luannguyen : I have tested on 1.0.x branch. Please find the text file for PHPSTAN issues.
Command run :
php -d memory_limit=4G ../../vendor/bin/phpstan analyse wordsonline_connectorComment #19
avpadernoSince the project machine name (its short name as indicated in https://www.drupal.org/node/3345120/edit) is wordsonline_connector the module must contain the wordsonline_connector.module, wordsonline_connector.info.yml, wordsonline_connector.install, wordsonline_connector.libraries, wordsonline_connector.links.menu.yml, wordsonline_connector.routing.yml, and wordsonline_connector.services files. All the functions (not the methods) implemented by the module must have a name starting with wordsonline_connector_. The namespaces used by the modules nees to start with
Drupal\wordsonline_connector\.The project machine name cannot be changed anymore; those files, all the functions, and the namespaces must be renamed.
src/Controller/OrderController.php
The parent class already implements that interface; there is not need to implement it again.
There is no need to document the parameters, since the documentation comment is already using
{@inheritdoc}.Controllers need to use injected dependencies, even for dependencies that are used from a single line in all the controller code.
That is not how links are added to a translatable string. Links are added directly to the literal strings passed to
t()or$this->t().With the current code, links are sanitized twice, which means that
<a href="link">Link title</a>would be changed to<a href="link">Link title<a>.Any link added to translatable strings must be added through placeholders. that is also valid for email links.
src/Entity/WOFile.php
The short description says does not describe the purpose of the class. It is also wrong as a class is not a file.
A Drupal entity implements at least an entity interface; differently, it is not a Drupal entity, and it should not use the namespace entities use. Entity classes also use annotations, which does not happen in this and other classes contained in the src/Entity directory.
src/Form/OrderConfirmForm.php
That property is already defined from the parent class.
There is no need to use a
FormattableMarkupinstance, since the string passed to the class constructor does not contain placeholders. Then,#markupaccepts also a string.Strings passed to the messenger must be translatable.
Comment #20
luannguyen commentedHi Rassoni,
I setup phpstan by follow steps in https://www.drupal.org/docs/develop/development-tools/phpstan/getting-st... with the phpstan.neon file config:
parameters:
level: 0
paths:
- wordsonline_connector/src
But the validation result is not same your report. I attached my report here.
Can you please help check it or tell me how to config phpstan to get same your report?
Thanks and Best Regard,
Luan
Comment #21
luannguyen commentedHello Rassoni,
I checked your validation result file. Then I noticed that there are some reported errors related to tmgmt seem incorrect.
Access to constant STATE_ACTIVE on an unknown class Drupal\tmgmt\JobInterface.
Access to constant STATE_CONTINUOUS on an unknown class Drupal\tmgmt\JobInterface.
You can check JobInterface file on git.
https://git.drupalcode.org/project/tmgmt/-/blob/8.x-1.x/src/JobInterface...
Call to static method load() on an unknown class Drupal\tmgmt\Entity\Job.
Static method load is exists on class Drupal\tmgmt\Entity\Job because it is inherited from class ContentEntityInterface through interface JobInterface.
Parameter $job of method
Drupal\tmgmt_wordsonline\Controller\OrderController::importTranslation() has invalid type Drupal\tmgmt\JobInterface.
Because Drupal\tmgmt\Entity\Job is inherited from Drupal\tmgmt\JobInterface , this should not be an error.
\Drupal calls should be avoided in classes, use dependency injection
instead
Line 651,681,704,715,726
I can't find these error.
https://git.drupalcode.org/project/wordsonline_connector/-/blob/1.0.x/sr...
Please check and feedback me on this.
Thanks and Best Regards.
Luan
Comment #22
rassoni commented@luannguyen Yes, I have not passed any level on command the default level is 0.
If you passing level 0 then only
You can refer this document for level https://phpstan.org/user-guide/rule-levels
Comment #23
rassoni commented@luannguyen : As per #21 comment.
tmgmtissues if we are avoiding then below issue needs to fix related toDrupal calls.Comment #24
luannguyen commented@Rassoni,
I checked your attached file but It's not same #23 . Are you latest report file incorrect?
Comment #25
avpadernoPHPStan gives false positives when it is not correctly set or all the dependencies are not downloaded.
I would avoid using PHPStan in these applications, especially when the report is not first checked. (A reviewer should also verify what reported by PHP_CodeSniffer before posting its reports on an application.)
Comment #26
avpadernoDrupal\tmgmt_wordsonline\Common\ZipHandleis not a service, a controller, nor a form builder class; this means it cannot use dependency injection. Saying that all the classes must use dependency injection is not correct; in fact, a class that implements only static method cannot use dependency injection.(That is why I say that what a tool reports must be first verified. We do not want to force changes that are not necessary or, worse, not correct.)
Comment #27
rassoni commentedThank you @apaderno for more clarity regarding issue for phpstan.
@luannguyen: Yes, #18 and #20 reports are different. As mention on #23 file PHPSTAN issues. Running command is generating same issues.
I am following below steps to regenerate the phpstan issues.
php -d memory_limit=4G vendor/bin/phpstan analyse modules/contrib/wordsonline_connectorif you check #18 and #23 files all PHPSTAN issues are already verified.
Major issues are related to
tmgmtas per comment #21 we can go forward.Call to static method load() on an unknown class Drupal\tmgmt\Entity\Job.
Static method load is exists on class Drupal\tmgmt\Entity\Job because it is inherited from class ContentEntityInterface through interface JobInterface.
Parameter $job of method
Drupal\tmgmt_wordsonline\Controller\OrderController::importTranslation() has invalid type Drupal\tmgmt\JobInterface.
Because Drupal\tmgmt\Entity\Job is inherited from Drupal\tmgmt\JobInterface , this should not be an error.
\Drupal calls should be avoided in classes, use dependency injection
instead
All issues are already answered and regarding #23 issues already covered by #26 comments.
Major if checking #18 and #23 files major issues are already rectified and answered.
Please let me know if we need to check any other way to generate PHPSTAN file like #20
Comment #28
luannguyen commented@apaderno,@Rassoni
Yes, I check and see PHPStan gives false positives and the phpstan report is not trustable.
We already passed PHP_CodeSniffer validated by vishal.kadam reviewer. He confirmed on #16
Can we skip(don't fix) phpstan report by Rassoni?
We will fix issues reported in Apaderno on #19, then request review again?
Thanks,
Luan
Comment #29
avpaderno@luannguyen Yes, let us do that.
Comment #30
luannguyen commented@apaderno,
I fixed issues in your report except below one:
Because $messenger variable is used in multiple functions (buildForm, confirmOrder, setCancel), but confirmOrder and setCancel functions only receive variable from buildForm function through FormStateInterface.
I don't have any solution to fix this now.
Do you have any suggestion to help me on this?
Thanks
Luan
Comment #31
avpadernoDo not define the
$messengerproperty in your class. On the constructor, just call$this->setMessenger($messenger); when you need the messenger service, call$this->messenger().As a side note, on
create()there is no need to use local variables for the services. Given how the code is formatted, code lines will not get longer than 80 characters.Comment #32
luannguyen commented@apaderno
I fixed all your report issues following your suggestion.
Please help review it.
I appreciate your soon feedback, so I have time to fix it any remaining issues as today is my deadline on this task
Thanks and Best Regards.
Luan
Comment #33
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the Slack #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 reviewers.
Comment #34
avpaderno(I forgot to change status.)
Comment #35
ngoc.dang commentedDear Apadermo and Review team,
On behalf of Jonckers team, I am writing to express our sincere gratitude to you and reviewer team for your hard work and dedication in helping us pass the Drupal module security certification. Your expertise and attention to detail were invaluable in ensuring that our module met the standards of security.
We are grateful for your guidance throughout the certification process. Your feedback and suggestions helped us identify and address potential vulnerabilities in our module, which has made it more secure and reliable.
We appreciate the time and effort that you and reviewer team put into this project. Your professionalism and commitment to excellence are truly commendable. We look forward to working with you again in the future.
Thank you once again for your outstanding work.
Sincerely,
Jonckers VN Developer Team Lead
Ngoc
Comment #36
ngoc.dang commented