Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop: Linux: Move keychain support behind an off-by-default feature flag #11227

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/lib/models/settings/builtInMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,20 @@ const builtInMetadata = (Setting: typeof SettingType) => {
isGlobal: true,
},

'featureFlag.linuxKeychain': {
value: false,
type: SettingItemType.Bool,
public: true,
storage: SettingStorage.File,
appTypes: [AppType.Desktop],
label: () => 'Enable keychain support',
description: () => 'This is an experimental setting to enable keychain support on Linux',
show: () => shim.isLinux(),
section: 'general',
isGlobal: true,
advanced: true,
},


// 'featureFlag.syncAccurateTimestamps': {
// value: false,
Expand Down
7 changes: 7 additions & 0 deletions packages/lib/services/SettingUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ export async function loadKeychainServiceAndSettings(keychainServiceDrivers: Key
Setting.setKeychainService(KeychainService.instance());
await Setting.load();

// Using Linux with the keychain has been observed to cause all secure settings to be lost
// on Fedora 40 + GNOME. (This may have been related to running multiple Joplin instances).
// For now, make saving to the keychain opt-in until more feedback is received.
if (shim.isLinux() && !Setting.value('featureFlag.linuxKeychain')) {
KeychainService.instance().readOnly = true;
}

// This is part of the migration to the new sync target info. It needs to be
// set as early as possible since it's used to tell if E2EE is enabled, it
// contains the master keys, etc. Once it has been set, it becomes a noop
Expand Down
16 changes: 13 additions & 3 deletions packages/lib/versionInfo.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import Logger from '@joplin/utils/Logger';
import { _ } from './locale';
import Setting from './models/Setting';
import { reg } from './registry';
import KeychainService from './services/keychain/KeychainService';
import { Plugins } from './services/plugins/PluginService';
import shim from './shim';

const logger = Logger.create('versionInfo');

export interface PackageInfo {
name: string;
version: string;
Expand Down Expand Up @@ -70,15 +74,21 @@ export default function versionInfo(packageInfo: PackageInfo, plugins: Plugins)
copyrightText.replace('YYYY', `${now.getFullYear()}`),
];

let keychainSupported = false;
try {
// To allow old keys to be read, certain apps allow read-only keychain access:
keychainSupported = Setting.value('keychain.supported') >= 1 && !KeychainService.instance().readOnly;
} catch (error) {
logger.error('Failed to determine if keychain is supported', error);
}

const body = [
_('%s %s (%s, %s)', p.name, p.version, Setting.value('env'), shim.platformName()),
'',
_('Client ID: %s', Setting.value('clientId')),
_('Sync Version: %s', Setting.value('syncVersion')),
_('Profile Version: %s', reg.db().version()),
// The portable app temporarily supports read-only keychain access (but disallows
// write).
_('Keychain Supported: %s', (Setting.value('keychain.supported') >= 1 && !shim.isPortable()) ? _('Yes') : _('No')),
_('Keychain Supported: %s', keychainSupported ? _('Yes') : _('No')),
];

if (gitInfo) {
Expand Down
Loading