GHSA-224p-v68g-5g8f is a medium-severity (CVSS 5.3) vulnerability in @escape.tech/graphql-armor-max-depth. A fix is available for @escape.tech/graphql-armor-max-depth — see the affected versions and patch details below.
GraphQL Armor Max-Depth Plugin Bypass via fragment caching
Real-World Exposure
@escape.tech/graphql-armor-max-depthReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.
Description
Summary
A query depth restriction using the max-depth can be bypassed if ignoreIntrospection is enabled (which is the default configuration) by naming your query/fragment __schema.
Details
In the countDepth function, we have the following code that calculates the depth of a used fragment:
} else if (node.kind == Kind.FRAGMENT_SPREAD) {
if (this.visitedFragments.has(node.name.value)) {
return this.visitedFragments.get(node.name.value) ?? 0;
} else {
this.visitedFragments.set(node.name.value, -1);
}
const fragment = this.context.getFragment(node.name.value);
if (fragment) {
let fragmentDepth;
if (this.config.flattenFragments) {
fragmentDepth = this.countDepth(fragment, parentDepth);
} else {
fragmentDepth = this.countDepth(fragment, parentDepth + 1);
}
depth = Math.max(depth, fragmentDepth);
if (this.visitedFragments.get(node.name.value) === -1) {
this.visitedFragments.set(node.name.value, fragmentDepth);
}
}
}
which will calculate the depth of the fragment used in the current node, store the value in this.visitedFragments and re-use it in the future to avoid re-calculating the depth for the same fragment.
The issue arises when the same fragment is used multiple times, at different depths. The current caching takes into account the depth of the first occurrence, which means if the fragment is re-used later in a higher depth, this cached value is not updated.
So, for example, sending the following query with a max depth of 6:
query {
books {
author {
...Test
}
}
books {
author {
books {
author {
...Test
}
}
}
}
}
fragment Test on Author {
books {
title
}
}
The first use of Test fragment does not exceed the defined limit, and this depth will be cached.
In the second use, the fragment is reused in a greater depth, but the countDepth function will still use the depth cached, without accounting for the increased depth.
PoC
Max depth: 6
query {
books {
author {
...Test
}
}
books {
author {
books {
author {
...Test
}
}
}
}
}
fragment Test on Author {
books {
title
}
}
Impact
This issue affects applications using the GraphQL Armor Depth Limit plugin.
Fix
This is fixed in PR#824. We now store only the additional depth contributed by the fragment and add it to the parent depth where the fragment is used (parentDepth).
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | @escape.tech/graphql-armor-max-depth | all versions | 2.4.2npm install @escape.tech/graphql-armor-max-depth@2.4.2 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @escape.tech/graphql-armor-max-depth, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update @escape.tech/graphql-armor-max-depth to 2.4.2 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-224p-v68g-5g8f is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-224p-v68g-5g8f can be triaged on real exposure rather than presence alone.
Tailored to GHSA-224p-v68g-5g8f. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-224p-v68g-5g8f in your dependencies?
O3 Security finds GHSA-224p-v68g-5g8f across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.