From 145e79b657f9612447744944fa447d37a9fc7c9e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 14 Jan 2026 14:05:58 +0100 Subject: [PATCH] fix(ncu-config): allow overriding global encrypted keys with local ones If a value is defined locally, it should make no difference whether the associated key is present or not in the global config. --- lib/config.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index 3c91217d..e7724725 100644 --- a/lib/config.js +++ b/lib/config.js @@ -25,7 +25,15 @@ export function getMergedConfig(dir, home, additional) { const globalConfig = getConfig(GLOBAL_CONFIG, home); const projectConfig = getConfig(PROJECT_CONFIG, dir); const localConfig = getConfig(LOCAL_CONFIG, dir); - mergedConfig = Object.assign(globalConfig, projectConfig, localConfig, additional); + + // Using property descriptors to avoid calling any setter if e.g. a + // localConfig value overrides a globalConfig key. + mergedConfig = Object.create(null, { + ...Object.getOwnPropertyDescriptors(globalConfig), + ...Object.getOwnPropertyDescriptors(projectConfig), + ...Object.getOwnPropertyDescriptors(localConfig), + ...(additional && Object.getOwnPropertyDescriptors(additional)), + }); } return mergedConfig; };