Merge pull request #15196 from Budibase/fix/disallow-plugin-app-import

Reject plugins when importing apps
This commit is contained in:
Michael Drury 2024-12-17 13:24:08 +00:00 committed by GitHub
commit 1b6f113f11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -191,6 +191,16 @@ export async function importApp(
if (stillEncrypted) {
throw new Error("Files are encrypted but no password has been supplied.")
}
const isPlugin = !!contents.find(name => name === "plugin.min.js")
if (isPlugin) {
throw new Error("Supplied file is a plugin - cannot import as app.")
}
const isInvalid = !contents.find(name => name === DB_EXPORT_FILE)
if (isInvalid) {
throw new Error(
"App export does not appear to be valid - no DB file found."
)
}
// have to handle object import
if (contents.length && opts.importObjStoreContents) {
let promises = []