Neon CRM Events integrates Drupal with the Neon CRM API v2 so editors can pick a Neon CRM event from their account and sync its data into a Drupal node with a single click. Every event field — name, summary, description, dates and times, timezone, location, fee, registration URL, thumbnail, and publish/inactive status — is stored as a real Drupal field, so site builders can list and filter events using Views, build calendar feeds, or theme them however they like. Fields remain fully editable after syncing.
Project link
https://www.drupal.org/project/neon_crm_events
Comments
Comment #2
mookum commentedHi, thanks for submitting this module
I went through the code, plus ran phpcs/phpstan/phpunit and wanted to share what I found so you can get this over the line.
Nothing here is scary, and most of it is quick to fix.
Two things below I'd consider must-fix, the rest is smaller polish.
1. A permission that isn't actually enforced (please fix)
You've defined a `sync neon crm events` permission, but it's never checked in the code not in the submit handler, not on the route.
Right now anyone who can edit one of these nodes can trigger a sync, whether or not they have that permission.
I'm guessing this was meant to gate the "Sync from Neon" button could you add a check for it in `syncSubmit()` (or drop the permission if it's not needed)?
2. The API key is stored/shown as plain text (please fix)
In the settings form, the API key field uses a regular textfield, so it prints back out in plain text every time someone opens the settings page, and it sits unmasked in any config export or backup.
Could you switch that field to `#type: password`? Long term, pointing people at the `key` module for storing this kind of credential would be even nicer, but the password field alone solves the immediate exposure.
3. Small coding standards cleanup
phpcs flagged 10 spots in `NeonCrmEventsHooks.php` where `t()` is called directly instead of `$this->t()` all inside the `help()` and `formNodeFormAlter()` methods. Adding `use StringTranslationTrait` to the class and swapping those calls over will clear it up. (The `t()` calls in the static submit/ajax methods are fine as they are you can't use `$this->t()` there anyway, and phpcs correctly leaves those alone.)
4. A few phpstan notes in `NeonCrmApi.php`
- Line 179: the `is_array($data)` check is redundant at that point you've already confirmed it's an array a few lines up.
- Line 282: `isset($m[3])` will always be true there, since the regex's AM/PM group is required and PCRE fills in the earlier optional group once a later one matches. `(int) $m[3]` on its own is enough.
- Line 366: `filter_default_format()` is deprecated as of 11.4 and goes away in 13.0 worth switching to the `FilterFormatRepositoryInterface` service now rather than later.
5. README is a little out of date
The "File structure" section still mentions a `.install` file, a `Service/` folder, and a `templates/` folder that aren't there anymore (the module's moved to `src/Hook/` and config-based install). Just needs a quick pass to match what's actually in the repo.
6. No tests yet
Not a blocker for the application, but a couple of unit tests around `combineDateTime()` and `extractEventId()` would be a nice addition given they're doing regex parsing.
Let me know if anything above is unclear or you'd like a hand with any of it!
Comment #3
mookum commentedComment #4
avpadernoThank you for applying!
Before giving links helpful to understand how the review process works, what to expect from a review, and what to do to avoid a review takes more time than needed, I would like to thank all the reviewers for the work they do.
These applications are volunters-driven, which also means it is not possible to predict when an application will be marked fixed and the applicant will get the permission to opt projects into security advisory policy. While we aim to make an application as quick as possible, it is also important for us that more people review the project used for an application. In this way, we make sure applications do not miss some important points that should be instead reported.
Applications are not meant to be complete debugging sessions that eliminate every existing bug, though. I apologize if sometimes applications seem to go into too-detailed reviews.
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.
The important notes are the following.
Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
To the reviewers
Please read How to review security advisory coverage applications, Application workflow, What to cover in an application review, and Tools to use for reviews.
The important notes are the following.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues.
Comment #5
vishal.kadamFILE: src/NeonCrmApi.php
Modules which are compatible with Drupal 10 and higher versions are expected to use constructor property promotion.
Comment #6
avpadernoI am not sure that using a password form element for a key value is the correct way to go, for two reasons:
To avoid somebody who gains access to an account with elevated permissions changes the key, the solution could be doing like Drupal core does some values: retrieve those values using the
Drupal\Core\Site\Settingsclass.Comment #7
dsdeiz commentedHello
I've made updates on the module for https://www.drupal.org/project/projectapplications/issues/3618312#commen.... For the implementation of the key, I had it use the
"#type" => "password". But it's purpose was to keep the key hidden. It's only change when you put a new value on the element. Otherwise, it uses the same key. The key is still stored as plain text in the configuration though.Comment #8
avpadernoA password form element is thought for a value (the password) that is changed by a single person. Even in that case, to change a password, the previous value must be entered.
That does work well for a value that can be changed by two or more people. In that case, how can a person visiting the form know the value has been already changed by another person? Should that person try changing the key?
Comment #9
dsdeiz commentedYeah, there is a description on the API key element that says a key has already been saved. I updated it to add to put more emphasis - https://monosnap.ai/direct/aBF5rsYafNsIx8gIAcKTsDvRiCakv7.
Comment #10
avpadernoStill, how can a person who has access to that form know the API key has been already updated from somebody else, in a different moment?
Comment #11
dsdeiz commentedI have updated the module and adjusted the description to include when and who changed the keys:
There's also an option to always keep it overridden from the settings file through
$config['neon_crm_events.settings']['api_key'] = 'your-neon-api-key';. Similar to usingSettings::get().