Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Node Access Rebuild Guard

No security coverage Under active development

Node Access Rebuild Guard stops a node access rebuild from leaving listings cached empty. Output that depends on the grants is not cached during a rebuild, and stale caches are cleared when it ends.

Status: Stable. 1.0.0 is the first release.

Why

On a site with a module that controls content access through node grants, rebuilding the content access permissions first deletes every grant and then writes them back, node by node. A listing rendered in between comes out empty or incomplete, and a node page is denied. Drupal caches that output, and nothing invalidates it when the rebuild ends, because grants are a cache context, not a cache tag. Visitors keep seeing empty listings until someone clears every cache, which looks like lost content. Drupal 7 cleared the caches at the end of every rebuild; since Drupal 8 nothing does.

Features

While a rebuild runs

  • Output that depends on content access is kept out of the internal page cache, the dynamic page cache, the render cache (Views output included) and the Views results cache, and is sent with Cache-Control: no-cache so proxies and CDNs do not store it either.
  • It is caught where it starts: every query tagged node_access, every single-node access check and every view filtered by content access. Pages cached before the rebuild are still served, so visitors see the old, complete content.
  • Every rebuild is watched, batch or immediate, however it was started: the Rebuild permissions form, Drush, an update hook, code calling core's rebuild service, or a module that rebuilds on install. Overlapping rebuilds share one window, which closes when the last of them ends.
  • Optional: on a busy site, reuse such output for up to 300 seconds instead of rendering it for every request (allowed only with the widest invalidation scope, which removes it when the rebuild ends); and, for a rebuild that withdraws access, invalidate the caches as it starts as well.

When a rebuild ends

  • Whether it completed or failed, the caches that could hold the old or the partial state are invalidated: the node list tags, cached 403 and 404 pages, every enabled view filtered by content access and any tags you add. By default every rendered page and every cached response is invalidated too, JSON:API and REST included; two narrower scopes are available.
  • When a rebuild is shorter than the longest request time (120 seconds by default), the listing tags are invalidated a second time once that has passed, for requests that were already running when it began.
  • With Search API installed, the node and comment items of every enabled index that uses the Content access processor are queued for reindexing, unless you switch it off.

Rebuilds that die, and gaps in core

  • A rebuild that reports no progress for longer than the stale limit (600 seconds by default) is closed as abandoned, so the site is never left uncacheable; an immediate rebuild ended by a fatal error or a time limit is closed as failed. Either way the caches are invalidated and core's needs rebuild flag is set. A rebuild known to have died can be released at once, from the report or with Drush.
  • Optional repair on cron, off by default and only when cron runs from the command line: the permissions are rebuilt when the content access records are missing altogether, or when the last watched rebuild did not complete and core still flags a rebuild. At most three attempts, an hour apart.
  • When a grant module is uninstalled, core 11.4 neither rebuilds nor flags a rebuild; the module flags one when other grant modules remain, rebuilds at once when none do, and invalidates the cache tags. When a batch rebuild is requested a second time in one process, core deletes every grant and queues nothing to restore them; the module rebuilds them at once.

Reporting

  • A report of the last 50 rebuilds: when each started, how long it took, how it was started, how it ended, how many responses it kept out of the caches and what was invalidated.
  • Status report entries: a rebuild running or stopped responding, how the last one ended, and an error when grant modules are installed and published content exists but there are no content access records at all.
  • Drush: node-access-rebuild-guard:status as a table or JSON, with --fail-on-problems for deploy scripts; node-access-rebuild-guard:rebuild with --if-needed and --batch; and node-access-rebuild-guard:release.
  • For other code: events when a rebuild starts and ends, where a subscriber can add cache tags, purge an external cache or reindex another search backend, and a service that gives the same protection to code that rewrites grants itself.

Requirements

  • Drupal 11.4 or later, or Drupal 12. The module decorates Drupal\node\NodeAccessRebuild, the rebuild service core added in 11.4.0.
  • PHP 8.3 or later.
  • Core's Node module. The module is useful only with a module that controls content access through hook_node_grants(), such as Domain Access or Content Access; on other sites rebuilds are recorded and nothing is invalidated.
  • Optional: Search API, for reindexing. Drush 13.7 or later, or Drush 14, for the commands: Composer refuses to install the module next to an older Drush.
  • Any database Drupal supports (MySQL or MariaDB, PostgreSQL, SQLite).

Installation

Install with Composer, then enable the module:

composer require drupal/node_access_rebuild_guard
drush en node_access_rebuild_guard

Every rebuild is guarded from then on, with no configuration needed.

Configuration and permissions

Settings are at Administration » Configuration » System » Node access rebuild guard (/admin/config/system/node-access-rebuild-guard): which caches to invalidate when a rebuild ends, additional cache tags, Search API reindexing, reusing output during a rebuild, invalidating as a rebuild starts, the stale limit, the longest request time and the repair on cron. The report is at Reports » Content access rebuilds (/admin/reports/node-access-rebuilds), for users with core's View site reports permission.

  • Administer Node Access Rebuild Guard (restricted): change what is invalidated after a content access rebuild and the other settings, and release a rebuild that has stopped responding, which ends cache protection while grants may still be missing.

What it does not cover

It does not change who can see what. While a rebuild runs, visitors see what the half-written grants allow at that moment; the module only keeps that from being cached. A CDN rule that caches pages for a fixed time, whatever Cache-Control says, is not protected during a rebuild, and a CDN that is not purged by cache tag keeps pages until its own lifetime ends. Search backends other than Search API are not reindexed; a subscriber to the rebuild-finished event can do it.

Similar projects

Checked on drupal.org in November 2026.

  • Node Access Rebuild Progressive rebuilds node access in chunks over cron instead of all at once. Choose it when a rebuild is too large to run in one go. It addresses a different problem, and the two can be installed together: this module guards every rebuild that goes through core's rebuild service.
  • We found no core issue or contributed module that fixes empty listings cached during a rebuild.

Support and maintenance

Report bugs and ask for features in the issue queue. Each release has notes describing what changed.

This project is not covered by Drupal's security advisory policy. Until it is, security issues are handled in the public issue queue and fixed in ordinary releases.

A read-only mirror is on GitHub at DanePete/drupal-node-access-rebuild-guard; development and issues stay on drupal.org.

Maintainer

Created and maintained by deadnorth (Dead North).

Drupal 11 · not 10 PHP >=8.3

Ask your assistant about Node Access Rebuild Guard

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • node Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Nov 2026
Latest release
1 hour ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
1.0.0 Stable 11 PHP >=8.3 Nov 27, 2026