Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Jan 11, 2019

PR Summary

One reported case where during applocker policy check, the test script that is created cannot be deleted because something else (malware scanner?) has a lock on the file. This results in an exception being thrown in finally block which ultimately causes PowerShell to crash due to the unhandled exception. Fix is to wrap the deletion in the finally block with try..catch and ignore any exceptions and leave the temp file.

TFS:20156282

PR Checklist

@iSazonov iSazonov added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label Jan 12, 2019
@iSazonov
Copy link
Collaborator

iSazonov commented Jan 12, 2019

If we can not delete the file is it secure to leave it on file system?

@SteveL-MSFT
Copy link
Member Author

@iSazonov yes, the test script is harmless and doesn't expose anything, it just validates whether scripts can be run or not. It is not ideal to leave the file in the temp folder, but worse is to prevent PowerShell from starting simply because something else decided to lock that file.

@SteveL-MSFT
Copy link
Member Author

@PaulHigin can you take another look? Made some changes based on feedback

@iSazonov
Copy link
Collaborator

@TravisEz13 Please merge the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants