[Bug]: appsmithctl restore extracts into /tmpXXXXXX at the filesystem root instead of inside the temp directory
Is there an existing issue for this?
- I have searched the existing issues
Description
appsmithctl restore creates its extraction directory beside the temp directory, not inside it.
run() in app/client/packages/rts/src/ctl/restore.ts:487 (release @ a6ab36cb26) calls:
const restoreRootPath = await fsPromises.mkdtemp(os.tmpdir());fs.mkdtemp(prefix) appends six random characters to the prefix. It does not create a child directory of it. With os.tmpdir() === "/tmp", the restore workspace becomes /tmpAbC123 at the filesystem root:
- A non-root deployment can't write to
/, so the restore fails withEACCESbefore extraction. - A root deployment extracts the whole backup (database dump, git storage, env) outside the configured temp directory. Temp cleanup, tmpfs sizing and volume layout all assume
/tmp.
What I expect is that the workspace is created inside os.tmpdir(), e.g. /tmp/appsmithctl-restore-AbC123.
Steps To Reproduce
node -e 'require("fs/promises").mkdtemp(require("os").tmpdir()).then(console.log)'prints/tmpXXXXXX, not/tmp/XXXXXX.- Run
appsmithctl restorein a container whose user can't write to/. The restore fails creating/tmpXXXXXX.
Failing unit test (red on release, green with the fix). It uses a real mkdtemp in a sandbox:
const restoreRoot = await createRestoreTempDirectory(tempRoot);
expect(path.dirname(restoreRoot)).toBe(tempRoot);
// release behaviour: the parent is the sandbox, not sandbox/tmpProposed approach (a fix with a regression test is ready): mkdtemp(path.join(os.tmpdir(), "appsmithctl-restore-")), extracted into a small exported helper so it can be tested. The change is 1 line in run() plus the helper, and it adds 1 test in restore.test.ts. The restore suite passes (16/16), along with RTS tsc, ESLint and Prettier.
@contributor-support I'd like to take this. Could it be assigned to me? I'll open the PR against release with Fixes #<this> once it's assigned.
Public Sample App
No response
Environment
Release
Severity
Medium (Frustrating UX)
Issue video log
No response
Version
Self Hosted - release @ a6ab36cb26
Prepared with AI assistance (Claude) from the breken-ai account.
Source: appsmithorg/appsmith