Unauthorized access to /graphql/execute.json endpoints in AEM as a Cloud Service Dispatcher
This article explains how to block unauthorized access to the /graphql/execute.json endpoint and its variants in Adobe Experience Manager (AEM) as a Cloud Service by configuring Dispatcher filters and related settings.
Description description
Environment
Adobe Experience Manager as a Cloud Service (AEMaaCS)
Issue/Symptoms
- The
/graphql/execute.jsonendpoint and its suffix variants (such as/graphql/execute.json/
Cause
By default, the Dispatcher vhost configuration may include a ProxyPassMatch rule that routes /graphql/execute.json/* requests directly to AEM, bypassing Dispatcher filters. Additionally, when persisted-query caching is enabled, Dispatcher rewrites the request internally (e.g., /graphql/execute.json/
Resolution resolution
To fix the unauthorized access issue, follow these steps:
-
Enable persisted-query handling in Dispatcher:
- In your Dispatcher configuration, define the variable
CACHE_GRAPHQL_PERSISTED_QUERIESin yoursrc/conf.d/variables/global.varsfile. - This ensures that requests to
/graphql/execute.json/*are processed by Dispatcher filters rather than being proxied directly to AEM.
- In your Dispatcher configuration, define the variable
-
Remove ProxyPassMatch exclusions for GraphQL endpoints:
- In your Dispatcher vhost configuration, remove or comment out any
ProxyPassMatchrules that bypass Dispatcher for/graphql/execute.json/*.
- In your Dispatcher vhost configuration, remove or comment out any
-
Add endpoint-specific deny rules in filters.any:
- Add narrow deny rules for the endpoints you want to block. For example:
code language-none /<rule_id> { /type "deny" /url "/graphql/execute.json/<your-endpoint>*" }- Place these rules after the standard includes in your
filters.anyfile. Replace<rule_id>and<your-endpoint>with values appropriate for your environment.
-
(Optional) Add a RewriteRule to preserve the original path:
- In your vhost file, inside the
<IfModule mod_rewrite.c>block, add the following immediately after including your rewrite rules:
code language-none RewriteRule /graphql/execute\.json - [ L]- This ensures the original path is preserved for Dispatcher filter evaluation.
- In your vhost file, inside the
-
Validate Dispatcher behavior:
- Deploy the configuration and test by sending requests to the blocked endpoints. With
CACHE_GRAPHQL_PERSISTED_QUERIESenabled, Dispatcher internally rewrites the request (e.g.,/graphql/execute.json/<suffix>;.json) and applies the deny rule, resulting in a blocked request.
- Deploy the configuration and test by sending requests to the blocked endpoints. With
-
(Optional) Review Dispatcher and Rewrite logs:
- Temporarily set
DISP_LOG_LEVELandREWRITE_LOG_LEVELto Debug inconf.d/variables/global.varsto confirm that the deny rules are being evaluated as expected. Revert to Warn after testing to reduce log volume.
- Temporarily set