Files
Peter EvansandJeremie Pardou 5a62c876e4 fix: align custom code in builder Preview with the editor on shared hostnames (#6881)
* fix: restrict editor-written code in the builder editor and on the editor hostname

* fix: simplify builder author code restrictions by hostname

* refactor: remove redundant backend custom code hostname checks

* refactor: unify builder HTML element rendering restrictions

* refactor: clarify builder web frontend hostname terminology

* fix: distinguish untrusted builder content in preview notices

* refactor: remove unused backend preview security setting

* docs: shorten builder code restriction changelog

* fix: restrict iframe cookie access across frontend ports

* refactor: share web frontend hostname matching

* fix: preserve protected HTML interactions and bound iframe height

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-26 17:20:44 +00:00

33 lines
973 B
JavaScript

import {
isAuthorCodeRestricted,
isPreviewAuthorCodeRestricted,
} from '@baserow/modules/builder/utils/authorCode'
/**
* The one check the editor, Preview and published applications share to decide
* whether code written by an application's editors is restricted.
*
* - `$isAuthorCodeRestricted()`: whether it is restricted on this page,
* - `$previewRestrictsAuthorCode()`: whether Preview will restrict it, for the
* editor to tell the user.
*/
export default defineNuxtPlugin({
name: 'builder-author-code',
dependsOn: ['is-web-frontend-hostname'],
setup(nuxtApp) {
const config = useRuntimeConfig()
return {
provide: {
isAuthorCodeRestricted: () =>
isAuthorCodeRestricted({
isWebFrontendHostname: nuxtApp.$isWebFrontendHostname,
publicConfig: config.public,
}),
previewRestrictsAuthorCode: () =>
isPreviewAuthorCodeRestricted(config.public),
},
}
},
})