Glob: Absolute `ignore` pattern silently bypassed when `root`/`cwd` path contains braces
Package Affected versions Patched versions Description Summary glob's ignore option composes an absolute ignore pattern by pasting the resolved root/cwd path into a glob string, then re-parsing that s
Package
glob (npm)Affected versions
<= 14.0.5Patched versions
14.0.6Description
Summary
glob's ignore option composes an absolute ignore pattern by pasting the
resolved root/cwd path into a glob string, then re-parsing that string
with minimatch. The path is escaped with minimatch's escape(), but
escape() only escapes { and } when magicalBraces is enabled — which
glob does not do. A root path containing braces is therefore brace-expanded
during re-parsing, and the resulting ignore pattern no longer matches the real
path. The exclusion is silently dropped and the excluded file is returned.
Root cause
src/ignore.ts:84-88
const slashRoot = cwd?.resolve(root ?? '/').fullpath() ?? '/'
this.slashRoot = escape(
slashRoot.replace(/\\/g, '/').replace(/\/$/, ''),
{ windowsPathsNoEscape }, // <-- no `magicalBraces`
)
src/ignore.ts:121-125
const glob =
p.root() === '/' ?
`${this.slashRoot}/${p.rest()?.globString() ?? ''}`
: p.globString()
const m = new Minimatch(glob, this.mmopts) // <-- brace expansion happens here
The composed string is parsed as a glob, so {7,8} becomes two alternatives.
Why this is a vulnerability and not a cosmetic issue
The root option exists precisely so that absolute patterns and absolute
ignore rules are anchored at a chosen directory. The two code paths handle
root differently:
| path | root handling |
braces in root |
|---|---|---|
pattern (src/processor.ts) |
t.resolve(this.opts.root) — path resolution |
works correctly |
ignore (src/ignore.ts) |
pasted into a glob string | silently broken |
So the pattern still finds the file at the literal path, while the ignore
rule that was supposed to exclude it stops matching. The caller asked for
ignore: ['/skip.log'] anchored at root and did not get it.
Impact
ignore is routinely used to exclude secrets, credentials, lockfiles, build
artifacts, or tenant-scoped paths. When the rule is dropped, those files are
returned to the caller instead.
The trigger is the path, not the ignore pattern, so it is reachable when the
root/cwd path is derived from externally supplied data (tenant id, project
name, upload directory, archive extraction path).
Reproduction
import { Volume, createFsFromVolume } from 'memfs'
import { glob } from 'glob'
const vol = new Volume()
const fs = createFsFromVolume(vol)
vol.fromJSON({
'/root{7,8}/keep.txt': 'x',
'/root{7,8}/skip.log': 'x',
})
const res = await glob('*', {
cwd: '/root{7,8}',
root: '/root{7,8}',
fs,
ignore: ['/skip.log'],
platform: 'posix',
})
console.log(res) // [ 'keep.txt', 'skip.log' ] <-- skip.log should be ignored
Control with a plain root path:
vol.fromJSON({ '/root/keep.txt': 'x', '/root/skip.log': 'x' })
await glob('*', {
cwd: '/root', root: '/root', fs, ignore: ['/skip.log'], platform: 'posix',
})
// [ 'keep.txt' ] <-- ignore correctly enforced
Mechanism proof
const { Ignore } = await import('glob')
const { PathScurryPosix } = await import('path-scurry')
const ig = new Ignore(['/skip.log'], { platform: 'posix', root: '/root{7,8}' }, scurry.cwd)
ig.slashRoot // "/root{7,8}"
ig.absolute[0].set // [['', 'root7', 'skip.log'], ['', 'root8', 'skip.log']]
ig.absolute[0].match('/root{7,8}/skip.log') // false <-- the real path
ig.absolute[0].match('/root7/skip.log') // true <-- a path that does not exist
Fix
Both issues are in src/ignore.ts. A minimal change closes them:
this.mmopts = {
+ braceExpandMax: 10_000,
dot: true,
nobrace,
nocase,
@@
this.slashRoot = escape(
slashRoot.replace(/\\/g, '/').replace(/\/$/, ''),
- { windowsPathsNoEscape },
+ { magicalBraces: true, windowsPathsNoEscape },
)
magicalBraces: truemakesescape()escape{and}as well, so the
composed path stays literal and is not brace-expanded on re-parse.braceExpandMax: 10_000makes the ignore path use the same limit as the
pattern path.
Verified: with this patch the ignore matcher becomes
[['', 'root{7,8}', 'skip.log']] (one row, literal), matches
/root{7,8}/skip.log, and the amplified ignore payload is rejected with the
same error as the pattern path.
Regression tests are in test/ignore-braces.ts; they fail against the
unpatched source and pass with the patch. The existing suite
(test/ignore.ts, test/custom-ignore.ts, test/ignore-root.ts,
test/pattern.ts, test/root.ts, test/absolute.ts) remains green: 167/167.
Tested on published [email protected] (current HEAD f26bdac). Earlier versions not checked. Fixed in: 14.0.6
Related hardening (same file)
src/ignore.ts:71-83 builds mmopts without braceExpandMax, while the pattern path sets braceExpandMax: 10_000 (src/glob.ts:528). Ignore patterns therefore fall back to minimatch's 100_000 default. The patch above already includes this one-line change.
References
- GHSA-c6wh-w8c3-cv3g
- https://nvd.nist.gov/vuln/detail/CVE-2026-144291
- isaacs/node-glob@17cb207
- https://github.com/isaacs/node-glob/releases/tag/v14.0.6
Severity
Moderate CVSS overall score This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS). / 10CVSS v4 base metrics
Exploitability Metrics Attack Vector Network Attack Complexity High Attack Requirements Present Privileges Required None User interaction None Vulnerable System Impact Metrics Confidentiality Low Integrity None Availability None Subsequent System Impact Metrics Confidentiality None Integrity None Availability None CVSS v4 base metrics Exploitability Metrics Attack Vector: This metric reflects the context by which vulnerability exploitation is possible. This metric value (and consequently the resulting severity) will be larger the more remote (logically, and physically) an attacker can be in order to exploit the vulnerable system. The assumption is that the number of potential attackers for a vulnerability that could be exploited from across a network is larger than the number of potential attackers that could exploit a vulnerability requiring physical access to a device, and therefore warrants a greater severity. Attack Complexity: This metric captures measurable actions that must be taken by the attacker to actively evade or circumvent existing built-in security-enhancing conditions in order to obtain a working exploit. These are conditions whose primary purpose is to increase security and/or increase exploit engineering complexity. A vulnerability exploitable without a target-specific variable has a lower complexity than a vulnerability that would require non-trivial customization. This metric is meant to capture security mechanisms utilized by the vulnerable system. Attack Requirements: This metric captures the prerequisite deployment and execution conditions or variables of the vulnerable system that enable the attack. These differ from security-enhancing techniques/technologies (ref Attack Complexity) as the primary purpose of these conditions is not to explicitly mitigate attacks, but rather, emerge naturally as a consequence of the deployment and execution of the vulnerable system. Privileges Required: This metric describes the level of privileges an attacker must possess prior to successfully exploiting the vulnerability. The method by which the attacker obtains privileged credentials prior to the attack (e.g., free trial accounts), is outside the scope of this metric. Generally, self-service provisioned accounts do not constitute a privilege requirement if the attacker can grant themselves privileges as part of the attack. User interaction: This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable system. This metric determines whether the vulnerability can be exploited solely at the will of the attacker, or whether a separate user (or user-initiated process) must participate in some manner. Vulnerable System Impact Metrics Confidentiality: This metric measures the impact to the confidentiality of the information managed by the VULNERABLE SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones. Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the VULNERABLE SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging). Availability: This metric measures the impact to the availability of the VULNERABLE SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system. Subsequent System Impact Metrics Confidentiality: This metric measures the impact to the confidentiality of the information managed by the SUBSEQUENT SYSTEM due to a successfully exploited vulnerability. Confidentiality refers to limiting information access and disclosure to only authorized users, as well as preventing access by, or disclosure to, unauthorized ones. Integrity: This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. Integrity of the SUBSEQUENT SYSTEM is impacted when an attacker makes unauthorized modification of system data. Integrity is also impacted when a system user can repudiate critical actions taken in the context of the system (e.g. due to insufficient logging). Availability: This metric measures the impact to the availability of the SUBSEQUENT SYSTEM resulting from a successfully exploited vulnerability. While the Confidentiality and Integrity impact metrics apply to the loss of confidentiality or integrity of data (e.g., information, files) used by the system, this metric refers to the loss of availability of the impacted system itself, such as a networked service (e.g., web, database, email). Since availability refers to the accessibility of information resources, attacks that consume network bandwidth, processor cycles, or disk space all impact the availability of a system. CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:NEPSS score
Weaknesses
Weakness CWE-20Improper Input Validation
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. Learn more on MITRE. Weakness CWE-693Protection Mechanism Failure
The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. Learn more on MITRE.CVE ID
CVE-2026-144291GHSA ID
GHSA-c6wh-w8c3-cv3gSource code
isaacs/node-globCredits
-
icguner Reporter
Uh oh!
There was an error while loading. Please reload this page.
See something to contribute? Suggest improvements for this vulnerability.