mirror of
https://github.com/baserow/baserow.git
synced 2026-12-05 00:38:35 +00:00
* 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>
85 lines
2.2 KiB
Vue
85 lines
2.2 KiB
Vue
<template>
|
|
<div ref="notice" class="preview-security-notice">
|
|
<div class="preview-security-notice__summary">
|
|
<i class="preview-security-notice__icon iconoir-warning-triangle" />
|
|
<span>{{
|
|
$t(
|
|
untrustedContent
|
|
? 'previewSecurityNotice.untrustedSummary'
|
|
: 'previewSecurityNotice.summary'
|
|
)
|
|
}}</span>
|
|
<button
|
|
type="button"
|
|
class="preview-security-notice__toggle"
|
|
:aria-expanded="expanded"
|
|
:aria-label="
|
|
expanded
|
|
? $t('previewSecurityNotice.collapse')
|
|
: $t('previewSecurityNotice.expand')
|
|
"
|
|
@click="expanded = !expanded"
|
|
>
|
|
<i
|
|
:class="expanded ? 'iconoir-nav-arrow-up' : 'iconoir-nav-arrow-down'"
|
|
/>
|
|
</button>
|
|
</div>
|
|
<p v-if="expanded" class="preview-security-notice__details">
|
|
{{
|
|
$t(
|
|
untrustedContent
|
|
? 'previewSecurityNotice.untrustedDetails'
|
|
: 'previewSecurityNotice.details'
|
|
)
|
|
}}
|
|
<a
|
|
v-if="!untrustedContent"
|
|
class="preview-security-notice__link"
|
|
:href="DOCUMENTATION_URL"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>{{ $t('previewSecurityNotice.learnMore') }}</a
|
|
>
|
|
</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { onBeforeUnmount, onMounted, ref } from 'vue'
|
|
|
|
defineOptions({
|
|
name: 'PreviewSecurityNotice',
|
|
})
|
|
|
|
defineProps({
|
|
untrustedContent: { type: Boolean, default: false },
|
|
})
|
|
|
|
const DOCUMENTATION_URL =
|
|
'https://baserow.io/docs/installation%2Fconfiguration#backend-application-builder-configuration'
|
|
|
|
// The application's own fixed header sticks below the notice, not under it.
|
|
const HEIGHT_VARIABLE = '--preview-security-notice-height'
|
|
|
|
const expanded = ref(false)
|
|
const notice = ref(null)
|
|
let observer
|
|
|
|
onMounted(() => {
|
|
const publishHeight = () =>
|
|
document.documentElement.style.setProperty(
|
|
HEIGHT_VARIABLE,
|
|
`${notice.value.offsetHeight}px`
|
|
)
|
|
observer = new ResizeObserver(publishHeight)
|
|
observer.observe(notice.value)
|
|
publishHeight()
|
|
})
|
|
|
|
onBeforeUnmount(() => {
|
|
observer?.disconnect()
|
|
document.documentElement.style.removeProperty(HEIGHT_VARIABLE)
|
|
})
|
|
</script>
|