-
Notifications
You must be signed in to change notification settings - Fork 268
[Smart Hashing] Add eslint rule to limit usage of createHash from crypto module #2861
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
Conversation
.eslintrc.js
Outdated
{ | ||
selector: "ImportDeclaration[source.value='crypto'] ImportSpecifier[imported.name='createHash']", | ||
message: | ||
'Avoid importing the "createHash" function from "crypto". Use "destination-actions/lib/hashing-utils" instead.' |
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.
Should we also mention why they need to use hashing-utils and when?
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.
'Avoid importing the "createHash" function from "crypto". Use "destination-actions/lib/hashing-utils" instead.' | |
'The "destination-actions/lib/hashing-utils/processHashing" can autodetect prehashed values and avoid double hashing [link to doc]. Avoid importing the "createHash" function from "crypto"' |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2861 +/- ##
==========================================
+ Coverage 77.61% 77.93% +0.32%
==========================================
Files 1047 1047
Lines 19219 19246 +27
Branches 3750 3751 +1
==========================================
+ Hits 14916 14999 +83
+ Misses 2992 2925 -67
- Partials 1311 1322 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This PR adds a Es lint rule that restricts the usage of createHash from crypto module, to encourage the usage of Smart hashing module for hashing.
For other usage of Crypto module, Eslint disable is added.
Testing
Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.