From 8c6ba15c4392e85c929aebab4f83750ae7e44982 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 1 Nov 2024 15:57:41 -0400 Subject: [PATCH 1/5] Add ESLint rule to prevent invalid imports Signed-off-by: Timothy Johnson --- .eslintrc.js | 6 ++++++ packages/imperative/src/cmd/src/doc/ICommandDefinition.ts | 2 +- .../cmd/src/doc/handler/ICommandHandlerResponseValidator.ts | 2 +- .../src/doc/response/api/handler/IHandlerFormatOutputApi.ts | 2 +- .../imperative/src/cmd/src/help/DefaultHelpGenerator.ts | 2 +- packages/imperative/src/cmd/src/response/CommandResponse.ts | 2 +- .../imperative/src/cmd/src/yargs/AbstractCommandYargs.ts | 2 +- packages/imperative/src/cmd/src/yargs/CommandYargs.ts | 6 +++--- packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts | 2 +- .../src/imperative/src/plugins/PluginManagementFacility.ts | 4 ++-- packages/zostso/src/doc/IIssueResponse.ts | 2 +- 11 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3b4488bdb1..2ee8ab7a53 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -25,6 +25,7 @@ module.exports = { ], "rules": { "@typescript-eslint/no-magic-numbers": "off", + "@typescript-eslint/no-restricted-imports": "off", "jest/expect-expect": ["warn", { "assertFunctionNames": ["expect*", "**.*expect*"] }], @@ -63,6 +64,11 @@ module.exports = { "ignoreEnums": true, "ignoreReadonlyClassProperties": true }], + "@typescript-eslint/no-restricted-imports": ["error", { + "patterns": [{ + "group": ["**/../lib", "**/../src"] + }] + }], "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/semi": "warn", diff --git a/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts b/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts index 3343e1cb74..758b6df07f 100644 --- a/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts +++ b/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts @@ -14,7 +14,7 @@ import { IChainedHandlerEntry } from "./handler/IChainedHandlerEntry"; import { ICommandOptionDefinition } from "./option/ICommandOptionDefinition"; import { ICommandPositionalDefinition } from "./option/ICommandPositionalDefinition"; import { ICommandDefinitionPassOn } from "./ICommandDefinitionPassOn"; -import { ICommandProfile } from "../../src/doc/profiles/definition/ICommandProfile"; +import { ICommandProfile } from "../doc/profiles/definition/ICommandProfile"; /** * Command Segment type - either "group" or "command". * diff --git a/packages/imperative/src/cmd/src/doc/handler/ICommandHandlerResponseValidator.ts b/packages/imperative/src/cmd/src/doc/handler/ICommandHandlerResponseValidator.ts index 6ec47d051c..581bef3595 100644 --- a/packages/imperative/src/cmd/src/doc/handler/ICommandHandlerResponseValidator.ts +++ b/packages/imperative/src/cmd/src/doc/handler/ICommandHandlerResponseValidator.ts @@ -9,7 +9,7 @@ * */ -import { ICommandResponse } from "../../../src/doc/response/response/ICommandResponse"; +import { ICommandResponse } from "../../doc/response/response/ICommandResponse"; import { CommandResponse } from "../../response/CommandResponse"; export interface ICommandHandlerResponseValidator { diff --git a/packages/imperative/src/cmd/src/doc/response/api/handler/IHandlerFormatOutputApi.ts b/packages/imperative/src/cmd/src/doc/response/api/handler/IHandlerFormatOutputApi.ts index f52555ee6d..4ab25a36e9 100644 --- a/packages/imperative/src/cmd/src/doc/response/api/handler/IHandlerFormatOutputApi.ts +++ b/packages/imperative/src/cmd/src/doc/response/api/handler/IHandlerFormatOutputApi.ts @@ -9,7 +9,7 @@ * */ -import { ICommandOutputFormat } from "../../../../../src/doc/response/response/ICommandOutputFormat"; +import { ICommandOutputFormat } from "../../../../doc/response/response/ICommandOutputFormat"; export interface IHandlerFormatOutputApi { output: (format: ICommandOutputFormat) => void; diff --git a/packages/imperative/src/cmd/src/help/DefaultHelpGenerator.ts b/packages/imperative/src/cmd/src/help/DefaultHelpGenerator.ts index 7152110297..2df012ea0e 100644 --- a/packages/imperative/src/cmd/src/help/DefaultHelpGenerator.ts +++ b/packages/imperative/src/cmd/src/help/DefaultHelpGenerator.ts @@ -17,7 +17,7 @@ import { CommandUtils } from "../utils/CommandUtils"; import { ImperativeError } from "../../../error"; import { IHelpGeneratorParms } from "./doc/IHelpGeneratorParms"; import { IHelpGeneratorFactoryParms } from "./doc/IHelpGeneratorFactoryParms"; -import { compareCommands, ICommandDefinition } from "../../src/doc/ICommandDefinition"; +import { compareCommands, ICommandDefinition } from "../doc/ICommandDefinition"; import stripAnsi = require("strip-ansi"); /** diff --git a/packages/imperative/src/cmd/src/response/CommandResponse.ts b/packages/imperative/src/cmd/src/response/CommandResponse.ts index 2c25263ec6..caccafcd7e 100644 --- a/packages/imperative/src/cmd/src/response/CommandResponse.ts +++ b/packages/imperative/src/cmd/src/response/CommandResponse.ts @@ -24,7 +24,7 @@ import { ImperativeExpect } from "../../../expect"; import { IHandlerFormatOutputApi } from "../doc/response/api/handler/IHandlerFormatOutputApi"; import { ICommandOutputFormat, OUTPUT_FORMAT } from "../doc/response/response/ICommandOutputFormat"; import { Arguments } from "yargs"; -import { ICommandDefinition } from "../../src/doc/ICommandDefinition"; +import { ICommandDefinition } from "../doc/ICommandDefinition"; import { OptionConstants } from "../constants/OptionConstants"; import { inspect } from "util"; import * as DeepMerge from "deepmerge"; diff --git a/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts b/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts index 9edb11cd0b..5001396d59 100644 --- a/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts +++ b/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts @@ -23,7 +23,7 @@ import { IProfileManagerFactory } from "../../../profiles"; import { ICommandProfileTypeConfiguration } from "../doc/profiles/definition/ICommandProfileTypeConfiguration"; import { IHelpGeneratorFactory } from "../help/doc/IHelpGeneratorFactory"; import { CommandResponse } from "../response/CommandResponse"; -import { ICommandResponse } from "../../src/doc/response/response/ICommandResponse"; +import { ICommandResponse } from "../doc/response/response/ICommandResponse"; import { ICommandExampleDefinition } from "../.."; import { ImperativeConfig } from "../../../utilities/src/ImperativeConfig"; diff --git a/packages/imperative/src/cmd/src/yargs/CommandYargs.ts b/packages/imperative/src/cmd/src/yargs/CommandYargs.ts index 5483a36956..25fe4ea709 100644 --- a/packages/imperative/src/cmd/src/yargs/CommandYargs.ts +++ b/packages/imperative/src/cmd/src/yargs/CommandYargs.ts @@ -14,11 +14,11 @@ import { inspect } from "util"; import { Constants } from "../../../constants"; import { IYargsResponse } from "./doc/IYargsResponse"; import { AbstractCommandYargs, YargsCommandCompleted } from "./AbstractCommandYargs"; -import { ICommandOptionDefinition } from "../../src/doc/option/ICommandOptionDefinition"; +import { ICommandOptionDefinition } from "../doc/option/ICommandOptionDefinition"; import { ICommandDefinition } from "../doc/ICommandDefinition"; import { CommandProcessor } from "../CommandProcessor"; -import { ICommandResponse } from "../../src/doc/response/response/ICommandResponse"; -import { CommandResponse } from "../../src/response/CommandResponse"; +import { ICommandResponse } from "../doc/response/response/ICommandResponse"; +import { CommandResponse } from "../response/CommandResponse"; import { ImperativeConfig } from "../../../utilities"; /** diff --git a/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts b/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts index f9e027376f..5308f74511 100644 --- a/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts +++ b/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts @@ -9,7 +9,7 @@ * */ -import { ICommandResponse } from "../../../src/doc/response/response/ICommandResponse"; +import { ICommandResponse } from "../../doc/response/response/ICommandResponse"; /** * Indicates the action performed. */ diff --git a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts index dda75c20d4..701a837dda 100644 --- a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts +++ b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts @@ -9,8 +9,8 @@ * */ -import { IImperativeConfig } from "../../src/doc/IImperativeConfig"; -import { UpdateImpConfig } from "../../src/UpdateImpConfig"; +import { IImperativeConfig } from "../doc/IImperativeConfig"; +import { UpdateImpConfig } from "../UpdateImpConfig"; import { isAbsolute, join } from "path"; import { ImperativeConfig, JsUtils } from "../../../utilities"; import { Logger } from "../../../logger"; diff --git a/packages/zostso/src/doc/IIssueResponse.ts b/packages/zostso/src/doc/IIssueResponse.ts index cc5cb4b82c..2af2a6b8b6 100644 --- a/packages/zostso/src/doc/IIssueResponse.ts +++ b/packages/zostso/src/doc/IIssueResponse.ts @@ -33,7 +33,7 @@ export interface IIssueResponse { startResponse: IStartStopResponses; /** - * Indicates if started TSO containes "READY " message + * Indicates if started TSO contains "READY" message * @type {boolean} * @memberof IIssueResponse */ From 7e06dd7ccab9c52547187948fd0e1b75589dd43f Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 28 Oct 2024 13:05:14 -0400 Subject: [PATCH 2/5] Don't rewrite team config file when only vault update is needed Signed-off-by: Timothy Johnson --- packages/imperative/CHANGELOG.md | 4 ++++ .../ProfileInfo.TeamConfig.unit.test.ts | 23 ++++++++++++++++++- .../imperative/src/config/src/ProfileInfo.ts | 7 +++++- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 851519de0b..9356c331eb 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes + +- BugFix: Fixed an issue where the `ProfileInfo.updateKnownProperty` method could rewrite team config file to disk without any changes when storing secure value. [#2324](https://github.com/zowe/zowe-cli/issues/2324) + ## `5.27.4` - BugFix: Updated the `cross-spawn` dependency for technical currency. [#2374](https://github.com/zowe/zowe-cli/pull/2374) diff --git a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts index d41900dfb1..ee2b05c96f 100644 --- a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts @@ -1232,7 +1232,7 @@ describe("TeamConfig ProfileInfo tests", () => { }); describe("updateKnownProperty", () => { - it("should throw and error if the property location type is invalid", async () => { + it("should throw an error if the property location type is invalid", async () => { const profInfo = createNewProfInfo(teamProjDir); await profInfo.readProfilesFromDisk(); let caughtError; @@ -1271,6 +1271,7 @@ describe("TeamConfig ProfileInfo tests", () => { const profInfo = createNewProfInfo(teamProjDir); await profInfo.readProfilesFromDisk(); const jsonPathMatchesSpy = jest.spyOn(ConfigUtils, "jsonPathMatches"); + const configSaveSpy = jest.spyOn(profInfo.getTeamConfig(), "save"); const prof = profInfo.mergeArgsForProfile(profInfo.getAllProfiles("dummy")[0]); const ret = await profInfo.updateKnownProperty({ mergedArgs: prof, property: "host", value: "example.com" }); @@ -1279,6 +1280,26 @@ describe("TeamConfig ProfileInfo tests", () => { expect(newHost).toEqual("example.com"); expect(ret).toBe(true); expect(jsonPathMatchesSpy).toHaveBeenCalled(); // Verify that profile names are matched correctly + expect(configSaveSpy).toHaveBeenCalled(); + }); + + it("should update the given property in the vault and return true", async () => { + const profInfo = createNewProfInfo(teamProjDir); + await profInfo.readProfilesFromDisk(); + const jsonPathMatchesSpy = jest.spyOn(ConfigUtils, "jsonPathMatches"); + jest.spyOn(profInfo.getTeamConfig().api.secure, "secureFields").mockReturnValue(["profiles.LPAR4.properties.host"]); + const configSaveSpy = jest.spyOn(profInfo.getTeamConfig(), "save"); + const configSecureSaveSpy = jest.spyOn(profInfo.getTeamConfig().api.secure, "save"); + + const prof = profInfo.mergeArgsForProfile(profInfo.getAllProfiles("dummy")[0]); + const ret = await profInfo.updateKnownProperty({ mergedArgs: prof, property: "host", value: "example.com", setSecure: true }); + const newHost = profInfo.getTeamConfig().api.layers.get().properties.profiles.LPAR4.properties.host; + + expect(newHost).toEqual("example.com"); + expect(ret).toBe(true); + expect(jsonPathMatchesSpy).toHaveBeenCalled(); // Verify that profile names are matched correctly + expect(configSaveSpy).not.toHaveBeenCalled(); + expect(configSecureSaveSpy).toHaveBeenCalled(); }); it("should remove the given property if the value specified if undefined", async () => { diff --git a/packages/imperative/src/config/src/ProfileInfo.ts b/packages/imperative/src/config/src/ProfileInfo.ts index ec35a9f5d6..cd514eae37 100644 --- a/packages/imperative/src/config/src/ProfileInfo.ts +++ b/packages/imperative/src/config/src/ProfileInfo.ts @@ -316,8 +316,13 @@ export class ProfileInfo { this.getTeamConfig().api.layers.activate(osLoc.user, osLoc.global); } + const updateVaultOnly = options.setSecure && this.getTeamConfig().api.secure.secureFields().includes(toUpdate.argLoc.jsonLoc); this.getTeamConfig().set(toUpdate.argLoc.jsonLoc, options.value, { secure: options.setSecure }); - await this.getTeamConfig().save(false); + if (!updateVaultOnly) { + await this.getTeamConfig().save(false); + } else { + await this.getTeamConfig().api.secure.save(false); + } if (oldLayer) { this.getTeamConfig().api.layers.activate(oldLayer.user, oldLayer.global); From 0a007a291e48eb78cd40903836c1e5c17a813c8c Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Fri, 18 Oct 2024 17:14:52 -0400 Subject: [PATCH 3/5] Fix profileManagerWillLoad failing before read from disk Signed-off-by: Timothy Johnson --- packages/imperative/CHANGELOG.md | 1 + .../config/__tests__/ProfileInfo.TeamConfig.unit.test.ts | 6 +++--- packages/imperative/src/config/src/ProfileCredentials.ts | 9 +++++---- packages/imperative/src/config/src/ProfileInfo.ts | 8 +++++--- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 9356c331eb..6148670750 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to the Imperative package will be documented in this file. ## Recent Changes +- BugFix: Fixed an issue where the `ProfileInfo.profileManagerWillLoad` method failed if profiles were not yet read from disk. [#2284](https://github.com/zowe/zowe-cli/issues/2284) - BugFix: Fixed an issue where the `ProfileInfo.updateKnownProperty` method could rewrite team config file to disk without any changes when storing secure value. [#2324](https://github.com/zowe/zowe-cli/issues/2324) ## `5.27.4` diff --git a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts index ee2b05c96f..a0095db5f5 100644 --- a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts @@ -303,7 +303,7 @@ describe("TeamConfig ProfileInfo tests", () => { describe("profileManagerWillLoad", () => { it("should return false if secure credentials fail to load", async () => { const profInfo = createNewProfInfo(teamProjDir); - jest.spyOn((profInfo as any).mCredentials, "isSecured", "get").mockReturnValueOnce(true); + jest.spyOn((profInfo as any).mCredentials, "isCredentialManagerInAppSettings").mockReturnValueOnce(true); jest.spyOn((profInfo as any).mCredentials, "loadManager").mockImplementationOnce(async () => { throw new Error("bad credential manager"); }); @@ -319,10 +319,10 @@ describe("TeamConfig ProfileInfo tests", () => { expect(response).toEqual(true); }); - it("should return true if credentials are not secure", async () => { + it("should return true if there is no credential manager", async () => { // ensure that we are not in the team project directory const profInfo = createNewProfInfo(origDir); - (profInfo as any).mCredentials = {isSecured: false}; + jest.spyOn((profInfo as any).mCredentials, "isCredentialManagerInAppSettings").mockReturnValueOnce(false); const response = await profInfo.profileManagerWillLoad(); expect(response).toEqual(true); }); diff --git a/packages/imperative/src/config/src/ProfileCredentials.ts b/packages/imperative/src/config/src/ProfileCredentials.ts index 78e5f3e24c..f67b663cdf 100644 --- a/packages/imperative/src/config/src/ProfileCredentials.ts +++ b/packages/imperative/src/config/src/ProfileCredentials.ts @@ -54,9 +54,9 @@ export class ProfileCredentials { /** * Check if secure credentials will be encrypted or stored in plain text. - * If using team config, this will always return true. If using classic - * profiles, this will check whether a custom CredentialManager is defined - * in the Imperative settings.json file. + * This will return true if the team configuration files contain secure + * fields, or if a custom CredentialManager is defined in the Imperative + * settings.json file. */ public get isSecured(): boolean { this.mSecured = this.isTeamConfigSecure() || this.isCredentialManagerInAppSettings(); @@ -112,8 +112,9 @@ export class ProfileCredentials { /** * Check whether a custom CredentialManager is defined in the Imperative * settings.json file. + * @internal */ - private isCredentialManagerInAppSettings(): boolean { + public isCredentialManagerInAppSettings(): boolean { try { const fileName = path.join(ImperativeConfig.instance.cliHome, "settings", "imperative.json"); let settings: any; diff --git a/packages/imperative/src/config/src/ProfileInfo.ts b/packages/imperative/src/config/src/ProfileInfo.ts index cd514eae37..ec89094cb6 100644 --- a/packages/imperative/src/config/src/ProfileInfo.ts +++ b/packages/imperative/src/config/src/ProfileInfo.ts @@ -1010,11 +1010,13 @@ export class ProfileInfo { //_________________________________________________________________________ /** - * Function to ensure the credential manager will load successfully - * Returns true if it will load, or the credentials are not secured. Returns false if it will not load. + * Checks whether the credential manager will load successfully. + * @returns + * True if it loaded successfully, or there is no credential manager + * configured in Imperative settings.json */ public async profileManagerWillLoad(): Promise { - if (this.mCredentials.isSecured) { + if (this.mCredentials.isCredentialManagerInAppSettings()) { try { await this.mCredentials.loadManager(); return true; From 848beb8b2410fb4ebd5156dffbb715494d2d9b31 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Wed, 6 Nov 2024 14:22:59 -0500 Subject: [PATCH 4/5] Fix profileManagerWillLoad depending on config API Signed-off-by: Timothy Johnson --- .../ProfileInfo.TeamConfig.unit.test.ts | 2 +- .../src/config/src/ProfileCredentials.ts | 30 ++++++++++++------- .../imperative/src/config/src/ProfileInfo.ts | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts index a0095db5f5..31a9e0da34 100644 --- a/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts +++ b/packages/imperative/src/config/__tests__/ProfileInfo.TeamConfig.unit.test.ts @@ -304,7 +304,7 @@ describe("TeamConfig ProfileInfo tests", () => { it("should return false if secure credentials fail to load", async () => { const profInfo = createNewProfInfo(teamProjDir); jest.spyOn((profInfo as any).mCredentials, "isCredentialManagerInAppSettings").mockReturnValueOnce(true); - jest.spyOn((profInfo as any).mCredentials, "loadManager").mockImplementationOnce(async () => { + jest.spyOn((profInfo as any).mCredentials, "activateCredMgrOverride").mockImplementationOnce(async () => { throw new Error("bad credential manager"); }); diff --git a/packages/imperative/src/config/src/ProfileCredentials.ts b/packages/imperative/src/config/src/ProfileCredentials.ts index f67b663cdf..8d433e1262 100644 --- a/packages/imperative/src/config/src/ProfileCredentials.ts +++ b/packages/imperative/src/config/src/ProfileCredentials.ts @@ -74,6 +74,25 @@ export class ProfileCredentials { throw new ImperativeError({ msg: "Secure credential storage is not enabled" }); } + await this.activateCredMgrOverride(); + + if (this.mProfileInfo.usingTeamConfig) { + await this.mProfileInfo.getTeamConfig().api.secure.load({ + load: (key: string): Promise => { + return CredentialManagerFactory.manager.load(key, true); + }, + save: (key: string, value: any): Promise => { + return CredentialManagerFactory.manager.save(key, value); + } + }); + } + } + + /** + * Attempt to initialize `CredentialManagerFactory` with the specified override. + * @internal + */ + public async activateCredMgrOverride(): Promise { if (!CredentialManagerFactory.initialized) { try { // TODO? Make CredentialManagerFactory.initialize params optional @@ -86,17 +105,6 @@ export class ProfileCredentials { }); } } - - if (this.mProfileInfo.usingTeamConfig) { - await this.mProfileInfo.getTeamConfig().api.secure.load({ - load: ((key: string): Promise => { - return CredentialManagerFactory.manager.load(key, true); - }), - save: ((key: string, value: any): Promise => { - return CredentialManagerFactory.manager.save(key, value); - }) - }); - } } /** diff --git a/packages/imperative/src/config/src/ProfileInfo.ts b/packages/imperative/src/config/src/ProfileInfo.ts index ec89094cb6..601ce36bc5 100644 --- a/packages/imperative/src/config/src/ProfileInfo.ts +++ b/packages/imperative/src/config/src/ProfileInfo.ts @@ -1018,7 +1018,7 @@ export class ProfileInfo { public async profileManagerWillLoad(): Promise { if (this.mCredentials.isCredentialManagerInAppSettings()) { try { - await this.mCredentials.loadManager(); + await this.mCredentials.activateCredMgrOverride(); return true; } catch (err) { this.mImpLogger.warn("Failed to initialize secure credential manager: " + err.message); From 7d8781d9c08796beafd33226c9a1f0d2a9d4ad47 Mon Sep 17 00:00:00 2001 From: Timothy Johnson Date: Mon, 25 Nov 2024 11:08:03 -0500 Subject: [PATCH 5/5] Fix lint errors and mark Node 22 as supported Signed-off-by: Timothy Johnson --- .../src/cmd/src/doc/processor/ICommandProcessorParms.ts | 2 +- .../src/cmd/src/doc/response/response/ICommandPrepared.ts | 4 ++-- .../imperative/src/cmd/src/profiles/CliProfileManager.ts | 2 +- packages/imperative/src/config/src/ProfileCredentials.ts | 6 +++--- .../src/imperative/src/config/cmd/report-env/EnvItems.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/imperative/src/cmd/src/doc/processor/ICommandProcessorParms.ts b/packages/imperative/src/cmd/src/doc/processor/ICommandProcessorParms.ts index 82ffd3fd02..47cfb813b3 100644 --- a/packages/imperative/src/cmd/src/doc/processor/ICommandProcessorParms.ts +++ b/packages/imperative/src/cmd/src/doc/processor/ICommandProcessorParms.ts @@ -12,7 +12,7 @@ import { ICommandDefinition } from "../ICommandDefinition"; import { IHelpGenerator } from "../../help/doc/IHelpGenerator"; import { IProfileManagerFactory } from "../../../../profiles"; -import { ICommandProfileTypeConfiguration } from "../../../src/doc/profiles/definition/ICommandProfileTypeConfiguration"; +import { ICommandProfileTypeConfiguration } from "../../doc/profiles/definition/ICommandProfileTypeConfiguration"; import { Config } from "../../../../config"; import { IDaemonContext } from "../../../../imperative/src/doc/IDaemonContext"; diff --git a/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts b/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts index 636e0fbc58..f090e2765e 100644 --- a/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts +++ b/packages/imperative/src/cmd/src/doc/response/response/ICommandPrepared.ts @@ -9,8 +9,8 @@ * */ -import { CommandProfiles } from "../../../../src/profiles/CommandProfiles"; -import { ICommandArguments } from "../../../../src/doc/args/ICommandArguments"; +import { CommandProfiles } from "../../../profiles/CommandProfiles"; +import { ICommandArguments } from "../../../doc/args/ICommandArguments"; /** * Command Processor prepare response. * @export diff --git a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts index a4aa983665..6cf13d0faa 100644 --- a/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts +++ b/packages/imperative/src/cmd/src/profiles/CliProfileManager.ts @@ -27,7 +27,7 @@ import { ImperativeError } from "../../../error"; import { Arguments } from "yargs"; import { CommandResponse } from "../response/CommandResponse"; import { ICommandHandlerRequire } from "../doc/handler/ICommandHandlerRequire"; -import { ICommandHandler } from "../../src/doc/handler/ICommandHandler"; +import { ICommandHandler } from "../doc/handler/ICommandHandler"; import { ICommandProfileTypeConfiguration } from "../doc/profiles/definition/ICommandProfileTypeConfiguration"; import { CommandProfiles } from "./CommandProfiles"; import { ICommandProfileProperty } from "../doc/profiles/definition/ICommandProfileProperty"; diff --git a/packages/imperative/src/config/src/ProfileCredentials.ts b/packages/imperative/src/config/src/ProfileCredentials.ts index 8d433e1262..5836dabd98 100644 --- a/packages/imperative/src/config/src/ProfileCredentials.ts +++ b/packages/imperative/src/config/src/ProfileCredentials.ts @@ -54,9 +54,9 @@ export class ProfileCredentials { /** * Check if secure credentials will be encrypted or stored in plain text. - * This will return true if the team configuration files contain secure - * fields, or if a custom CredentialManager is defined in the Imperative - * settings.json file. + * If using team config, this will always return true. If using classic + * profiles, this will check whether a custom CredentialManager is defined + * in the Imperative settings.json file. */ public get isSecured(): boolean { this.mSecured = this.isTeamConfigSecure() || this.isCredentialManagerInAppSettings(); diff --git a/packages/imperative/src/imperative/src/config/cmd/report-env/EnvItems.ts b/packages/imperative/src/imperative/src/config/cmd/report-env/EnvItems.ts index bd5a9f8344..a8eebe3213 100644 --- a/packages/imperative/src/imperative/src/config/cmd/report-env/EnvItems.ts +++ b/packages/imperative/src/imperative/src/config/cmd/report-env/EnvItems.ts @@ -69,8 +69,8 @@ function formatLogLevelMsg(logTypeName: string) { export const probTests: IProbTest[] = [ { itemId: ItemId.NODEJS_VER, - probExpr: "semver.satisfies('{val}', '<18.x || 19.x || >=21.x')", - probMsg: "Only Node.js versions 18 and 20 are supported." + probExpr: "semver.satisfies('{val}', '<18.x || 19.x || 21.x || >=23.x')", + probMsg: "Only Node.js versions 18, 20, and 22 are supported." }, { itemId: ItemId.NPM_VER,