chore(deps): update dependency i18next-http-backend to v3.0.5 [security]#21390
Draft
renovate[bot] wants to merge 1 commit intodevelopfrom
Draft
chore(deps): update dependency i18next-http-backend to v3.0.5 [security]#21390renovate[bot] wants to merge 1 commit intodevelopfrom
renovate[bot] wants to merge 1 commit intodevelopfrom
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:
3.0.2→3.0.5Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
i18next-http-backend has Path Traversal & URL Injection via Unsanitised lng/ns
GHSA-q89c-q3h5-w34g
More information
Details
Summary
Versions of
i18next-http-backendprior to 3.0.5 interpolate thelngandnsvalues directly into the configuredloadPath/addPathURL template without any encoding, validation, or path sanitisation. When an application exposes the language-code selection to user-controlled input (the default —i18next-browser-languagedetectorreads?lng=query params, cookies,localStorage, and request headers), an attacker can inject characters that change the structure of the outgoing request URL.Affected call sites:
_readAny—lib/index.js:64:interpolate(resolvedLoadPath, { lng: languages.join('+'), ns: namespaces.join('+') })create—lib/index.js:123(pre-patch):interpolate(addPath, { lng, ns: namespace })The helper
interpolate(lib/utils.js) previously returned the raw value with no encoding. In contrast,addQueryStringalready correctly usesencodeURIComponentfor each query-string param — only the URL-path substitution was unprotected.Impact
An attacker who can influence the resolved
lngornsvalue can alter the URL in several ways:lng = '../../config'turns/locales//.jsoninto/locales/../../config/translation.json. On a misconfigured web server, this can cause the request to target a different resource than intended; in SSR pipelines that usefile://or similar schemes forloadPath, it can read arbitrary files from the host filesystem.lng = 'en?admin=true'turns/locales//.jsoninto/locales/en?admin=true/translation.json. Some server frameworks parse the query portion with higher priority than the path and branch on attacker-controlled flags.lng = 'en#anything'silently discards the rest of the path in browser fetches (client cannot see the final URL).lng = 'en%2F..', after server-side URL decoding, resolves toen/..— the attacker bypasses the absence of a literal/in their input.The practical worst case is SSRF when
loadPathis an internal or file-scheme URL, and path-based authorisation bypass against servers that segment access by URL prefix.Also fixed in 3.0.5
omitFetchOptions. A module-level boolean inlib/request.jswas flipped totruethe first time any backend instance hit a "not implemented" fetch error. Once flipped, all subsequent requests from all backend instances in the same module silently stripped every user-configured fetch option — including security-relevantcredentials,mode, andcache. One misbehaving instance (for example during SSR hydration or in React Native) permanently removed these protections process-wide. 3.0.5 scopes the flag to the backend'soptionsobject (options._omitFetchOptions) so one instance's fallback cannot pollute siblings.lng/ns. Error callbacks embedded the rawlng/ns/URL in the message string. Crafted CR/LF values could inject fake log lines into file-backed log aggregators (CWE-117). 3.0.5 strips C0/C1 control chars before concatenation.loadPathcontained auser:password@hostauthority, the full URL (including the credentials) ended up in the error message strings returned to the caller. 3.0.5 redactsuser:password@before logging.for...in.addQueryStringand the XHRcustomHeadersloop usedfor...inwhich walks the prototype chain. PollutedObject.prototypeentries could leak into URL query parameters and request headers. 3.0.5 usesObject.keysand an explicit prototype-key guard.Affected versions
All versions of
i18next-http-backendprior to 3.0.5.Patch
Fixed in 3.0.5. Summary of the hardening:
utils.interpolateUrl(used by_readAnyandcreate) returnsnullif any substitution fails the URL-segment safety check (blocks..,/,\,?,#,%,@, whitespace, control chars, prototype keys, and values > 128 chars). Multi-language joins (en+de) are validated per-segment. The call sites now refuse to issue a request when the check fails and call back with a clear error.omitFetchOptionsis stored per-instance onoptions._omitFetchOptions.for...inover untrusted objects replaced withObject.keys+ prototype-key guard.Workarounds
No workaround short of upgrading. If you cannot upgrade immediately, sanitise
lng/nsyourself before they reach i18next (strip..,/,\,?,#,%, whitespace, and control characters; 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:L/I:L/A:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
i18next/i18next-http-backend (i18next-http-backend)
v3.0.5Compare Source
Security release — all issues found via an internal audit. See published advisory GHSA-q89c-q3h5-w34g.
lngornsvalues contain path-traversal, URL-structure (?,#,%,@, whitespace), path separators, control characters, prototype keys, or exceed 128 chars. Prevents path traversal / SSRF / URL injection via attacker-controlled language-code values.isSafeUrlSegmentis permissive for legitimate i18next language codes (any BCP-47-like shape, underscores, hyphens, dots,+-joined multi-language requests) (GHSA-q89c-q3h5-w34g)omitFetchOptions— the fetch-options-stripping fallback is now scoped to a single backend instance viaoptions._omitFetchOptionsinstead of a module-level boolean. One instance hitting a "not implemented" fetch error no longer permanently stripsrequestOptions(includingcredentials,mode,cache) from every other backend instance in the same processlng/ns/ URL values before they appear in error-callback strings (CWE-117 log forging)user:passwordcredentials from URLs before including them in error-callback strings — prevents leaking basic-auth credentials embedded inloadPath/addPathObject.keys+ prototype-key guard) inaddQueryStringand in thecustomHeadersloop in XHR mode — prevents prototype-pollution amplification into the URL and request headers.env*and*.pem/*.keyfiles in.gitignorev3.0.4Compare Source
{{lng}}and{{ns}}placeholders are supported; custom interpolation prefix/suffix from i18next config no longer applies to backend pathsConfiguration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Never, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Renovate Bot.
Managed by the SAP Open Source Program Office. For questions/issues please raise an issue in the renovate-controller repository.