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

chore: use unique tempdir prefixes in fuzzing temp dirs (fixes: #3960) #4022

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fuzz/fuzz_cargo_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def TestParseData(data, cve_db, logger, tmpdir):


def main():
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_RUST")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_composer_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-fuzz-php")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_PHP")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_cpanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-fuzz-perl")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_PERL")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
3 changes: 2 additions & 1 deletion fuzz/fuzz_cyclonedx.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def TestParseData(data):


file_path = str(
Path(tempfile.mkdtemp(prefix="cve-bin-tool-")) / "test_intermediate.json"
Path(tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_CYCLONEDX"))
/ "test_intermediate.json"
)
atheris_libprotobuf_mutator.Setup(sys.argv, TestParseData, proto=cyclonedx_pb2.Cyclone)
atheris.Fuzz()
2 changes: 1 addition & 1 deletion fuzz/fuzz_gemfile_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def TestParseData(data, cve_db, logger, tmpdir):


def main():
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-fuzz-ruby-")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_RUBY")

try:
atheris_libprotobuf_mutator.Setup(
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_go.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_GO")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
3 changes: 2 additions & 1 deletion fuzz/fuzz_intermediate_report_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ def TestParseData(data):


file_path = str(
Path(tempfile.mkdtemp(prefix="cve-bin-tool-")) / "test_intermediate.json"
Path(tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_INTERMEDIATE_REPORT"))
/ "test_intermediate.json"
)
atheris_libprotobuf_mutator.Setup(
sys.argv, TestParseData, proto=intermediate_report_pb2.IntermediateReport
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_package_list_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def TestPackageData(data):
TestListParser(str(tempdir / "test_requirements.txt"), with_version)


tempdir = Path(tempfile.mkdtemp(prefix="cve-bin-tool-"))
tempdir = Path(tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_PACKAGE_LIST"))
atheris_libprotobuf_mutator.Setup(
sys.argv, TestPackageData, proto=packages_pb2.PackageList
)
Expand Down
4 changes: 3 additions & 1 deletion fuzz/fuzz_package_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ def TestParseData(data):
return


file_path = str(Path(tempfile.mkdtemp(prefix="cve-bin-tool-")) / "package_lock.json")
file_path = str(
Path(tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_JAVASCRIPT")) / "package_lock.json"
)

atheris_libprotobuf_mutator.Setup(
sys.argv, TestParseData, proto=package_lock_pb2.PackageLock
Expand Down
5 changes: 4 additions & 1 deletion fuzz/fuzz_package_resolved.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ def TestParseData(data):
return


file_path = str(Path(tempfile.mkdtemp(prefix="cve-bin-tool-")) / "Package.resolved")
file_path = str(
Path(tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_PACKAGE_RESOLVED"))
/ "Package.resolved"
)

atheris_libprotobuf_mutator.Setup(
sys.argv, TestParseData, proto=package_resolved_pb2.PackageResolved
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_pkg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-fuzz-python")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_PYTHON")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_pom_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_JAVA")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_pubspec_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_DART")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_python_requirement_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-fuzz-python-requirements")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_PYTHON_REQUIREMENTS")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/fuzz_renv_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def TestParseData(data, cve_db, logger, tmpdir):

def main():
"""Main Function to Run Fuzzing and Facilitate Tempfile cleanup."""
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-fuzz-renv-")
tmpdir = tempfile.mkdtemp(prefix="cve-bin-tool-FUZZ_R")
try:
atheris_libprotobuf_mutator.Setup(
sys.argv,
Expand Down
2 changes: 1 addition & 1 deletion fuzz/generated/cargo_lock_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fuzz/generated/composer_lock_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fuzz/generated/pom_xml_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading