Skip to content

Commit 8694102

Browse files
authored
Make changes to support hiding secure values (#3848)
* Make changes to support hiding secure values Signed-off-by: Andrew W. Harn <[email protected]> * Add changelogs Signed-off-by: Andrew W. Harn <[email protected]> * Update changelogs again Signed-off-by: Andrew W. Harn <[email protected]> --------- Signed-off-by: Andrew W. Harn <[email protected]>
1 parent 9088b0b commit 8694102

File tree

12 files changed

+791
-274
lines changed

12 files changed

+791
-274
lines changed

packages/zowe-explorer-api/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t
88

99
### Bug fixes
1010

11+
- Fixed an issue where secure credentials and headers were being logged to the Zowe logger and VSCode output channel. [#3848](https://github.com/zowe/zowe-explorer-vscode/pull/3848)
12+
- Updated Zowe SDKs to `8.27.0` for technical currency. [#3848](https://github.com/zowe/zowe-explorer-vscode/pull/3848)
1113
- Added support to delete VSAM data sets for z/OSMF type profiles. [#3824](https://github.com/zowe/zowe-explorer-vscode/issues/3824)
1214

1315
## `3.3.0`

packages/zowe-explorer-api/__tests__/__unit__/profiles/ProfilesCache.unit.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ import { FileManagement, Types } from "../../../src";
1717
import { mocked } from "../../../__mocks__/mockUtils";
1818
import { VscSettings } from "../../../src/vscode/doc/VscSettings";
1919
import * as crypto from "crypto";
20+
import { ZosmfProfile } from "@zowe/zosmf-for-zowe-sdk";
21+
import { ZosTsoProfile } from "@zowe/zos-tso-for-zowe-sdk";
22+
import { ZosUssProfile } from "@zowe/zos-uss-for-zowe-sdk";
2023

2124
jest.mock("crypto", () => ({
2225
...jest.requireActual("crypto"),
@@ -103,9 +106,13 @@ function createProfInfoMock(profiles: Partial<imperative.IProfileLoaded>[]): imp
103106
secure: {
104107
secureFields: jest.fn().mockReturnValue([]),
105108
securePropsForProfile: jest.fn().mockReturnValue([]),
109+
findSecure: jest.fn().mockReturnValue([]),
106110
},
107111
} as any,
108112
exists: true,
113+
mProperties: {
114+
profiles: {},
115+
},
109116
};
110117
return {
111118
getAllProfiles: (profType?: string) =>
@@ -399,6 +406,34 @@ describe("ProfilesCache", () => {
399406
expect(oldZosmfProfile.profile).toEqual(newZosmfProfile.profile);
400407
});
401408

409+
it("should refresh profile data and add secure values to Censor utility", async () => {
410+
const setCensoredOptionsSpy = jest.spyOn(imperative.Censor, "setCensoredOptions");
411+
const profCache = new ProfilesCache(fakeLogger as unknown as imperative.Logger);
412+
const profInfoMock1 = createProfInfoMock([lpar1Profile, zftpProfile]);
413+
const profInfoSpy = jest.spyOn(profCache, "getProfileInfo").mockResolvedValue(profInfoMock1);
414+
await profCache.refresh(fakeApiRegister as unknown as Types.IApiRegisterClient);
415+
expect(profCache.allProfiles.length).toEqual(2);
416+
expect(profCache.allProfiles[0]).toMatchObject(lpar1Profile);
417+
expect(setCensoredOptionsSpy).toHaveBeenCalledTimes(1);
418+
expect(setCensoredOptionsSpy).toHaveBeenCalledWith({
419+
config: profInfoMock1.getTeamConfig(),
420+
profiles: expect.arrayContaining([ZosmfProfile, ZosTsoProfile, ZosUssProfile, ...profileMetadata]),
421+
});
422+
const oldZosmfProfile = profCache.allProfiles[0];
423+
const newZosmfProfile = { ...lpar1Profile, profile: lpar2Profile.profile };
424+
const profInfoMock2 = createProfInfoMock([newZosmfProfile, zftpProfile]);
425+
profInfoSpy.mockResolvedValue(profInfoMock2);
426+
await profCache.refresh(fakeApiRegister as unknown as Types.IApiRegisterClient);
427+
expect(profCache.allProfiles.length).toEqual(2);
428+
expect(profCache.allProfiles[0]).toMatchObject(newZosmfProfile);
429+
expect(oldZosmfProfile.profile).toEqual(newZosmfProfile.profile);
430+
expect(setCensoredOptionsSpy).toHaveBeenCalledTimes(2);
431+
expect(setCensoredOptionsSpy).toHaveBeenCalledWith({
432+
config: profInfoMock2.getTeamConfig(),
433+
profiles: expect.arrayContaining([ZosmfProfile, ZosTsoProfile, ZosUssProfile, ...profileMetadata]),
434+
});
435+
});
436+
402437
it("should refresh profile data for and merge tokens with base profile", async () => {
403438
const profCache = new ProfilesCache(fakeLogger as unknown as imperative.Logger);
404439
jest.spyOn(profCache, "getProfileInfo").mockResolvedValue(

packages/zowe-explorer-api/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
},
2929
"dependencies": {
3030
"@types/vscode": "^1.53.2",
31-
"@zowe/core-for-zowe-sdk": "^8.26.0",
32-
"@zowe/imperative": "^8.26.0",
33-
"@zowe/secrets-for-zowe-sdk": "^8.24.2",
34-
"@zowe/zos-console-for-zowe-sdk": "^8.26.0",
35-
"@zowe/zos-files-for-zowe-sdk": "^8.26.0",
36-
"@zowe/zos-jobs-for-zowe-sdk": "^8.26.0",
37-
"@zowe/zos-tso-for-zowe-sdk": "^8.26.0",
38-
"@zowe/zos-uss-for-zowe-sdk": "^8.26.0",
39-
"@zowe/zosmf-for-zowe-sdk": "^8.26.0",
31+
"@zowe/core-for-zowe-sdk": "^8.27.0",
32+
"@zowe/imperative": "^8.27.0",
33+
"@zowe/secrets-for-zowe-sdk": "^8.27.0",
34+
"@zowe/zos-console-for-zowe-sdk": "^8.27.0",
35+
"@zowe/zos-files-for-zowe-sdk": "^8.27.0",
36+
"@zowe/zos-jobs-for-zowe-sdk": "^8.27.0",
37+
"@zowe/zos-tso-for-zowe-sdk": "^8.27.0",
38+
"@zowe/zos-uss-for-zowe-sdk": "^8.27.0",
39+
"@zowe/zosmf-for-zowe-sdk": "^8.27.0",
4040
"async-mutex": "^0.5.0",
4141
"deep-object-diff": "^1.1.9",
4242
"mustache": "^4.2.0",

packages/zowe-explorer-api/src/profiles/ProfilesCache.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ export class ProfilesCache {
232232
}
233233
this.checkForEnvVarAndUpdate();
234234
this.profilesForValidation = [];
235+
236+
imperative.Censor.setCensoredOptions({
237+
config: mProfileInfo.getTeamConfig(),
238+
profiles: [...this.getCoreProfileTypes(), ...this.getConfigArray()],
239+
});
235240
}
236241

237242
/**

packages/zowe-explorer-ftp-extension/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ All notable changes to the "zowe-explorer-ftp-extension" extension will be docum
66

77
### Bug fixes
88

9+
- Updated Zowe SDKs to `8.27.0` for technical currency. [#3848](https://github.com/zowe/zowe-explorer-vscode/pull/3848)
10+
911
## `3.3.0`
1012

1113
### New features and enhancements

packages/zowe-explorer-ftp-extension/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252
"vscode": "^1.79.0"
5353
},
5454
"dependencies": {
55-
"@zowe/zos-files-for-zowe-sdk": "^8.26.0",
55+
"@zowe/zos-files-for-zowe-sdk": "^8.27.0",
5656
"@zowe/zos-ftp-for-zowe-cli": "^3.0.0",
57-
"@zowe/zos-jobs-for-zowe-sdk": "^8.26.0",
57+
"@zowe/zos-jobs-for-zowe-sdk": "^8.27.0",
5858
"@zowe/zowe-explorer-api": "3.4.0-SNAPSHOT"
5959
},
6060
"jest": {

packages/zowe-explorer/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
1010

1111
### Bug fixes
1212

13+
- Fixed an issue where secure credentials and headers were being logged to the Zowe logger and VSCode output channel. [#3848](https://github.com/zowe/zowe-explorer-vscode/pull/3848)
14+
- Updated Zowe SDKs to `8.27.0` for technical currency. [#3848](https://github.com/zowe/zowe-explorer-vscode/pull/3848)
15+
1316
## `3.3.0`
1417

1518
### New features and enhancements

packages/zowe-explorer/__tests__/__mocks__/@zowe/imperative.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,9 @@ export class AuthOrder {
437437
// this.originalAuthOrder.makingRequestForToken(...args);
438438
}
439439
}
440+
441+
export class Censor {
442+
public static censorRawData(data: string): string {
443+
return data;
444+
}
445+
}

0 commit comments

Comments
 (0)