We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8b74b4 commit c3be5eeCopy full SHA for c3be5ee
packages/@vue/cli/lib/ui.js
@@ -6,10 +6,14 @@ const { setNotificationCallback } = require('@vue/cli-ui/apollo-server/util/noti
6
function simpleCorsValidation (allowedHost) {
7
return function (req, socket) {
8
const { host, origin } = req.headers
9
- // maybe we should just use strict string equal?
10
- const hostRegExp = new RegExp(`^https?://(${host}|${allowedHost}|localhost)(:\\d+)?$`)
11
12
- if (!origin || !hostRegExp.test(origin)) {
+ const safeOrigins = [
+ host,
+ allowedHost,
13
+ 'localhost'
14
+ ]
15
+
16
+ if (!origin || !safeOrigins.includes(new URL(origin).hostname)) {
17
socket.destroy()
18
}
19
0 commit comments