Skip to content

Commit

Permalink
Merge pull request #15195 from Budibase/fix/ui-ask-for-password-enc-f…
Browse files Browse the repository at this point in the history
…iles

UI - always ask for password with encrypted app exports
  • Loading branch information
mike12345567 authored Dec 17, 2024
2 parents c905d64 + 2e7f75e commit c9bdf6f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions packages/builder/src/components/start/CreateAppModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
const values = writable({ name: "", url: null })
const validation = createValidationStore()
const encryptionValidation = createValidationStore()
const isEncryptedRegex = /^.*\.enc.*\.tar\.gz$/gm
$: {
const { url } = $values
Expand All @@ -37,7 +38,9 @@
encryptionValidation.check({ ...$values })
}
$: encryptedFile = $values.file?.name?.endsWith(".enc.tar.gz")
// filename should be separated to avoid updates everytime any other form element changes
$: filename = $values.file?.name
$: encryptedFile = isEncryptedRegex.test(filename)
onMount(async () => {
const lastChar = $auth.user?.firstName
Expand Down Expand Up @@ -171,7 +174,7 @@
try {
await createNewApp()
} catch (error) {
notifications.error("Error creating app")
notifications.error(`Error creating app - ${error.message}`)
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
await auth.setInitInfo({})
$goto(`/builder/app/${createdApp.instance._id}`)
} catch (error) {
notifications.error("Error creating app")
notifications.error(`Error creating app - ${error.message}`)
}
}
Expand Down
4 changes: 4 additions & 0 deletions packages/server/src/sdk/app/backups/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export async function importApp(
await decryptFiles(tmpPath, template.file.password)
}
const contents = await fsp.readdir(tmpPath)
const stillEncrypted = !!contents.find(name => name.endsWith(".enc"))
if (stillEncrypted) {
throw new Error("Files are encrypted but no password has been supplied.")
}
// have to handle object import
if (contents.length && opts.importObjStoreContents) {
let promises = []
Expand Down

0 comments on commit c9bdf6f

Please sign in to comment.