Merge pull request #11959 from erik-krogh/ssrfSan

JS: add encodeURIComponent as a sanitizer for request-forgery
This commit is contained in:
Erik Krogh Kristensen
2023-02-14 13:39:53 +01:00
committed by GitHub
5 changed files with 55 additions and 22 deletions

View File

@@ -81,4 +81,14 @@ module RequestForgery {
override string getKind() { result = "endpoint" }
}
private import Xss as Xss
/**
* A call to `encodeURI` or `encodeURIComponent`, viewed as a sanitizer for request forgery.
* These calls will escape "/" to "%2F", which is not a problem for request forgery.
* The result from calling `encodeURI` or `encodeURIComponent` is not a valid URL, and only makes sense
* as a part of a URL.
*/
class UriEncodingSanitizer extends Sanitizer instanceof Xss::Shared::UriEncodingSanitizer { }
}