Skip to content

Avoid Path.GetTempFileName() due to CWE 377. #537

@tdhintz

Description

@tdhintz

Steps to reproduce

  1. Static code security scan. Example:
		private static string GetTempFileName(string original, bool makeTempFile)
		{
			string result = null;

			if (original == null)
			{
				result = Path.GetTempFileName();
			}

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)

  • Package installed using NuGet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions