-
Notifications
You must be signed in to change notification settings - Fork 980
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
Avoid Path.GetTempFileName() due to CWE 377. #537
Comments
The referenced code is
The suggested solution does not seem to corelate with the CWE. What static code analysis tool was used to produce these? |
Veracode. Yes, avoiding temporary files altogether is a solution. |
If that's the 'safe' update mode code, then using temp/internediate files to do the update is the point? (not sure if just doing it in memory would work, given the attempts to roll back changes on error and such?) |
@Numpsy I don't see how using a |
I went with the easy fix for now anyway, making sure that the file updates work with a |
I was just looking at all the file copying logic in
Other than that, it could potentially require a lot more memory when doing small updates to massive files? |
Code scan now passes for 2 of the 3 risk areas. This one is still unresolved at line 827 in TarArchive.cs.
|
Steps to reproduce
Expected behavior
Use sufficiently random names for temporary files to prevent attacks which can predict the name of the file. For example, a Guid or crypto generated random number.
Actual behavior
Security scan failure.
Version of SharpZipLib
1.3.0
Obtained from (only keep the relevant lines)
The text was updated successfully, but these errors were encountered: