Install
Works with Drupal: ^10.3 || ^11 || ^12Using Composer to manage Drupal site dependencies
Alternative installation files
Download tar.gz
1.07 MB
MD5: 0565ffa7696c25d465f2e082b7875cf6
SHA-1: bdefe8c3ed9b9d29fe764cd767ecd4ce6a893f94
SHA-256: a79ec6e4d1e2a6685d7b8ea8cd9855974c9d0c594d726382f0fdf009bdc1b2fd
Download zip
1.3 MB
MD5: 983866cf1c7d15c2d9e4351cc3c60208
SHA-1: 4b14ab237a9a6bb695757a0022189e79adc25200
SHA-256: 866649cee2bd79392ed95c70311aa4f8331f9c072b7d0c5020f43457d4a4c352
Release notes
This release adds two submodules, lets every site acknowledge its intentional choices without losing points, removes a large number of false positives, hardens security and requires Drupal 10.3 or later.
New submodules
- audit_health_check:
/audit/healthendpoint for uptime monitors and load balancers, with minimum scores and database, cron, files and cache checks, always protected by a secret #3620512: Integrate health check functionality. - audit_config_checks: scores the environment against declared configuration values and modules, with a summary block and a Navigation bar indicator #3606303: Add a summary block / indicator for the frontend in production.
Acknowledging intentional choices
- Inline
audit-ignore,audit-ignore-next-lineandaudit-ignore-filemarkers to acknowledge a finding in code #3626576: Add an inline audit-ignore marker so intentional findings can be acknowledged in code without excluding the whole file; supported by the Security, Performance, Cache, Twig and Complexity audits, also as the last line of a docblock. - Static rule overrides per path pattern: disable a rule or change its severity (
rule_overrides) #3626580: Allow disabling a static rule or changing its severity per path pattern in audit.settings. - Accept configuration overridden only in a development environment (
accept_environment_overrides). - New per-audit settings: allowed development modules, Watchdog ignore patterns, Entity bundles allowed to be empty, Fields allowed to be hidden, Views excluded from the access checks (
media_libraryby default) #3630448: Core media_library widget displays are always reported as ANON_ACCESS_ADMIN; add a built-in default and an access_excluded_views setting, Images responsive image requirement, and the complete set of SEO ignore settings. - Acknowledged findings stay in the report as information and no longer count in scores, summaries or
--fail-on.
Compatibility
- The module and every submodule now require Drupal 10.3 or later (Drupal 10.3+, 11 and 12).
- Tested and analyzed on Drupal 10, 11 and 12 in GitLab CI #3626546: Test and analyze the module on Drupal 10, 11 and 12 in GitLab CI and fix what fails.
- Drush commands converted to Symfony Console commands for Drush 14 #3626564: Convert the Drush commands to Symfony Console commands for Drush 14.
- Updates analyzer migrated to UpdateManagerInterface ahead of Drupal 13 #3626565: Migrate the updates analyzer to UpdateManagerInterface before Drupal 13.
- PHP version support for Drupal 11.4 in the Status audit.
Security hardening
- The DruScan API TLS certificate is verified, API keys are never shown and the API URL is only accepted from settings.php; full HTML error pages from the API are no longer logged.
- The "View audit results" permission is restricted to trusted roles.
- The security headers self-request is only sent to a trusted host; scan directories must stay inside the project.
- Site and feed values are escaped in the reports, secret configuration values are hidden in the config checks report and inaccessible content titles are not shown in the Entity audit.
- PHPCS and PHPStan working files are kept in a private temporary directory; the PHPCS and PHPCBF binary paths are only read from settings.php.
Fewer false positives
- Performance: debug functions inside comments #3609853: Performance audit checks commented out code (false positives), Twig and PHP comments #3626581: PerformanceAnalyzer still flags debug calls inside Twig {# #} comments and PHP '#' comments, and ignores code after '//' inside strings, the loop's own iterable #3626586: isInsideLoop() reports the loop's own iterable expression as running inside the loop (N1_REFERENCED_ENTITIES, N1_LOAD_MULTIPLE on the foreach line),
max-ageanywhere in#cache#3626589: CACHE_MAX_AGE_ZERO is only detected when 'max-age' is the first key of the #cache array, config entity storages in LOAD_MULTIPLE_ALL #3630468: LOAD_MULTIPLE_ALL flags loadMultiple() on config entity storages; resolve the entity type and skip config entity types, count and single-ID queries #3630471: QUERY_NO_RANGE / DB_SELECT_NO_LIMIT flag count queries and queries restricted to one entity ID, and can take the range() of the next query, configuration saves in SAVE_IN_LOOP #3630472: SAVE_IN_LOOP reports configuration object saves ($config->save()) as entity saves, loop-dependent service IDs #3630473: STATIC_SERVICE_IN_LOOP flags \Drupal::service() calls whose service ID depends on the loop and cannot be moved out of it, LOAD_BY_PROPERTIES only for entity types with query access rules #3630479: LOAD_BY_PROPERTIES warns about bypassing access on sites where entity queries have no access rules; only report entity types with active query access, static markup in MARKUP_WITHOUT_CACHE #3630484: MARKUP_WITHOUT_CACHE flags MarkupInterface value objects, static strings and classes that use the cacheable metadata API, max-age 0 on administration-only controllers #3630490: CACHE_MAX_AGE_ZERO is an error in controllers that only serve administration pages, where max-age 0 is often the correct cacheability, and settings coming from settings.php overrides are now shown as such #3630486: Site-level performance findings should say when a value comes from a settings.php override instead of the stored configuration. - Security static scan: trailing and inline comments #3630434: Security static scanner reports code inside trailing // comments and /* */ comments because it only skips lines that start with a comment marker,
t()placeholders only when they receive markup #3630459: t_function_xss flags every t() call with an '@' placeholder; '@' is the placeholder that escapes its value, only unsanitizedMarkup::create()and raw input in#markup#3630461: render_array_markup_xss reports every variable assigned to '#markup' as an XSS error, but the renderer filters strings; only Markup::create() values and raw user input are risky,\Drupal::database()as an entity access review notice #3630463: direct_db_connection matches \Drupal::database() inside strings and reports it as a warning with a misleading message; it is a review hint about entity access, only the SQL string in concatenated queries #3630464: concatenated_query flags concatenation in ->condition() and in placeholder values, which cannot inject, and misses interpolated or sprintf() SQL strings. - Views: admin view detection by path, exact view id and base table #3630438: ViewsAnalyzer::isAdminView() compares '/admin' against Views paths that have no leading slash, so admin pages are classified as frontend #3630439: isAdminView() view id prefix list matches frontend core views (content_recent, taxonomy_term) #3630440: ADMIN_BASE_TABLES turns every taxonomy term and user view into an admin view, producing ANON_ACCESS_ADMIN errors on frontend blocks such as who_s_new, host display access for attachments #3630445: Anonymous access checks of the Views analyzer ignore that an attachment display is only shown with the display it is attached to, effective route access, bundle and relationship-aware cache tag suggestions #3630449: CACHE_TAG_GENERIC suggests bundle cache tags for exposed and "not in" bundle filters, where the generic list tag is the correct one #3630453: CACHE_TAG_GENERIC recommendation ignores relationships: it must say which list tags to keep, and it is wrong when a relationship reaches the base entity type, Advanced Views Cache tags #3630450: Switching a view to Advanced Views Cache silences CACHE_TAG_GENERIC even when no cache tag was changed (false negative), and excluding the list tag without a bundle tag is not reported, no FIELDS_NON_TABLE on entity reference displays #3630457: FIELDS_NON_TABLE is reported on entity_reference displays, which can only use the fields-based entity_reference style and row.
- Twig: content rendered through included, embedded and extended templates #3606300: Add a flag (setting) to mark an audit "resolved", view mode machine names in template suggestions, scan directories relative to the project root.
- Cache, Security, Status, Modules, SEO, Images, Entity, Menu, URL, i18n and Watchdog audits: many false positives and wrong results fixed (image styles in use, test modules as duplicates, empty transactional bundles, module-shipped disabled links, redirects to fragments, core hreflang links, among others).
- Complexity:
.deploy.php,.post_update.php,.incand.profilefiles are treated as procedural for the service locator check.
Other improvements and fixes
- Complexity: the maintainability index now uses the real Halstead volume instead of counting lines; new default thresholds (warning below 40, error below 20) applied by an update to sites still on the old defaults.
- Duplication: Drupal PHP files (
.module,.install,.theme,.inc...) are scanned, and every exclude pattern is applied. - Database: reports field tables that no installed field uses #3623981: Entity health checks?; only this site's tables are listed, also with a table prefix.
- Views: ignored Search API rendering findings are acknowledged instead of still costing points.
- Performance: reads the primary user type from the right setting.
- A failed PHPCS or PHPStan run is reported instead of a perfect score; PHPStan uses each module's own configuration and stops dropping errors.
- Doubled finding counts fixed; status report scores decrease with every error and warning; report texts are translatable and no longer escaped twice.
- Lower memory and query usage in the URL, Entity and Cache audits; Search API availability cached for five minutes; analyzers run one at a time.
- Refined imageapi_optimize recommendation #3609852: Remove imageapi_optimize module suggestion.
- READMEs rewritten for the module and every submodule.