openshift / console

OpenShift Cluster Console UI
https://www.openshift.org
Apache License 2.0
401 stars 613 forks source link

OCPBUGS-44505: remove crypto-browserify library and use Crypto instead #14507

Open Mylanos opened 4 days ago

Mylanos commented 4 days ago

This PR replaces the use of crypto-browserify for generating a hash for a given username with the native Crypto object and its subtle.digest method, which is supported in all browsers compatible with v4.18. This way we not only remove unnecessary dependencies, but also use browser-optimized native cryptographic functionality.

Changes in this PR:

Analysis: The way we generated the hashes inside of the useSelector hook call for userUid retrieval, had to be refined as the subtle.digest returns a Promise and the useSelector hook should remain synchronous by design. I split the hook call into two parts, where the first part only retrieves the userImpersonateNameOrUID and the second one username. The username contents change is used to active an effect which generates its unique identifier/hash into uniqueUsername. The userUid is then initialized based on the prior implementation userImpersonateNameOrUID || uniqueUsername.

openshift-ci-robot commented 4 days ago

@Mylanos: This pull request references Jira Issue OCPBUGS-44505, which is invalid:

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to [this](https://github.com/openshift/console/pull/14507): > Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=openshift%2Fconsole). If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
Mylanos commented 3 days ago

/jira refresh

openshift-ci-robot commented 3 days ago

@Mylanos: This pull request references Jira Issue OCPBUGS-44505, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug * bug is open, matching expected state (open) * bug target version (4.18.0) matches configured target version for branch (4.18.0) * bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact: /cc @yapei

In response to [this](https://github.com/openshift/console/pull/14507#issuecomment-2485555448): >/jira refresh > Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=openshift%2Fconsole). If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
cyril-ui-developer commented 1 day ago

/retest

Mylanos commented 23 hours ago

/retest

Mylanos commented 7 hours ago

/retest

openshift-ci[bot] commented 4 hours ago

@Mylanos: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console c771cf1d2e1dac5526e99c783bc3e402c89210c5 link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
openshift-ci[bot] commented 1 hour ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Mylanos, spadgett

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[frontend/OWNERS](https://github.com/openshift/console/blob/master/frontend/OWNERS)~~ [spadgett] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment