Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Merge requests
!12007
Issue
#2868712
: Extra validation to verify if the url is a local url.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#2868712
: Extra validation to verify if the url is a local url.
issue/drupal-2868712:drupal-js-issue-2868712
into
11.x
Overview
0
Commits
2
Pipelines
5
Changes
1
Open
Diego Castro
requested to merge
issue/drupal-2868712:drupal-js-issue-2868712
into
11.x
1 month ago
Overview
0
Commits
2
Pipelines
5
Changes
1
Expand
0
0
Merge request reports
Compare
11.x
version 4
8c89df0d
1 month ago
version 3
7cbbc078
1 month ago
version 2
9f38af3c
1 month ago
version 1
10041773
1 month ago
11.x (HEAD)
and
latest version
latest version
f354773c
2 commits,
1 month ago
version 4
8c89df0d
1 commit,
1 month ago
version 3
7cbbc078
1 commit,
1 month ago
version 2
9f38af3c
1 commit,
1 month ago
version 1
10041773
1 commit,
1 month ago
1 file
+
9
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
core/misc/drupal.js
+
9
−
1
Options
@@ -436,7 +436,11 @@ window.Drupal = { behaviors: {}, locale: {} };
// Always use browser-derived absolute URLs in the comparison, to avoid
// attempts to break out of the base path using directory traversal.
let
absoluteUrl
=
Drupal
.
url
.
toAbsolute
(
url
);
const
{
origin
:
requestOrigin
}
=
new
URL
(
absoluteUrl
);
let
{
protocol
}
=
window
.
location
;
const
{
origin
}
=
window
.
location
;
// Check if the origin of the request has the same origin as the current page.
const
isSameOrigin
=
requestOrigin
===
origin
;
// Consider URLs that match this site's base URL but use HTTPS instead of HTTP
// as local as well.
@@ -461,7 +465,11 @@ window.Drupal = { behaviors: {}, locale: {} };
// The given URL matches the site's base URL, or has a path under the site's
// base URL.
return
absoluteUrl
===
baseUrl
||
absoluteUrl
.
startsWith
(
`
${
baseUrl
}
/`
);
return
(
absoluteUrl
===
baseUrl
||
absoluteUrl
.
startsWith
(
`
${
baseUrl
}
/`
)
||
isSameOrigin
);
};
/**
Loading