mirror of
https://github.com/tenrok/axios.git
synced 2026-06-11 18:02:32 +03:00
fix(sec): disregard protocol-relative URL to remediate SSRF (#6539)
* fix(sec): disregard protocol-relative URL to remediate SSRF Signed-off-by: hainenber <dotronghai96@gmail.com> * feat(test/unit/regression): add regression test to ensure SNYK-JS-AXIOS-7361793 fixed in future version Signed-off-by: hainenber <dotronghai96@gmail.com> * chore: add EoF newline + comments Signed-off-by: hainenber <dotronghai96@gmail.com> * chore: fix eslint issues Signed-off-by: hainenber <dotronghai96@gmail.com> * Update SNYK-JS-AXIOS-7361793.js Co-authored-by: tom-reinders <tom-reinders@users.noreply.github.com> --------- Signed-off-by: hainenber <dotronghai96@gmail.com> Co-authored-by: tom-reinders <tom-reinders@users.noreply.github.com>
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
||||
*/
|
||||
export default function isAbsoluteURL(url) {
|
||||
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
||||
// A URL is considered absolute if it begins with "<scheme>://".
|
||||
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
||||
// by any combination of letters, digits, plus, period, or hyphen.
|
||||
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
||||
return /^([a-z][a-z\d+\-.]*:)\/\//i.test(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user