Skip to content

feat(vault): import saved MobaXterm passwords from .mobaconf - #3045

Open
binaricat wants to merge 1 commit into
mainfrom
feat/2988-mobaconf-password-import
Open

feat(vault): import saved MobaXterm passwords from .mobaconf#3045
binaricat wants to merge 1 commit into
mainfrom
feat/2988-mobaconf-password-import

Conversation

@binaricat

Copy link
Copy Markdown
Owner

Summary

  • Accept MobaXterm .mobaconf (and existing .ini / .mxtsessions) exports in vault import.
  • Decrypt saved [Passwords] / [Credentials] with the master password (AES-256-CFB8, including the v25 random-IV format) or the legacy SessionP cipher, then attach them to matching SSH hosts.
  • Leave sessions importable without a master password; warn when credentials are encrypted or stored only in the Windows registry.

Closes #2988

Type of Change

  • New feature

Related Issue (optional)

Closes #2988

Changes Made

  • Add a MobaXterm cipher in domain/vaultImport and map decrypted secrets onto imported hosts by user@host / named credential.
  • Prompt for an optional master password on the MobaXterm encoding step and pass it through the import worker.
  • Cover HyperSine vectors, v25 random-IV ciphertexts, and full-config import in unit tests.

Screenshots / Demo

MobaXterm import now accepts .mobaconf and shows an optional master-password field before the file picker.

Testing

  • Tests pass (node --test --import tsx domain/vaultImport/mobaXtermCrypto.test.ts domain/vaultImport.test.ts application/i18n/locales/vaultBulkImportLocales.test.ts infrastructure/services/vaultImportWorkerClient.test.ts)
  • Linting passes (npx eslint on changed files)
  • I have tested these changes locally (npm run dev)
  • Generated capability tool specs are updated when applicable (npm run generate:capability-tools)
  • No new console errors or warnings, if this affects app behavior

Test plan

  • Import a .mxtsessions file without a master password and confirm hosts still come in without passwords.
  • Export a .mobaconf / MobaXterm.ini that includes saved passwords, enter the master password, and confirm first SSH login does not prompt for that password.
  • Enter a wrong master password and confirm sessions still import with a warning and no garbage passwords.
  • Confirm a file that stores passwords only in the Windows registry warns that credentials are not in the file.

Checklist

  • My code follows the existing project style
  • I have added or updated relevant documentation
  • I have not introduced any breaking changes (or I have described them above)

Made with Cursor

Decrypt master-password and legacy SessionP credentials during MobaXterm
import so migrating hosts do not require re-entering passwords.

Co-authored-by: Cursor <cursoragent@cursor.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1136a4987

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread domain/vaultImport.ts
Comment on lines +1165 to +1167
if (/^sesspass$/i.test(sectionName)) {
hasSesspass = true;
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate the master password against Sesspass

When a user mistypes the master password, this reduces [Sesspass] to a boolean and discards the verifier value. Because AES-CFB is unauthenticated and decodeMobaPlaintext accepts printable random output (including its Latin-1 fallback), a wrong key can produce a non-null string that is then saved as the host password; for example, the included credential vector decrypts to non-null garbage with masterPassword: "wrong0". Preserve the Sesspass record and validate the supplied master password before attaching any decrypted credentials.

Useful? React with 👍 / 👎.

pickFile("mobaxterm", ".ini,.mxtsessions,.txt", { encoding });
pickFile("mobaxterm", ".ini,.mxtsessions,.txt,.mobaconf", {
encoding,
masterPassword: mobaMasterPassword.trim() || undefined,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve whitespace in the master password

When a MobaXterm master password intentionally begins or ends with whitespace, trimming it here changes the bytes used to derive the SHA-512/AES key, so every saved credential fails to decrypt. Pass the password through exactly as entered and only treat the truly empty string as absent; the domain helper currently trims it again as well.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 支持导入 mobaxterm 的 .mobaconf 文件

1 participant