Content Completeness Index (CCI) calculates a completeness percentage for content based on whether configured fields have values. Site builders can enable it for each content type and assign a weight to each field. The score is the percentage of the total configured weight represented by fields that are filled.

The module stores scores per node revision in a custom table; it does not add a Drupal field type.
The core module currently supports nodes and requires Drupal 11 and PHP 8.2 or later. Its required Drupal dependency is Node. It has no external service or API integrations.

Site builders configure the index at Structure > Content types > [content type] > Completeness Index. They can choose which fields count and set their weights. The module provides a Drupal component for displaying the score in Twig, a floating form block that can show the current score and missing fields while editing, and an administrative batch form and Drush command for rebuilding stored scores. Rebuilds use per-bundle queues, which can be processed immediately, by cron, or manually.

Optional integrations are provided as separate submodules:

  • Content Completeness Index - Field Group integration requires Field Group and Simple Multistep. It groups missing fields according to configured field groups and supports multistep forms.
  • Content Completeness Index Conditional Validation requires Field Validation. It lets site builders set conditional field weights using Field Validation conditions; the first matching rule applies, and the configured static weight is used when no rule matches.

Project link

https://www.drupal.org/project/content_completeness_index

Comments

gilmar.lima created an issue. See original summary.

vishal.kadam’s picture

Issue summary: View changes
avpaderno’s picture

Thank 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.

  • If you have not done it yet, you should enable GitLab CI for the project and fix the PHP_CodeSniffer errors/warnings it reports.
  • For the time this application is open, only your commits are allowed.
  • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status will not be changed by this application; once this application is closed, you will be able to change the project status from Not covered to Opt into security advisory coverage. This is possible only 14 days after the project is created.

    Keep in mind that once the project is opted into security advisory coverage, only Security Team members may change coverage.
  • Only the person who created the application will get the permission to opt projects into security advisory coverage. No other person will get the same permission from the same application; that applies also to co-maintainers/maintainers of the project used for the application.
  • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

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.

  • It is preferable to wait for a project moderator before posting the first comment on newly created applications. Project moderators will do some preliminary checks that are necessary before any change on the project files is suggested.
  • For the tools to use for reviewing a project, see Tools to use for reviews.
  • It may be best to have the applicant fix things before further reviews and avoid doing a review when another review is pending.

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.

aftrix’s picture

I am not a vetted reviewer. This is a volunteer review, so please treat it as input rather than a decision on the application.

1. src/Component/ContentCompletenessComponent.php imports a class that is not in core

The file imports Drupal\Core\Render\Attribute\Component and applies #[Component(...)] to the class. I could not find that attribute in Drupal core. On 11.4.7 the namespace holds only two classes:

$ ls web/core/lib/Drupal/Core/Render/Attribute/
FormElement.php
RenderElement.php

PHPStan reports the same thing:

src/Component/ContentCompletenessComponent.php:13
Attribute class Drupal\Core\Render\Attribute\Component does not exist.

Single Directory Components are declared with a *.component.yml file rather than a PHP attribute, so I do not think this class is registering anything. Attributes are not resolved unless something reflects them, which is probably why it has not surfaced as an error at runtime. Worth deciding whether the class should become a real SDC, or be removed.

2. The preview route is reachable by anonymous users and does not validate the entity type

content_completeness_index.preview:
  path: '/content-completeness/preview/{entity_type}/{bundle}'
  requirements:
    _permission: 'access content'
  methods: [POST]

CompletenessPreviewController::preview() passes $entity_type and $bundle straight through to CompletenessIndexPreviewService::calculatePreview(), which calls $this->entityFieldManager->getFieldDefinitions($entity_type, $bundle). Neither value is validated first, so a request naming an entity type that does not exist will throw out of that call rather than return a controlled response.

Since access content is normally granted to the anonymous role, it is also worth deciding deliberately whether the field labels this returns should be readable by anyone, for any bundle.

3. PHP_CodeSniffer

$ phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,info,yml .
A TOTAL OF 7 ERRORS AND 9 WARNINGS WERE FOUND IN 10 FILES
PHPCBF CAN FIX 7 OF THESE SNIFF VIOLATIONS AUTOMATICALLY

Most of it is mechanical and phpcbf will fix it. The two that are not automatic are worth a look by hand:

  • src/Service/CompletenessIndexStorage.php:50, a \Drupal call inside a class where the service could be injected.
  • src/Hook/EntityHooks.php, five t() calls that could use StringTranslationTrait and $this->t().

4. Branch naming

The application is for 1.0.x, but the repository's default branch is master, and there is a main branch as well. The application checklist asks projects to avoid master. Setting 1.0.x as the default and removing the branches you are not using would make it clearer which branch is under review.

Nothing here looked like an exploitable security problem to me. Points 1 and 2 are the ones I would want to see addressed.

avpaderno’s picture

Status: Needs review » Needs work
vishal.kadam’s picture

1. FILE: README.md

The README file is missing the required section - Installation.

2. FILE: src/Plugin/Block/ContentCompletenessIndexFloatingFormBlock.php, src/Plugin/Block/ContentCompletenessIndexWprogressBlock.php, src/Plugin/QueueWorker/CompletenessRebuildQueueWorker.php

Projects that are compatible with Drupal 10 or higher versions should use attributes instead of annotations.