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

Cannot execute ProjectFileParser.exe from user's temp dir in Windows 7 #28

Open
tekuser opened this issue Apr 22, 2015 · 7 comments
Open

Comments

@tekuser
Copy link
Contributor

tekuser commented Apr 22, 2015

Hello,

I am using Windows 7 and gradle is not able to execute ProjectFileParser.exe from the users's temp directory (C:\Users\XXX\AppData\Local\Temp).

After a search on google, it seems that the problem comes from the security permission on the temp folder. The user should take ownership and full control of the temp folder.

Anyway, I think that it would be great to add a property (parserTempDir) to the MsBuild task. If this property is null we save the ProjectFileParser.exe in the user temp dir otherwise we save the file in the parserTempDir. So we can do something like that in Gradle:

msbuild {
parserTempDir = temporaryDir
...
}

With this, the ProjectFileParser will be saved in the build/tmp/msbuild directory.

@tekuser
Copy link
Contributor Author

tekuser commented Apr 23, 2015

Well, in fact, for security reasons, it is possible in windows to forbid the execution of a program from the local temp dir. This is the case where I am working. So the only way for me to use this plugin is the copy the ProjectFileParser.exe file in the gradle's temporaryDir.

@gluck
Copy link
Contributor

gluck commented Apr 24, 2015

it should extract to gradleUserHome dir (~/.gradle) instead (where gradle already put its binaries from wrapper download). Do you know if this folder would be executable-friendly (I'd think it is) ?

@tekuser
Copy link
Contributor Author

tekuser commented Apr 24, 2015

It extracts to the user's temp directory because of this instruction:
def tmp = File.createTempFile('ProjectFileParser', '.exe')

createTempFile will create a temporary file in the user's temp dir (C:\Users\XXX\AppData\Local\Temp)

I think it is better to extract to the gradle build directory of the plugin (build/tmp/msbuild/). This can be done by using the temporaryDir in the msbuild block.

I have done a correction here:
tekuser@master

Do you think that it can be useful to merge to your master branch?

@roshangautam
Copy link

FYI, this is back @tekuser @gluck. The binary is put in users temp folder and if there is a controlled security policy (managed by IT) which do not allow executing binaries from temp folder this causes problems

@timotei timotei reopened this Sep 10, 2019
@timotei
Copy link
Contributor

timotei commented Sep 10, 2019

@roshangautam are you using the latest version which contains the fix? We're using gradle's temporary directory now, but maybe it's still generating in the temp directory upon whatever reasons? The documention is not very clear on where the provided temp directory resides

@tekuser
Copy link
Contributor Author

tekuser commented Sep 10, 2019

I did a fix to put the binary in the plugin directory but it seems that the commit below rolled back to use the user temp directory:
ad1ab3a

file: src/main/groovy/com/ullink/Msbuild.groovy
line 76:
File tempDir = Files.createTempDirectory('ProjectFileParser').toFile()

It is not a good idea to extract an exe file into a user temp directory and to execute it from there. Some antivirus may take it for a malware.

@roshangautam
Copy link

@timotei Yes, I am using the latest version. Like @tekuser said the fix has been reverted by the above mentioned commit.

ngyukman added a commit to ngyukman/gradle-msbuild-plugin that referenced this issue Nov 1, 2019
- some anti-virus does not like running executable in user dir
- regression for issue Itiviti#28

Change-Id: I93b7d89d7daa831ef05a812f5a69fe0c1fea7a07
ngyukman added a commit to ngyukman/gradle-msbuild-plugin that referenced this issue Nov 1, 2019
- some anti-virus does not like running executable in user dir
- regression for issue Itiviti#28

Change-Id: I93b7d89d7daa831ef05a812f5a69fe0c1fea7a07
ngyukman added a commit that referenced this issue Nov 11, 2019
- some anti-virus does not like running executable in user dir
- regression for issue #28

Change-Id: I93b7d89d7daa831ef05a812f5a69fe0c1fea7a07
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

No branches or pull requests

4 participants