Repository navigation
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3016 +/- ##
==========================================
+ Coverage 92.78% 92.84% +0.06%
==========================================
Files 661 662 +1
Lines 21266 21448 +182
Branches 4925 4982 +57
==========================================
+ Hits 19731 19914 +183
+ Misses 1532 1531 -1
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Client artifacts: |
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com>
|
📅 Suggested merge-by date: 11/26/2026 |
|
|
||
| ## Recent Changes | ||
|
|
||
| - **Breaking:** Project config files are now only loaded from trusted directories. World-writable directories are always skipped, and directories outside the current working directory, the home directory, or the `trustedConfigDirs` list in `settings/imperative.json` are skipped unless `IConfigOpts.trustPromptFn` approves them or `ZOWE_CONFIG_ALLOW_UNTRUSTED_DIRS=true` is set. [#3016](https://github.com/zowe/zowe-cli/pull/3016) |
There was a problem hiding this comment.
We should explain what settings/imperative.json, IConfigOpts.trustPromptFn, and ZOWE_CONFIG_ALLOW_UNTRUSTED_DIRS=true are
| const configPath = Config.search(this.configName, { | ||
| ignoreDirs: [this.mHomeDir], startDir: this.mProjectDir, isTrusted: this.isTrustedDir | ||
| }); | ||
| return configPath || path.join(this.mProjectDir, this.configName); |
There was a problem hiding this comment.
If the project directory is the only layer and that layer is not trusted, this logic falls back to return the same rejected project-level config file. Then when we call Config.reload later on, the read function is called and that reads the layer without another trust check.
Can we update this to distinguish between a missing config and rejected config, so that we do not load a rejected file?
| */ | ||
| public static isDirTrusted(dirPath: string, cliHome: string, promptFn?: TrustPromptFn, startDir?: string): boolean { | ||
| const allowEnv = process.env[this.ENV_ALLOW_UNTRUSTED]?.toLowerCase(); | ||
| if (process.env.CI != null || allowEnv === "1" || allowEnv === "true") return true; |
There was a problem hiding this comment.
(nitpick) I'm not opposed to keeping this check as-is since we have used the if (process.env.CI != null) pattern elsewhere, but I'm wondering if we should make the check a bit more explicit to avoid edge cases?
| if (process.env.CI != null || allowEnv === "1" || allowEnv === "true") return true; | |
| const isCI = Boolean(process.env.CI && process.env.CI !== 'false' && process.env.CI !== '0'); | |
| if (isCI || allowEnv === "1" || allowEnv === "true") return true; |
Co-Authored-by: Codex @model: GPT-6.1 Sol Modified AI generated code: Yes Dev Name: Timothy Johnson Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
3f6c702 to
156935a
Compare
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: CBforZ <chris.boehm@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Co-Authored-by: Codex @model: GPT-6.2 Sol Modified AI generated code: Yes Dev Name: Timothy Johnson Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal Gandhi <71276682+pujal0909@users.noreply.github.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
traeok
left a comment
There was a problem hiding this comment.
Seeing some test failures on Windows. Happy to help with debugging / resolving on my Windows machine if it helps!
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Add trusted config prompts to CLI and daemon
|
|
||
| (namespaceObj as Record<string, SettingValue>)[key] = value; | ||
| this.flush(); | ||
| (namespaceObj as Record<string, SettingValue>)[key] = value; |
Co-Authored-by: Codex @model: GPT-6.2 Sol Modified AI generated code: Yes Dev Name: Timothy Johnson Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
|
traeok
left a comment
There was a problem hiding this comment.
The only concerns I have left are out of scope, so I am ready to approve. Thanks for the fix and addressing feedback!
| */ | ||
| public static isDirTrustedWithoutPrompt(dirPath: string, cliHome: string): boolean { | ||
| const allowEnv = process.env[this.ENV_ALLOW_UNTRUSTED]?.toLowerCase(); | ||
| const isCI = Boolean(process.env.CI && process.env.CI !== "false" && process.env.CI !== "0"); |
There was a problem hiding this comment.
We should consider turning this into a utility function we can use everywhere (if we don't have one already) 🙏
Maybe sometghin that will return true if a give ENV is set 😋
We could apply to to CI and ZOWE_CONFIG_ALLOW_UNTRUSTED_DIRS
| let warning: string | undefined; | ||
| try { | ||
| if (TrustedConfigManager.isWorldWritable(dir)) { | ||
| warning = "The directory is world-writable. To load this config, run 'chmod o-w <path>' on the directory " + |
There was a problem hiding this comment.
can we help th users by adding the director in the warning?



What It Does
Project config files are now loaded only from directories the user trusts. Unrecognized and world-writable directories are skipped with a warning. Follows : zowe/zowe-client-python-sdk#405
This is a breaking change.
How to Test
Follow the steps in the linked Python SDK PR, but instead of
test.pyuse a Node.js scripttest.js:Review Checklist
I certify that I have:
Additional Comments