Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 mitreattack/diffStix/changelog_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,7 @@
if markdown_file:
logger.info("Writing markdown to file")
Path(markdown_file).parent.mkdir(parents=True, exist_ok=True)
with open(markdown_file, "w") as file:
with open(markdown_file, "w", encoding="utf-8") as file:

Check failure on line 2432 in mitreattack/diffStix/changelog_helper.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Path Traversal via faulty LLM-supplied CLI arguments in changelog_helper.get_new_changelog_md()

See more on https://sonarcloud.io/project/issues?id=mitre-attack_mitreattack-python&issues=AaDzhHGbh1DJNTFv2PIH&open=AaDzhHGbh1DJNTFv2PIH&pullRequest=246
file.write(md_string)

if html_file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_end_to_end_output_generation(self, minimal_stix_bundles, tmp_path, setu
assert Path(layer_files[0]).exists()

# Verify markdown file content
markdown_content = markdown_file.read_text()
markdown_content = markdown_file.read_text(encoding="utf-8")
assert markdown_content == markdown_result
assert "## Key" in markdown_content

Expand Down
4 changes: 2 additions & 2 deletions tests/changelog/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def validate_markdown_file_content(file_path: Union[str, Path]) -> str:
path_obj = Path(file_path)
assert path_obj.exists(), f"Markdown file should exist at {file_path}"

content = path_obj.read_text()
content = path_obj.read_text(encoding="utf-8")
assert_basic_markdown_structure(content)
return content

Expand Down Expand Up @@ -405,7 +405,7 @@ def validate_comprehensive_output_generation(

# Validate markdown file content matches return value
if "markdown" in file_paths:
file_content = Path(file_paths["markdown"]).read_text()
file_content = Path(file_paths["markdown"]).read_text(encoding="utf-8")
assert file_content == markdown_result, "Markdown file content should match return value"


Expand Down