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

FIX: Escaping Problem of Passwords on Import #2165

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NeoPlays
Copy link
Member

fixes #2163

//escape all passwords for shell
passwords = passwords.map((p) => {
let pass = p;
if (pass.includes('"')) pass = pass.replaceAll(/"/g, '\\"');
Copy link
Contributor

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')

Copy link
Member Author

@NeoPlays NeoPlays Jan 14, 2025

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 😅

Copy link
Member Author

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 \...

@NeoPlays NeoPlays marked this pull request as draft January 14, 2025 14:24
@NeoPlays NeoPlays requested a review from gbayasgalan January 17, 2025 14:53
@NeoPlays NeoPlays self-assigned this Jan 17, 2025
@NeoPlays NeoPlays marked this pull request as ready for review January 17, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Password with special Chars fail when trying to import key
2 participants