Skip to content

Fix-72650 Shell paths should be validated before launched to prevent ambiguous errors#72784

Merged
Tyriar merged 7 commits intomicrosoft:masterfrom
skprabhanjan:fix-72650
May 10, 2019
Merged

Fix-72650 Shell paths should be validated before launched to prevent ambiguous errors#72784
Tyriar merged 7 commits intomicrosoft:masterfrom
skprabhanjan:fix-72650

Conversation

@skprabhanjan
Copy link
Contributor

@Tyriar , Added the changes to handle file path check to resolve #72650 .
For the async problem that you had raised , I have used fs.existsSync ( https://nodejs.org/api/fs.html#fs_fs_existssync_path)
Please review this and let me know if anything is not rite or needs to be changed , Thanks :)

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this, got some comments below

@skprabhanjan
Copy link
Contributor Author

@Tyriar , I have changed as per your comments , Please check and review the same :)

PS : I felt the try catch was no more required as the catch block was meant to catch only file not found exceptions.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just to be safe we should be checking if (this._ptyProcess) instead of using !, otherwise null pointer exceptions could slip in.

@skprabhanjan
Copy link
Contributor Author

skprabhanjan commented May 1, 2019

@Tyriar , Changes are done as per your reviews .
Added a new function setupPtyProcess which will be called in ctor if the file is found , Handled the error part first :)
Let me know if we do not need this new function and have to add the code there itself :)

PS: The build is still failing but not sure exactly why and is it because of these changes .

@Tyriar
Copy link
Member

Tyriar commented May 1, 2019

Wow my exitCodeMessage code really became a mess over time 😅, I cleaned that up a bit, also the path.basename was preventing the stat from working properly before.

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @skprabhanjan, provided tests pass this time I'll merge this in for May soon 👍

@Tyriar Tyriar added this to the May 2019 milestone May 1, 2019
@skprabhanjan
Copy link
Contributor Author

@Tyriar, Thanks for the cleanup and few code changes related to path.basename :)
Yes if the tests pass then good to go , Thanks for reviewing it and getting this done from me :)

@Tyriar Tyriar merged commit a2259ee into microsoft:master May 10, 2019
@skprabhanjan skprabhanjan deleted the fix-72650 branch May 14, 2019 05:11
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell paths should be validated before launched to prevent ambiguous errors

3 participants