@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.
@@ -432,6 +432,7 @@ class PGHelper {
432
432
  })
433
433
  }
434
434
  execute (query) {
435
+ console.log(query)
435
436
  return new Promise((resolve, reject) => {
436
437
  // console.log(query)
437
438
  if (query !== null) {
@@ -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
- sanitizer.clean({
55
- xss: true,
56
- noSql: true,
57
- sql: true
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', protectedRoutes, require(`./routes/${version}/api`)(dbHelper, app.authHelper))
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))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websy/websy-designs",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"