-
Notifications
You must be signed in to change notification settings - Fork 613
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
OCPBUGS-44505: remove crypto-browserify library and use Crypto instead #14507
base: master
Are you sure you want to change the base?
OCPBUGS-44505: remove crypto-browserify library and use Crypto instead #14507
Conversation
@Mylanos: This pull request references Jira Issue OCPBUGS-44505, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
…m the Crypto object
abdbd47
to
c771cf1
Compare
/jira refresh |
@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
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
/retest |
2 similar comments
/retest |
/retest |
@Mylanos: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
👍
[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:
Approvers can indicate their approval by writing |
This PR replaces the use of
crypto-browserify
for generating a hash for a given username with the nativeCrypto
object and itssubtle.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:
crypto-browserify
's createHash function with a newly implementedgenerateHash
function that utilizes browser-nativeCrypto.subtle.digest
.Analysis:
The way we generated the hashes inside of the
useSelector
hook call foruserUid
retrieval, had to be refined as thesubtle.digest
returns aPromise
and theuseSelector
hook should remain synchronous by design. I split the hook call into two parts, where the first part only retrieves theuserImpersonateNameOrUID
and the second oneusername
. Theusername
contents change is used to active an effect which generates its unique identifier/hash intouniqueUsername
. TheuserUid
is then initialized based on the prior implementationuserImpersonateNameOrUID || uniqueUsername
.