Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot update password with the SDK #1573

Open
kraabrsg opened this issue Nov 28, 2022 — with Slack · 7 comments
Open

Cannot update password with the SDK #1573

kraabrsg opened this issue Nov 28, 2022 — with Slack · 7 comments
Labels
bug Something isn't working priority-medium Not functioning - next quarter if capacity permits severity-medium Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.

Comments

Copy link

kraabrsg commented Nov 28, 2022

1.) when updating the secure stored password, on extension restart an old password is loaded "mLoadedConfig-mSecure-profiles.base.properties.password" (when doing readProfilesFromDisk) (als see this question on slack https://openmainframeproject.slack.com/archives/C010AUS5MK5/p1669033876331619)

This is reallly needed because we then don't have to worry about zowe cli installation (and we want to replace cli commands like zowe config set --global-config --secure with sdk methods..) then (don't need to install node/npm )...

relevant code:

await CredentialManagerFactory.initialize({ service: "zowe" });

const profInfo = new imperative.ProfileInfo("zowe");
await profInfo.readProfilesFromDisk({ projectDir: false });
const baseProfAttrs = profInfo.getDefaultProfile("base");
const baseMergedArgs = profInfo.mergeArgsForProfile(baseProfAttrs, { getSecureVals: true });

await profInfo.updateKnownProperty({ mergedArgs: baseMergedArgs, property: "password", value: "yes" });


Further details (if necessary):
dependencies:

"@zowe/imperative": "^5.7.2",
"@zowe/cli": "^7.8.0",
"@zowe/zos-files-for-zowe-sdk": "^7.8.0",
"@zowe/zos-ftp-for-zowe-cli": "2.1.0",
"@zowe/zos-jobs-for-zowe-sdk": "^7.8.0",
"@zowe/zos-tso-for-zowe-sdk": "^7.8.0",
"@zowe/zosmf-for-zowe-sdk": "^7.8.0",
"keytar": "7.9.0",

devdependencies:

...
"@types/node": "^18.0.3", 
"typescript": "^4.7.4"

zowe.config.json:

{
    "$schema": "./zowe.schema.json",
    "profiles": {
        "tso": {
            "type": "tso",
            "properties": {
                "account": "xxx",
                "codePage": "1141",
                "logonProcedure": "xxx",
                "characterSet": "695"
            },
            "secure": []
        },
        "ssh": {
            "type": "ssh",
            "properties": {
                "port": 22
            },
            "secure": []
        },
        "base": {
            "properties": {
                "host": "xxxx",
                "port": 443
            },
            "type": "base",
            "secure": [
                "user",
                "password"
            ]
        }
    },
    "defaults": {
        "tso": "tso",
        "ssh": "ssh",
        "base": "base"
    },
    "autoStore": true
}

cli works like expected from commandline...

thanks (this is done within a vscode extension )!

@gejohnston gejohnston added bug Something isn't working priority-medium Not functioning - next quarter if capacity permits labels Nov 28, 2022
@github-actions
Copy link

Thank you for creating a bug report.
We will investigate the bug and evaluate its impact on the product.
If you haven't already, please ensure you have provided steps to reproduce the bug and as much context as possible.

@gejohnston gejohnston added the severity-medium Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex. label Nov 28, 2022
@gejohnston
Copy link
Member

Efforts in the related slack conversation have identified no configuration error that would explain this bad behavior. Therefore, we should treat this as a more serious bug which could affect multiple consumers.

@gejohnston gejohnston added priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases for-review-pm and removed priority-medium Not functioning - next quarter if capacity permits severity-medium Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex. labels Nov 28, 2022
@kraabrsg
Copy link
Author

Hi @gejohnston any news on this, a fix would save us delivering a nodejs installation... Thanks!

@gejohnston
Copy link
Member

Hi @kraabrsg
We are still waiting for an opportunity for Product Management staff to review this issue and establish the priority. I will say that our upcoming quarter looks very busy. I do not know if time will be allocated to work on this issue in the next quarter. The Zowe quarterly planning meetings occur during the week of Jan 23, 2023. Some priorities may become more clear after those meetings. You are welcome to attend the planning breakout meetings for Zowe CLI, if you would like to further promote your needs.

@kraabrsg
Copy link
Author

Hi @gejohnston
thank you for the invitation, my colleaugue found a way around this, by mimic its behaviour and replacing what the commands are doing.

@gejohnston gejohnston added priority-medium Not functioning - next quarter if capacity permits severity-medium Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex. and removed for-review-pm priority-high Production outage - this quarter or at least next quarter severity-high Bug for which there may be workaround but limits the usage of the Zowe for major use cases labels Jan 23, 2023
@gejohnston
Copy link
Member

Because a workaround was identified, we changed severity and priority to medium. To provide input to any future implementation, can you elaborate more on the techniques used in your workaround?

@kraabrsg
Copy link
Author

Hi @gejohnston , well it is basically mimics
IProfArgAttrs]

at extensions start

await Promise.all(xxxx, ZoweCliZosmf.initZosmfSession());

the details:

export class ZoweCliZosmf {
    public static session: Session;


    public static async initZosmfSession() {
       //mimic iprofargsattrs to use keytar
        let args: IProfArgAttrs[] = [
            {
                argName: "port",
                dataType: "number",
                argValue: workspace.getConfiguration().get<number>("host.port"),
                argLoc: {
                    locType: 1
                },
                secure: false
            }, {
                argName: "host",
                dataType: "string",
                argValue: workspace.getConfiguration().get<number>("host.host"),
                argLoc: {
                    locType: 1
                },
                secure: false
            }, {
                argName: "rejectUnauthorized",
                dataType: "boolean",
                argValue: false,
                argLoc: {
                    locType: 1
                },
                secure: false
            }, {
                argName: "user",
                dataType: "string",
                argLoc: {
                    locType: 1
                },
                secure: true,
                argValue: workspace.getConfiguration().get<number>("host.user") ?? xxxx.user
            }, {
                argName: "password",
                dataType: "string",
                argLoc: {
                    locType: 1
                },
                secure: true,
                argValue: await keytar.getPassword("myhost-host", xxxx.getUser())
            }
        ];
        this.session = ProfileInfo.createSession(args);
    }
}

@t1m0thyj t1m0thyj moved this to Medium Priority in Zowe CLI Squad Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority-medium Not functioning - next quarter if capacity permits severity-medium Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.
Projects
Status: Medium Priority
Development

No branches or pull requests

2 participants