fix(deps): update dependency i18next-fs-backend to v2 [security] - #202
Open
renovate[bot] wants to merge 1 commit into
Open
fix(deps): update dependency i18next-fs-backend to v2 [security]#202renovate[bot] wants to merge 1 commit into
renovate[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.0.7→2.6.6i18next-fs-backend: Path traversal via unsanitised lng/ns allows arbitrary file read/overwrite
CVE-2026-41693 / GHSA-8847-338w-5hcj
More information
Details
Summary
Versions of
i18next-fs-backendprior to 2.6.4 interpolate the caller-suppliedlngandnsvalues directly into the configuredloadPathandaddPathtemplates with no path-component validation and no sanitisation. When an application exposes the resolved language code to user-controlled input (?lng=query parameter, cookie, request header), a crafted value can break out of the intended locale directory.Affected call sites in
lib/index.js:read(line 38 pre-patch):const filename = interpolate(loadPath, { lng: language, ns: namespace })removeFile(line 101 pre-patch): same pattern againstaddPathwriteFile(line 127 pre-patch): same pattern againstaddPathfor queued missing-key writesThe helper
interpolateinlib/utils.jssubstitutes raw values with no encoding — unlike theaddQueryStringhelper ini18next-http-backend, there is no equivalent safety for path interpolation.Impact
loadPathlike/locales//.json, an attacker-controlledlng = '../../etc'(and matchingns) causes the backend to read a file outside the locale directory. For parsers that tolerate arbitrary content (YAML's freeform text), the file contents surface as a translation resource.addPathis interpolated the same way for missing-key writes (thecreate()code path and the debounced writer inwriteFile). A traversinglng/nscombination can cause the process to write JSON structures to an unintended filesystem location, potentially overwriting application files if the process user has write access..js/.tseval.i18next-fs-backendsupports loading.jsand.tslocale files byeval-ing their content (intentional feature, documented as requiring trusted sources). Combining traversal with that path — for examplelng = '../../../app/config'againstloadPath: '/locales//.js'— would cause the backend to execute a server-side file as JavaScript, exfiltrating whatever it can touch (process.env, connected services).Exploitation requires the application to pass an untrusted
lng/nsvalue through toi18next.t()without its own validation. Many i18next setups do exactly this viai18next-browser-languagedetector(query string / cookie detection).Affected versions
All versions of
i18next-fs-backendprior to 2.6.4.Patch
Fixed in 2.6.4.
lib/utils.jsnow exports:isSafePathSegment(v)— returnstrueonly ifvis a non-empty string of ≤ 128 chars that does not contain..,/,\, control characters, or a prototype key (__proto__,constructor,prototype). Legitimate i18next language-code shapes (BCP-47,en_US,zh-Hant-HK,pirate-speak,my-custom.ns,+-joined multi-language values) all pass.interpolatePath(template, data)— substitutes variables like the existinginterpolatebut refuses the whole result if any segment failsisSafePathSegment. Callers bail out with an error (read) or silently drop the queued write (writeFile,removeFile).The
.js/.tsevalbehaviour is intentionally retained — dynamic expressions in locale files are a documented feature of this backend, and safe replacements like dynamicimport()are async-only and incompatible with this backend's sync-capable code path. The README has a new "Security considerations" section that spells out the trust model:.js/.tslocale files must be treated as code.Workarounds
No workaround short of upgrading. If you cannot upgrade immediately, sanitise
lng/nsat your application boundary before passing them to i18next — reject values containing..,/,\, control characters, and cap the length.Credits
Discovered via an internal security audit of the i18next ecosystem.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
i18next-fs-backend vulnerable to prototype pollution via crafted missing-key string
CVE-2026-48713 / GHSA-2933-q333-qg83
More information
Details
Impact
i18next-fs-backend≤ 2.6.5, when used to persist missing translation keys (e.g. viai18next-http-middleware'smissingKeyHandlerexposed to untrusted input), is vulnerable to prototype pollution via crafted missing-key strings.Backend.writeFile()splits each queued missing-key string on the configuredkeySeparator(default.) before calling the internalsetPath()walker. The walker (getLastOfPathinlib/utils.js) did not guard against unsafe segments, so a key like"__proto__.polluted"was split into["__proto__", "polluted"]and walked straight intoObject.prototype, allowing an attacker to write arbitrary properties onto the global object prototype.Depending on the host application, polluted prototype properties may cause crashes, corrupted translation behaviour, configuration poisoning, or bypasses of property-based security checks.
Affected configuration
Applications are directly affected only if all of the following hold:
i18next-fs-backend≤ 2.6.5 is configured as the backend.i18next-http-middleware'smissingKeyHandler(or another route that forwards untrusted request bodies toi18next.t(..., { ... })withsaveMissing: true) is reachable by untrusted users.keySeparatoris in use (i.e.keySeparatoris notfalse).Apps that do not expose missing-key persistence to untrusted input are not directly affected through this attack path.
Patches
Fixed in i18next-fs-backend 2.6.6. The traversal helper now refuses to descend through
__proto__,constructor, orprototypesegments and drops the offending write silently. Legitimate dotted keys (e.g."header.title") are unaffected.A matching defence-in-depth fix has been shipped in
i18next-http-middleware3.9.7 — see the companion advisory.Workarounds
If users cannot upgrade immediately:
i18next-http-middleware'smissingKeyHandlerto untrusted users (mount it behind authentication, or remove the route).saveMissing: false, or nobackend.createimplementation) when accepting writes from untrusted input.keySeparator: falsein the i18next options to disable backend key splitting (note: this also disables nested translation keys).Resources
i18next-http-middleware: GHSA-f49m-vf83-692w.i18next-fs-backendsecurity release: GHSA-8847-338w-5hcj (path traversal vialng/ns, fixed in 2.6.4).Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:HReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
i18next/i18next-fs-backend (i18next-fs-backend)
v2.6.6Compare Source
Security release — coordinated disclosure from @codeswhite. See published advisory GHSA-2933-q333-qg83.
setPath/pushPathtraversal (utils.getLastOfPath) against prototype pollution via crafted missing-key strings. 2.6.4 sanitisedlng/nsinterpolation into filesystem paths, but did not cover the JSON-object walk thatwriteFile()performs on each queued missing-key entry: with the defaultkeySeparator: '.', a key like__proto__.pollutedwas split into['__proto__','polluted']and walked straight intoObject.prototype. The traversal helper now refuses to descend through__proto__,constructor, orprototypesegments and drops the offending write silently; legitimate dotted keys (header.title) are unaffected. Reachable in practice viai18next-http-middleware'smissingKeyHandlerwhen exposed to untrusted input — see also the matching defence-in-depth fix ini18next-http-middleware3.9.7. Credit: @codeswhite (GHSA-2933-q333-qg83).v2.6.5Compare Source
nsvalues so nested namespace names (mapping to subfolder locale files such aspublic/locales/en/a/b.json) load correctly again. 2.6.4's security fix applied the same strict path-segment check to bothlngandns, which was correct forlng(no BCP-47 shape contains/) but over-strict forns— nested namespaces containing/were never officially supported, but the behaviour fell out of the implicit string-substitution semantics ofloadPathand is common enough in the wild to be worth accommodating.isSafePathSegmentis now split intoisSafeLangSegment(strict — still rejects/) andisSafeNsSegment(loose — allows/but still rejects..,\, control chars, prototype keys, and oversized inputs).isSafePathSegmentis kept as a backwards-compatible alias for the strict check. The 2.6.4 security fix remains in force for every concrete attack pattern from the original advisory. Fixes #74.v2.6.4Compare Source
Security release — all issues found via an internal audit. See published advisory GHSA-8847-338w-5hcj.
lngornsvalues contain.., path separators (/,\), control characters, prototype keys (__proto__/constructor/prototype), or exceed 128 chars. Prevents arbitrary filesystem read / write via attacker-controlled language-code values. Any legitimate i18next language-code shape (BCP-47-like, underscores, hyphens, dots,+-joined multi-language requests) is still accepted (GHSA-8847-338w-5hcj).js/.tslocale files (their content iseval-ed, so they must be treated as code). Theevalbehaviour itself is retained: dynamic expressions in.js/.tslocale files are an intentional feature, and safe replacements likeimport()are async-only and not viable for this sync-capable code path..env*and*.pem/*.keyfiles in.gitignore.v2.6.3Compare Source
v2.6.2Compare Source
v2.6.1Compare Source
v2.6.0Compare Source
v2.5.0Compare Source
v2.4.0Compare Source
v2.3.2Compare Source
v2.3.1Compare Source
v2.3.0Compare Source
v2.2.0Compare Source
v2.1.5Compare Source
v2.1.4Compare Source
v2.1.3Compare Source
v2.1.2Compare Source
v2.1.1Compare Source
v2.1.0Compare Source
v2.0.1Compare Source
v2.0.0Compare Source
v1.2.0Compare Source
v1.1.5Compare Source
v1.1.4Compare Source
v1.1.3Compare Source
v1.1.2Compare Source
v1.1.1Compare Source
v1.1.0Compare Source
v1.0.8Compare Source
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.