-
-
Notifications
You must be signed in to change notification settings - Fork 55
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: Escaping Problem of Passwords on Import #2165
Conversation
//escape all passwords for shell | ||
passwords = passwords.map((p) => { | ||
let pass = p; | ||
if (pass.includes('"')) pass = pass.replaceAll(/"/g, '\\"'); |
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.
Is it better to use a library to escape all potential special characters rather than manually escaping only some of them? For example: require('shell-escape')
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.
they're escaped by JSON.stringify. The main problem are the double and single quotes. And because JSON.stringify already does escaping i need to remove the extra \
introduced with '\''
, which i use to escape single quotes because all other variants i tried didn't work. This means that some library wont help either. This was all more complex then i thought tbh 😅
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.
but i think there is another problem when the password includes \
...
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.
so everthing should be fixed now 😅
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.
nice 👍🚀
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 🚀
fixes #2163