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.json endpoint 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:

  1. Enable persisted-query handling in Dispatcher:

    • In your Dispatcher configuration, define the variable CACHE_GRAPHQL_PERSISTED_QUERIES in your src/conf.d/variables/global.vars file.
    • This ensures that requests to /graphql/execute.json/* are processed by Dispatcher filters rather than being proxied directly to AEM.
  2. Remove ProxyPassMatch exclusions for GraphQL endpoints:

    • In your Dispatcher vhost configuration, remove or comment out any ProxyPassMatch rules that bypass Dispatcher for /graphql/execute.json/*.
  3. 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.any file. Replace <rule_id> and <your-endpoint> with values appropriate for your environment.
  4. (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.
  5. Validate Dispatcher behavior:

    • Deploy the configuration and test by sending requests to the blocked endpoints. With CACHE_GRAPHQL_PERSISTED_QUERIES enabled, Dispatcher internally rewrites the request (e.g., /graphql/execute.json/<suffix>;.json) and applies the deny rule, resulting in a blocked request.
  6. (Optional) Review Dispatcher and Rewrite logs:

    • Temporarily set DISP_LOG_LEVEL and REWRITE_LOG_LEVEL to Debug in conf.d/variables/global.vars to confirm that the deny rules are being evaluated as expected. Revert to Warn after testing to reduce log volume.
recommendation-more-help
experience-cloud-kcs-help-kbarticles