-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix SNYK-JS-ANSIREGEX-1583908 and move to ESM #4748
Comments
We get security issues like this one on a regular basis.
|
I have used a simpler variant in one other project of mine (note that it dose not take into consideration the characters width) export function alignLeft(str, width) {
return String(str).slice(0, width).padEnd(width)
}
export function alignRight(str, width) {
return String(str).slice(0, width).padStart(width)
}
export function alignCenter(str, width) {
const internalString = String(str)
const leftPadding = Math.floor((width - internalString.length) / 2) + internalString.length
return internalString.padStart(leftPadding).padEnd(width).slice(0, width)
} |
honestly, now when i looked at what you used mocha/lib/cli/one-and-dones.js Lines 32 to 36 in 27bfc74
then i don't think the i say: remove the wide-align dependency (and don't replace it with something else) |
I don't have an opinion here as to if you should use |
@dhuang612 are you interested in removing dependency |
Hi, |
No |
Sure, I can try to work on this |
@dhuang612 I will publish a new release this weekend, probably. |
I am really busy over this next week and wouldn't have time to get to it before October. |
Is your feature request related to a problem or a nice-to-have?? Please describe.
As of https://snyk.io/vuln/SNYK-JS-ANSIREGEX-1583908 my investigations lead to mocha referencing the vulnerability by peer dependencies of
"wide-align": "v1.1.3"
->"string-width": "^1.0.2 || 2"
->"strip-ansi": "^4.0.0"
->"ansi-regex": "^3.0.0"
.Describe the solution you'd like
Forcing @iarna to accept iarna/wide-align#57 from @jimmywarting will update
"string-width": "^5.0.1"
resulting in a fix of https://snyk.io/vuln/SNYK-JS-ANSIREGEX-1583908 with peer-dependencies"strip-ansi": "^7.0.1"
->"ansi-regex": "^6.0.1"
. It will require some changes towards ESM on mocha-side too:mocha/lib/cli/one-and-dones.js
Line 11 in 27bfc74
Describe alternatives you've considered
Alternatively the use of @jimmywarting branch https://github.com/jimmywarting/wide-align/tree/esm as dependency, or investigation of a replacement for
string-width
are thinkable.The text was updated successfully, but these errors were encountered: