@websy/websy-designs 1.12.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -47,16 +47,24 @@ module.exports = function (options) {
|
|
|
47
47
|
res.header('Access-Control-Allow-Credentials', true)
|
|
48
48
|
res.header('Access-Control-Allow-Headers', 'Access-Control-Allow-Origin, Access-Control-Allow-Credentials, Content-Type, Authorization, X-Requested-With, Set-Cookie')
|
|
49
49
|
next()
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
|
+
const checkReferrer = (req, res, next) => {
|
|
52
|
+
if (typeof req.headers.referer === 'undefined') {
|
|
53
|
+
res.status(403)
|
|
54
|
+
res.send('Forbidden')
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
next()
|
|
58
|
+
}
|
|
51
59
|
// IMPLEMENT SESSION LOGIC HERE
|
|
52
60
|
app.use(allowCrossDomain)
|
|
53
|
-
app.use(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
61
|
+
// app.use(
|
|
62
|
+
// sanitizer.clean({
|
|
63
|
+
// xss: true,
|
|
64
|
+
// noSql: true,
|
|
65
|
+
// sql: true
|
|
66
|
+
// })
|
|
67
|
+
// )
|
|
60
68
|
app.get('/health', (req, res) => {
|
|
61
69
|
res.json('OK')
|
|
62
70
|
})
|
|
@@ -188,7 +196,11 @@ module.exports = function (options) {
|
|
|
188
196
|
}
|
|
189
197
|
app.use(protectedRoutes)
|
|
190
198
|
if (options.useAPI === true) {
|
|
191
|
-
app.use('/api',
|
|
199
|
+
app.use('/api', sanitizer.clean({
|
|
200
|
+
xss: true,
|
|
201
|
+
noSql: true,
|
|
202
|
+
sql: true
|
|
203
|
+
}), checkReferrer, protectedRoutes, require(`./routes/${version}/api`)(dbHelper, app.authHelper))
|
|
192
204
|
}
|
|
193
205
|
if (options.useShop === true) {
|
|
194
206
|
app.use('/shop', protectedRoutes, require(`./routes/${version}/shop`)(dbHelper, options.dbEngine, app))
|