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

highlight-words libray is giving Math.random vunerbility scan as high #34

Closed
shajithomas32 opened this issue Jan 19, 2024 · 6 comments
Closed
Labels
wontfix This will not be worked on

Comments

@shajithomas32
Copy link

shajithomas32 commented Jan 19, 2024

highlight-words library is giving Math.random vulnerability scan as high, can we please fix it soon and get a new version

That probably means you (or a plugin you are using) is using the JS native Math.random() which has been deemed insecure. You can replace those functions with the latest JS crypto stuff here: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues

We are using Material-React-Table, and this is the only high warning we got because highlight-words is used by Material-React-Table. No other libraries used by Material-React-Table gave any warning. That probably means you (or a plugin you are using) is using the JS native Math.random() which has been deemed insecure. You can replace those functions with the latest JS crypto stuff here as a recommendation. What you commented makes sense, but if you can replace Math.random(), it will make our scan clean. We mentioned it only because this is the only warning we got when using Material-React-Table and sometimes companies refuse to use it just because of the warning even though its not anything significant. See the attached screenshot.

2024_01_19_20_33_54_Settings

@shajithomas32
Copy link
Author

shajithomas32 commented Jan 20, 2024

#35 , can you apply this pull request it if you are ok with it or fix like you wanted

@shajithomas32
Copy link
Author

Sir can you please look the pr I created

@tricinel
Copy link
Owner

Hi @shajithomas32! Thanks for taking a look at this. I don't really see the security issue though. The Math.random call is just to generate an ID with no overhead. It's not mean to be secure or unpredictable - just unique enough in most situations.

I'd say...if this is the only security problem with your app, then you're doing better than 99% of the apps out there. Congrats!

For us, the overhead of using crypto isn't worth it.

Seeing how you've PRed already, it means you can already use your code in your app if you so choose. To do this, you can make use of npm overrides, as documented here.

Essentially, do this:

{
  "overrides": {
    "highlight-words": "git://github.com/shajithomas32/highlight-words.git"
  }
}

So no matter what your dependencies use, you'll pull in your code.

@tricinel tricinel added the wontfix This will not be worked on label Jan 22, 2024
@shajithomas32
Copy link
Author

shajithomas32 commented Jan 22, 2024 via email

@tricinel
Copy link
Owner

Yes, that's what overrides does.

@shajithomas32
Copy link
Author

Thanks for your work around solution suggestion. But you can consider this request in future because it help us with the scan paper work. We got this scan result from fortify scan. Recommend highly to do scans because companies are strict with scan results even though scan results don't make sense in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants