Skip to content
Merged
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
4 changes: 2 additions & 2 deletions packages/cli/src/config/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,11 +794,11 @@ export function loadSettings(
readOnly: false,
},
{
path: workspaceSettingsPath,
path: realWorkspaceDir === realHomeDir ? '' : workspaceSettingsPath,
settings: workspaceSettings,
originalSettings: workspaceOriginalSettings,
rawJson: workspaceResult.rawJson,
readOnly: false,
readOnly: realWorkspaceDir === realHomeDir,
Comment on lines +797 to +801
Copy link
Contributor

Choose a reason for hiding this comment

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

high

This change correctly makes the workspace settings read-only and prevents saving them when running in the home directory. However, the fix is incomplete because it doesn't prevent the settings from being loaded in the first place. The workspaceSettings object is likely populated from the user's settings file before this point, causing loadedSettings.workspace.settings to mirror user settings instead of being empty. This is misleading for the user and inconsistent with expectations for disabled scopes. The loading of workspace settings should also be skipped when in the home directory.

References
  1. Security-sensitive settings should not use a merge strategy (e.g., MergeStrategy.REPLACE) that allows less-trusted configuration scopes (like a workspace) to completely override more-trusted scopes (like global user settings). This comment highlights a scenario where a less-trusted scope (workspace when in the home directory) could misleadingly reflect or influence more-trusted user settings, which aligns with the principle of preventing unintended interactions between different trust levels of configuration.

},
isTrusted,
settingsErrors,
Expand Down
Loading