@opengis/fastify-table 1.2.22 → 1.2.23

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.2.22",
3
+ "version": "1.2.23",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -80,7 +80,7 @@ export default function checkPolicy(req, reply) {
80
80
  }
81
81
 
82
82
  /* === 3. policy: user === */
83
- if (!user && policy.includes('user')) {
83
+ if (!validToken && !user && policy.includes('user')) {
84
84
  logger.file('policy/user', {
85
85
  path, method, params, query, body, message: 'access restricted: 3',
86
86
  });
@@ -88,7 +88,7 @@ export default function checkPolicy(req, reply) {
88
88
  }
89
89
 
90
90
  /* === 4. policy: referer === */
91
- if (!headers?.referer?.includes?.(hostname) && policy.includes('referer') && !config.local && !config.debug) {
91
+ if (!validToken && !headers?.referer?.includes?.(hostname) && policy.includes('referer') && !config.local && !config.debug) {
92
92
  logger.file('policy/referer', {
93
93
  path, method, params, query, body, message: 'access restricted: 4', uid: user?.uid,
94
94
  });
@@ -96,7 +96,7 @@ export default function checkPolicy(req, reply) {
96
96
  }
97
97
 
98
98
  /* === 5. policy: site auth === */
99
- if (!policy.includes('site') && !isAdmin && !config.local && !config.debug && !unittest
99
+ if (!validToken && !policy.includes('site') && !isAdmin && !config.local && !config.debug && !unittest
100
100
  && !['/auth/redirect', '/logout', `${config.prefix || '/api'}/login`].find(el => path.includes(el))) {
101
101
  logger.file('policy/site', {
102
102
  path, method, params, query, body, message: 'access restricted: 5', uid: user?.uid,
@@ -105,7 +105,7 @@ export default function checkPolicy(req, reply) {
105
105
  }
106
106
 
107
107
  /* === 6. base policy: block api, except login === */
108
- if (isAdmin && !isUser && isServer && !config.local && !config.debug
108
+ if (!validToken && isAdmin && !isUser && isServer && !config.local && !config.debug
109
109
  && !path.startsWith(`${config.prefix || '/api'}/login`)) {
110
110
  logger.file('policy/api', {
111
111
  path, method, params, query, body, message: 'access restricted: 6', uid: user?.uid,
@@ -113,5 +113,6 @@ export default function checkPolicy(req, reply) {
113
113
  return reply.status(403).send('access restricted: 6');
114
114
  }
115
115
 
116
+ // console.log(headers);
116
117
  return null;
117
118
  }