mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
SSH passwords and key passphrases, git HTTPS credentials, the HTTP proxy password and data source passwords were kept in plaintext JSON files in the app data directory. They now live in the OS credential store via keyring 4 (macOS Keychain, Windows Credential Manager, Secret Service on Linux); each file keeps only an index of keys under a per-directory id. Files from older versions are moved key by key on first use, with a .migrating sidecar so a failed or interrupted move retries without duplicating credentials. Without a credential store (headless Linux) the old file is still read but nothing new is written to disk; the secret lasts for the session. New data sources no longer save their password or SSH tunnel secret unless asked. Also keeps the index path in SecretStore for global data sources and runs their test against the in-memory store. Fixes #740 (credentials part) Co-authored-by: LittleGuava <[email protected]>
22 lines
965 B
TypeScript
22 lines
965 B
TypeScript
import { fireEvent, render, screen, within } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { SourceDialog } from "./SourceDialog";
|
|
|
|
const savePassword = () => screen.getByRole("checkbox", { name: "Save password" }) as HTMLInputElement;
|
|
|
|
describe("new data source", () => {
|
|
it("does not save the database password unless asked to", () => {
|
|
render(<SourceDialog initial={null} />);
|
|
expect(savePassword().checked).toBe(false);
|
|
});
|
|
|
|
it("does not save the SSH tunnel password unless asked to", () => {
|
|
render(<SourceDialog initial={null} />);
|
|
fireEvent.click(screen.getByRole("tab", { name: "SSH/SSL" }));
|
|
fireEvent.click(screen.getByRole("checkbox", { name: "Use SSH tunnel" }));
|
|
fireEvent.click(screen.getByRole("button", { name: "SSH authentication type" }));
|
|
fireEvent.click(within(screen.getByRole("listbox")).getByText("Password"));
|
|
expect(savePassword().checked).toBe(false);
|
|
});
|
|
});
|