Skip to content

OpenAI's Codex Security CLI and TypeScript SDK for finding, validating, and fixing security vulnerabilities. npm: https://www.npmjs.com/package/@openai/codex-security

fix(ci): preserve LF Python source checkouts (#726)

faizan-oai6f9257814d6b
diff --git a/.gitattributes b/.gitattributes
index a007cadeb..a411474ea 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3,6 +3,7 @@
*.json text eol=lf
*.md text eol=lf
*.mjs text eol=lf
+*.py text eol=lf
*.sh text eol=lf
*.ts text eol=lf
*.tsx text eol=lf
diff --git a/.github/scripts/test_check_plugin_source_compatibility.py b/.github/scripts/test_check_plugin_source_compatibility.py
index b0cd1093c..f49a80420 100644
--- a/.github/scripts/test_check_plugin_source_compatibility.py
+++ b/.github/scripts/test_check_plugin_source_compatibility.py
@@ -63,6 +63,30 @@ def test_accepts_valid_source_and_ignores_untracked_files(tmp_path: Path) -> Non
assert result.stderr == ""
+def test_python_checkout_preserves_source_size_with_autocrlf(tmp_path: Path) -> None:
+ attributes = CHECKER.parents[2] / ".gitattributes"
+ (tmp_path / ".gitattributes").write_bytes(attributes.read_bytes())
+ source = tmp_path / "module.py"
+ content = b"pass\n" * 30_000
+ source.write_bytes(content)
+ initialize_repository(tmp_path)
+ subprocess.run(
+ ["git", "-C", str(tmp_path), "config", "--local", "core.autocrlf", "true"],
+ check=True,
+ )
+ track(tmp_path, ".gitattributes", "module.py")
+ source.unlink()
+ subprocess.run(
+ ["git", "-C", str(tmp_path), "checkout-index", "--", "module.py"],
+ check=True,
+ )
+
+ result = run_checker(tmp_path)
+
+ assert result.returncode == 0, result.stderr
+ assert source.read_bytes() == content
+
+
def test_accepts_prose_after_an_opening_thematic_break(tmp_path: Path) -> None:
(tmp_path / "README.md").write_text(
"""---