You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JS: treat the base argument of URL as tainted in request forgery queries - #23089
new URL(input, base) only propagated taint from input. A user-controlled base with a relative input decides the host of the resulting URL, so it can reach a request sink but was missed.
Extend isAdditionalRequestForgeryStep to also propagate from the second argument, for both the global URL and require("url").URL. The base is not propagated when every possible value of the first argument is a URL object or a string with an authority (scheme://), since the base cannot affect the result in those cases.
Fixes#23066
Follows #5630, which added the first-argument step.
Implementation note
A first argument with a non-special scheme and no // (for example mailto: or data:) conservatively keeps the base tainted. Handling these would need additional regular expressions for little benefit, and such code is rare: new URL('data:text/plain,hello', req.query.input) is equivalent to new URL('data:text/plain,hello'), so the base argument serves no purpose.
`new URL(input, base)` only propagated taint from `input`.
A user-controlled `base` with a relative `input` decides the host of
the resulting URL, so it can reach a request sink but was missed.
Extend `isAdditionalRequestForgeryStep` to also propagate from the
second argument, for both the global `URL` and `require("url").URL`.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unconditional URL-base taint propagation causes false positives for absolute URLs, and negative regression tests plus an assessed DCA evaluation of the final change are still needed.
The base argument of `new URL(...)` is ignored when the first argument is
already an absolute URL, either a string with a scheme or another `URL`
object. Skip the base taint step in those cases.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical flaws drop attacker-controlled base taint for same-scheme URL strings and mixed URL-object/relative inputs, causing missed request-forgery alerts.
An absolute string stored in a variable, such as const input = 'https://fixed.example/path', has no getStringValue() at the constructor argument. The new step therefore reports request forgery for new URL(input, req.query.base) even though the base cannot change the destination. Resolve definitely base-independent strings through local flow, preserving taint for relative or unknown alternatives, and add an aliased-string negative test.
Recognize node:url imports in URL constructor lookups
When a database imports only require('node:url').URL, API::moduleImport("url") has no matching import root, so the new base-taint step misses this constructor. Include node:url in both constructor lookups, for example with API::moduleImport(["url", "node:url"]), and add a regression without any bare url import. The helper at line 80 needs the same update.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An absolute parameter default incorrectly suppresses base taint even when a caller supplies a relative path, causing critical request-forgery false negatives.
origin = nd.getAPredecessor*() and not exists(origin.getAPredecessor())
This branch has not been deployed
No deployments
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
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.
new URL(input, base)only propagated taint frominput. A user-controlledbasewith a relativeinputdecides the host of the resulting URL, so it can reach a request sink but was missed.Extend
isAdditionalRequestForgeryStepto also propagate from the second argument, for both the globalURLandrequire("url").URL. The base is not propagated when every possible value of the first argument is aURLobject or a string with an authority (scheme://), since the base cannot affect the result in those cases.Fixes #23066
Follows #5630, which added the first-argument step.
Implementation note
A first argument with a non-special scheme and no
//(for examplemailto:ordata:) conservatively keeps the base tainted. Handling these would need additional regular expressions for little benefit, and such code is rare:new URL('data:text/plain,hello', req.query.input)is equivalent tonew URL('data:text/plain,hello'), so the base argument serves no purpose.