fix: Remove special handling for folderTrust flag (#7755)

This commit is contained in:
shrutip90
2025-09-05 09:10:15 -07:00
committed by GitHub
parent 918ab3c2ec
commit 036f3a7f9c
2 changed files with 4 additions and 16 deletions

View File

@@ -521,7 +521,7 @@ describe('Settings Loading and Merging', () => {
});
});
it('should ignore folderTrust from workspace settings', () => {
it('should use folderTrust from workspace settings when trusted', () => {
(mockFsExistsSync as Mock).mockReturnValue(true);
const userSettingsContent = {
security: {
@@ -533,7 +533,7 @@ describe('Settings Loading and Merging', () => {
const workspaceSettingsContent = {
security: {
folderTrust: {
enabled: false, // This should be ignored
enabled: false, // This should be used
},
},
};
@@ -554,7 +554,7 @@ describe('Settings Loading and Merging', () => {
);
const settings = loadSettings(MOCK_WORKSPACE_DIR);
expect(settings.merged.security?.folderTrust?.enabled).toBe(true); // User setting should be used
expect(settings.merged.security?.folderTrust?.enabled).toBe(false); // Workspace setting should be used
});
it('should use system folderTrust over user setting', () => {

View File

@@ -329,18 +329,6 @@ function mergeSettings(
): Settings {
const safeWorkspace = isTrusted ? workspace : ({} as Settings);
// folderTrust is not supported at workspace level.
const { security, ...restOfWorkspace } = safeWorkspace;
const safeWorkspaceWithoutFolderTrust = security
? {
...restOfWorkspace,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
security: (({ folderTrust, ...rest }) => rest)(security),
}
: {
...restOfWorkspace,
};
// Settings are merged with the following precedence (last one wins for
// single values):
// 1. System Defaults
@@ -352,7 +340,7 @@ function mergeSettings(
{}, // Start with an empty object
systemDefaults,
user,
safeWorkspaceWithoutFolderTrust,
safeWorkspace,
system,
) as Settings;
}