Skip to content

Fix secure credential loading for nested team-config profiles - #411

Merged
zFernand0 merged 6 commits into
mainfrom
fix/nested-secure-profile-properties
Aug 25, 2026
Merged

Fix secure credential loading for nested team-config profiles#411
zFernand0 merged 6 commits into
mainfrom
fix/nested-secure-profile-properties

Conversation

@ATorrise

@ATorrise ATorrise commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What It Does
When testing #408 i found that the way i structured my config was returning 401s
ie:

mainframe ->
  -> properties
       -> host
  -> profiles
       -> zosmf ->
            -> properties
                 -> port
            -> secure
                 -> user
                 -> password

found that __load_secure_properties looked for zosmf as a direct key of the mainframe profile but zosmf actually lives one level deeper, under the profiles key.

the fix to config_file.py handles however many levels a config nests

test_custom_file_and_custom_profile_loading_with_nested_profile user/password values came from a plaintext override in nested.zowe.config.user.json, not from the vault. So apparently no test ever exercised __load_secure_properties for a profile nested more than one level deep with secure fields on the child! Added a new test (test_nested_profile_with_secure_properties_on_child) that pulls creds from the mocked vault
How to Test
change your config to match this level of nesting when testing. verify that you get 401s on main and you can run system tests on this branch :)
Review Checklist
I certify that I have:

  • updated the changelog
  • manually tested my changes
  • added/updated automated unit/integration tests
  • created/ran system tests (provide build number if applicable)
  • followed the contribution guidelines

Additional Comments

Signed-off-by: ATorrise <ambertorrise@gmail.com>
Signed-off-by: ATorrise <ambertorrise@gmail.com>
@github-project-automation github-project-automation Bot moved this to New Issues in Zowe CLI Squad Aug 7, 2026
@zowe-robot zowe-robot moved this from New Issues to Review/QA in Zowe CLI Squad Aug 7, 2026
@ATorrise
ATorrise requested a review from t1m0thyj August 7, 2026 18:39
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 85.20%. Comparing base (3329790) to head (8c1bed4).

Files with missing lines Patch % Lines
src/core/zowe/core_for_zowe_sdk/config_file.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #411      +/-   ##
==========================================
+ Coverage   84.82%   85.20%   +0.38%     
==========================================
  Files          49       49              
  Lines        3011     3002       -9     
==========================================
+ Hits         2554     2558       +4     
+ Misses        457      444      -13     
Flag Coverage Δ
unittests 85.20% <75.00%> (+0.38%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: ATorrise <ambertorrise@gmail.com>
zFernand0
zFernand0 previously approved these changes Aug 10, 2026

@zFernand0 zFernand0 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! 😋

Very good catch! 🙏

Here is a quick before and after of this fix:

Before

{'rejectUnauthorized': False, 'host': 'lpar.1', 'port': 1234}
HTTP Request has failed with status code 401. 

After

{'rejectUnauthorized': False, 'host': 'lpar.1', 'port': 1234, 'user': 'dummy', 'password': 'dummy'}
HTTP Request has failed with status code 401. 

I got the 401 because dummy:dummy is not valid on my system


With proper creds:

{'rejectUnauthorized': False, 'host': 'lpar.1', 'port': 1234, 'user': 'REALUSER', 'password': 'PASSWORD'}
//* //FERNAN00 JOB (IZUACCT),FERNANDO,CLASS=B,MSGCLASS=X,TYPRUN=HOLD
...

@traeok traeok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I noticed that even with these changes, the failure is never raised from check_missing_props, which is likely why @zFernand0 was seeing a 401 rather than an explicit error. I'd consider it out of scope for this PR, but worth a follow-up issue.

Aside from that, I left a suggestion around the modified code in an attempt to de-duplicate logic.

Comment thread src/core/zowe/core_for_zowe_sdk/config_file.py Outdated
@zFernand0 zFernand0 self-assigned this Aug 10, 2026
@awharn
awharn requested a review from zFernand0 August 18, 2026 19:50
…into fix/nested-secure-profile-properties

Signed-off-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com>
- Reduced function complexity, and reuse the `find_profile()` function

Co-Authored-by: Claude w/ Model: Sonnet-5/high
Modified AI generated code: YES
Dev Name: Fernando Rijo Cedeno, Reviewed by: <TBD>

Signed-off-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com>
@zFernand0
zFernand0 force-pushed the fix/nested-secure-profile-properties branch from 0ed44ff to c9f60d1 Compare August 24, 2026 19:34
@zFernand0
zFernand0 requested a review from traeok August 24, 2026 19:39
@zFernand0
zFernand0 dismissed their stale review August 24, 2026 19:42

dismissing self-review

Signed-off-by: Fernando Rijo Cedeno <37381190+zFernand0@users.noreply.github.com>
@zFernand0

Copy link
Copy Markdown
Member

The missing coverage is just on a line that I fixed a typo 😢

@traeok traeok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thoroughly reviewed c9f60d1 in addition to the PR as a whole, no concerns here and code changes LGTM 😋
The only outstanding concern is that patch is at 75% instead of the target 80%, but since its not a required stage for Python SDK I'm not going to hold up the PR over it.

Thanks Fernando!

@zFernand0
zFernand0 merged commit 0c48fbe into main Aug 25, 2026
20 of 21 checks passed
@zFernand0
zFernand0 deleted the fix/nested-secure-profile-properties branch August 25, 2026 14:13
@github-project-automation github-project-automation Bot moved this from Review/QA to Closed in Zowe CLI Squad Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

5 participants