Skip to content

Commit 48c21f8

Browse files
authored
Merge branch 'main' into dependabot/uv/uv-22e9261afe
2 parents 9dceb7e + a8b7407 commit 48c21f8

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

tests/test_default_ignores.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def test_git_directory_ignored(temp_project, run_mapper):
9090
def test_default_private_key_ignores(temp_project, run_mapper):
9191
secrets = ["server.pem", "tls.key", "keystore.p12", "app.pfx", "app.jks", "id_rsa", "id_ed25519"]
9292
for secret in secrets:
93-
(temp_project / secret).write_text("-----BEGIN PRIVATE KEY-----\ndo-not-leak\n", encoding="utf-8")
93+
(temp_project / secret).write_text("private-key-material do-not-leak\n", encoding="utf-8")
9494

9595
kept = ["id_rsa.pub", "config.py", ".env"]
9696
for f in kept:

tests/test_secret_ignores_diff.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
from __future__ import annotations
22

33
import diffctx
4-
54
from tests.framework.pygit2_backend import Pygit2Repo
65

76

87
def _build_repo_with_changed_private_keys(tmp_path):
98
repo = Pygit2Repo(tmp_path / "repo")
109
repo.add_file("app.py", "import os\nKEY = os.environ['K']\n")
11-
repo.add_file("id_rsa", "-----BEGIN PRIVATE KEY-----\nLEAK_RSA_INITIAL\n")
12-
repo.add_file("tls.key", "-----BEGIN PRIVATE KEY-----\nLEAK_KEY_INITIAL\n")
10+
repo.add_file("id_rsa", "private-key-material LEAK_RSA_INITIAL\n") # pragma: allowlist secret
11+
repo.add_file("tls.key", "private-key-material LEAK_KEY_INITIAL\n") # pragma: allowlist secret
1312
repo.add_file("server.pem", "-----BEGIN CERTIFICATE-----\nLEAK_PEM_INITIAL\n")
1413
repo.commit("initial")
1514

1615
repo.add_file("app.py", "import os\nKEY = os.environ['K']\nTOKEN = os.environ['T']\n")
17-
repo.add_file("id_rsa", "-----BEGIN PRIVATE KEY-----\nLEAK_RSA_CHANGED\n")
18-
repo.add_file("tls.key", "-----BEGIN PRIVATE KEY-----\nLEAK_KEY_CHANGED\n")
16+
repo.add_file("id_rsa", "private-key-material LEAK_RSA_CHANGED\n") # pragma: allowlist secret
17+
repo.add_file("tls.key", "private-key-material LEAK_KEY_CHANGED\n") # pragma: allowlist secret
1918
repo.add_file("server.pem", "-----BEGIN CERTIFICATE-----\nLEAK_PEM_CHANGED\n")
2019
repo.commit("change app and private keys")
2120
return repo
@@ -28,9 +27,7 @@ def test_diff_context_excludes_changed_private_keys(tmp_path):
2827
repo = _build_repo_with_changed_private_keys(tmp_path)
2928

3029
for full in (False, True):
31-
rendered = diffctx.to_yaml(
32-
diffctx.build_diff_context(root_dir=repo.path, diff_range="HEAD~1", full=full)
33-
)
30+
rendered = diffctx.to_yaml(diffctx.build_diff_context(root_dir=repo.path, diff_range="HEAD~1", full=full))
3431
for marker in SECRET_MARKERS:
3532
assert marker not in rendered, (full, marker)
3633
assert "id_rsa" not in rendered and "tls.key" not in rendered and "server.pem" not in rendered

0 commit comments

Comments
 (0)