Browse Source

fix: avoid framing other than shared pages

pull/7651/head
mertmit 9 months ago
parent
commit
cc52829d17
  1. 19
      packages/nc-gui/middleware/01.security.global.ts
  2. 0
      packages/nc-gui/middleware/02.auth.global.ts

19
packages/nc-gui/middleware/01.security.global.ts

@ -0,0 +1,19 @@
export default defineNuxtRouteMiddleware(async (to) => {
// avoid non-embeddable paths within an iframe
if (self !== top) {
// allow for shared base
const embeddablePaths = ['/base/']
const embedRegex = new RegExp(`^(${embeddablePaths.join('|')})`)
if (embedRegex.test(to.path)) {
return
}
// allow for shared views
if (to.meta?.layout === 'shared-view') {
return
}
// throw for all other pages
throw createError({ statusCode: 403, message: 'Not allowed' })
}
})

0
packages/nc-gui/middleware/auth.global.ts → packages/nc-gui/middleware/02.auth.global.ts

Loading…
Cancel
Save