About Spam Score
Spam Score provides local, explainable spam detection for Drupal forms.
It evaluates form submissions using configurable rules, calculates a numeric spam score, and records the individual signals that contributed to the result. Administrators can start in log-only mode to evaluate scoring before enabling enforcement.
Core functionality includes:
- Drupal core Contact form integration
- Configurable scoring rules and thresholds
- Duplicate and flood detection
- Configurable allowlists and blocklists
- Administrative reporting and audit information
- Optional email outcome tracking
- Drush commands for diagnostics and maintenance
- Extension hooks for custom integrations
The core scoring process can operate entirely within Drupal and does not require an external spam-classification API or subscription.
Differences from similar projects
Honeypot: Honeypot primarily focuses on automated submissions using hidden fields and timing behavior. Spam Score instead evaluates multiple content and submission signals and produces an explainable numeric score. The two approaches can be used together.
Akismet, CleanTalk, KireiFilter, and similar hosted services: These services use external spam-classification infrastructure. Spam Score provides a local scoring engine and does not require submitted form content to be sent to an external classification service.
The goal of Spam Score is to provide a reusable local spam-scoring and auditing framework with administrator-controlled rules and extensibility for site-specific requirements.
Drupal development practices
The 1.0.x branch uses Drupal core APIs and dependency injection and currently passes the Drupal.org GitLab CI pipeline.
CI validation includes:
- PHPCS / Drupal coding standards
- PHPStan static analysis
- CSpell
- PHPUnit
Automated test coverage includes:
- Unit tests for scoring behavior
- Kernel tests for configuration, storage, mail-state persistence, and update/migration behavior
- Functional tests for Contact form integration and enforcement
- Functional tests for administrative pages, permissions, and configuration
Maintainer
I am the project maintainer and have personally committed the code being submitted for review.
I would appreciate a review for the vetted maintainer role and permission to opt eligible contributed projects into Drupal Security Advisory coverage.
Manual reviews of other projects
https://www.drupal.org/project/projectapplications/issues/3608209#commen...
https://www.drupal.org/project/projectapplications/issues/3613219#commen...
https://www.drupal.org/project/projectapplications/issues/3448428#commen...
Comments
Comment #2
binquanwang commentedComment #3
binquanwang commentedComment #4
vishal.kadamComment #5
vishal.kadamComment #6
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 #7
vishal.kadam1. FILE: README.md
The README file is missing the required sections - Requirements and Configuration.
2. FILE: spam_score.module
A module that aims to be compatible with Drupal 10 and Drupal 11 is expected to implement hooks as class methods as described in Support for object oriented hook implementations using autowired services.
3. FILE: src/Form/SettingsForm.php
With Drupal 10 and Drupal 11, there is no longer need to use #default_value for each form element, when the parent class is ConfigFormBase: It is sufficient to use #config_target, as in the following code.
Using that code, it is no longer needed to save the configuration values in the form submission handler: The parent class will take care of that.
4. FILE: src/Plugin/Mail/SpamScoreMail.php
FILE: src/Plugin/QueueWorker/MailRetryWorker.php
Projects that are compatible with Drupal 10 or higher versions should use attributes instead of annotations.
Comment #8
binquanwang commentedThank you for the review. I addressed the four reported items in the current 1.0.x branch in #7:
Added explicit Requirements and Configuration sections to README.md.
Converted module hooks to object-oriented #[Hook] implementations with injected services, retaining #[LegacyHook] compatibility shims for supported older Drupal versions.
Converted SettingsForm to use #config_target, including ConfigTarget transformations for typed numeric/boolean values and newline-delimited list fields. The custom configuration-saving submitForm() implementation was removed.
Converted the Mail and QueueWorker plugins from annotations to PHP attributes.
The changes have been pushed to 1.0.x and the Drupal.org GitLab CI pipeline is passing.
Comment #9
binquanwang commentedComment #10
avpadernoComment #11
avpadernoComment #12
avpadernosrc/Controller/ReportController.php
Since that class does not use methods from the parent class, or it uses a single method from the parent class, it does not need to use
ControllerBaseas parent class.Controllers do not need to have a parent class; as long as they implement
\Drupal\Core\DependencyInjection\ContainerInjectionInterface, they are fine.There is no need to use a
\Symfony\Component\HttpFoundation\RequestStackor a\Symfony\Component\HttpFoundation\Requestas class properties, since the\Symfony\Component\HttpFoundation\Requestobject is automatically passed to the page controller, if one of its parameters is correctly type-hinted. See Typehinted parameters.'protected_forms' => $this->t('Form IDs to score. A trailing * is a wildcard, e.g. contact_message_*_form.'),The given example does not show a string with a trailing asterisk, which would instead be contact_message_form_*.
Drupal core does not use a conversion function for integer configuration values. I take that means it is not necessary.
The same is true for configuration values that expect a floating point value.
Comment #13
binquanwang commentedRemoved ControllerBase/RequestStack, simplified primitive #config_target mappings across the entire settings form, and corrected the wildcard wording in all affected locations.
The changes have been pushed to 1.0.x and the Drupal.org GitLab CI pipeline is passing.
Thanks!