You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guard every write at the client, not only the ones that emit events.
Reviewing the branch for anything the last round missed turned up the same
gap a fourth time, in a place events never reach. Search records, facets
and index clearing call QuantClient directly and dispatch nothing, so the
subscriber never saw them. Clearing is the destructive one: on an
unrecognised host it wipes another client's entire search index.
Guarding those three call sites would have repeated the mistake, so the
decision moved into Drupal\quant\PublishGuard and both the subscriber and
the client consult it. The subscriber still runs first, and still stops
early enough to skip the render and search work; the client is the
backstop that covers a write method nobody has written yet.
Applied to the seven methods that change something — send, sendRedirect,
sendFile, unpublish, sendSearchRecords, clearSearchIndex, addFacets — and
deliberately not to ping, project, search or getUrlMeta, which are reads
and are how the settings form reports whether the connection works.
Verified against two domains on an unrecognised host: the three search
writes refused with zero requests reaching the API, while ping still
answers.
A refused write returns an empty array, which QuantApi::onOutput could not
survive: it read $res['attachments']['js'] straight into array_merge(),
which fatals on NULL. The guard makes that reachable, but the API was
always entitled to answer without attachments, so the keys are no longer
assumed.
Static analysis on the changed files also flagged a test constructing
QuantPurger with plugin arguments it has no constructor for, and an @var
where a @PARAM belonged in the tome batch.
94 unit and kernel tests, 39 regression cases, phpcs clean.
@@ -95,15 +96,13 @@ public function onOutput($event) {
95
96
// The call is cached per process, so this costs nothing after the first.
96
97
CliDomainContext::initialize();
97
98
98
-
if (!$this->hostIsUnknown($host)) {
99
+
if (!PublishGuard::refuses($host, $this->requestStack)) {
99
100
return;
100
101
}
101
102
102
-
\Drupal::logger('quant')->error('Refused to publish @path: the host @host matches no domain, so the Domain module fell back to the default and this content would be published to project @project. Add a domain for @host, or correct the Host header reaching Drupal.', [
\Drupal::logger('quant')->error('Refused @what: the host @host matches no domain, so the Domain module fell back to the default and this would have been written to project @project. Add a domain for @host, or correct the Host header reaching Drupal.', [
0 commit comments