microsoft / microsoft/react-native-windows

Weak cryptography by NodeJS library error

Open
#10,565 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: Compliance bug Workstream: ES Compliance SFI
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

Problem Description

CodeQL reports 1 Weak cryptography by NodeJS library error in the Hash.ts file.

Steps To Reproduce

Link to CodeQL (corpnet-only): https://onees.lgtm.microsoft.com/projects/u/gh/microsoft%2Freact-native-windows%2Ftree%2Fmain/alerts/?mode=tree&ruleFocus=1001395

Expected Results

No response

CLI version

npx react-native --version

Environment
npx react-native info
Target Platform Version

No response

Target Device(s)

No response

Visual Studio Version

No response

Build Configuration

No response

Snack, code example, screenshot, or link to a repository
Source root/packages/…/src/Hash.ts1 alert
1-51
52  
53 constructor(hashOpts?: HashOpts) {
54 this.hash = crypto.createHash('sha1');
  Weak hash algorithms are banned by the SDL. Switch to a SHA2 based cryptographic hash instead.
55 this.hashOpts = hashOpts || {};
56 }
57-106

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/react-native-platform-override/src/Hash.ts at the constructor on line 54, where the CodeQL alert identifies crypto.createHash('sha1'). Review the surrounding hash options and usage, then replace the weak hash with an appropriate SHA2-based hash and rerun the referenced CodeQL check to confirm the alert is cleared.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
cryptography, security
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.