js: Only load URLs prefixed by the base URL

This commit is contained in:
Johannes Meyer 2025-02-21 16:33:57 +01:00
parent 484bd26d63
commit aad020511f

View File

@ -242,6 +242,10 @@
loadUrl: function (url, $target, data, method, action, autorefresh, progressTimer, extraHeaders) { loadUrl: function (url, $target, data, method, action, autorefresh, progressTimer, extraHeaders) {
var id = null; var id = null;
if (url.startsWith('//') || ! url.startsWith(this.baseUrl + '/')) {
throw new Error('URL ' + url + ' is not relative to ' + this.baseUrl);
}
// Default method is GET // Default method is GET
if ('undefined' === typeof method) { if ('undefined' === typeof method) {
method = 'GET'; method = 'GET';