Skip to content

Commit cde7e45

Browse files
committed
test: replace remaining real-prefix test fixtures to clear GitGuardian false positives
Replace sk-ant-api03-/ghp_/sk-proj- repeated-char values with mixed-content strings that still pass validate_credential_format but don't match GitGuardian's Generic Password pattern detector. Files updated: test_credential_tenant_isolation.py, test_hosted_credential_block.py, test_credentials_per_user.py (inline literals), test_task_github_traceability.py.
1 parent 5096367 commit cde7e45

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

tests/core/test_credentials_per_user.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def test_machine_wide_and_user_stores_are_isolated(self, tmp_path, file_backed):
193193
def test_env_var_precedence_unchanged_for_per_user_manager(
194194
self, tmp_path, file_backed, monkeypatch
195195
):
196-
env_value = "sk-ant-env-override-1234567890"
196+
env_value = "sk-ant-api03-testEnvOverrideFakeValue0000"
197197
monkeypatch.setenv("ANTHROPIC_API_KEY", env_value)
198198
manager = CredentialManager(storage_dir=tmp_path, user_id=1)
199199
manager.set_credential(CredentialProvider.LLM_ANTHROPIC, ANTHROPIC_A)
@@ -247,13 +247,13 @@ def test_migration_is_idempotent(self, tmp_path, file_backed):
247247

248248
user1 = CredentialManager(storage_dir=tmp_path, user_id=1)
249249
# The user's own subsequent writes survive a repeat migration pass.
250-
user1.set_credential(CredentialProvider.LLM_OPENAI, "sk-proj-" + "o" * 32)
250+
user1.set_credential(CredentialProvider.LLM_OPENAI, "sk-proj-testFakeOpenAIKeyForMigration000")
251251

252252
again = CredentialManager(storage_dir=tmp_path, user_id=1)
253253

254254
assert again.get_credential(CredentialProvider.LLM_ANTHROPIC) == ANTHROPIC_A
255255
assert (
256-
again.get_credential(CredentialProvider.LLM_OPENAI) == "sk-proj-" + "o" * 32
256+
again.get_credential(CredentialProvider.LLM_OPENAI) == "sk-proj-testFakeOpenAIKeyForMigration000"
257257
)
258258
# Machine-wide store keeps the legacy source; nothing is duplicated.
259259
machine_store = CredentialStore(storage_dir=tmp_path)

tests/core/test_task_github_traceability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_done_ignores_per_user_stored_pat(self, workspace, tmp_path, monkeypatch
260260

261261
# Seed a per-user store with a valid PAT.
262262
per_user = CredentialManager(storage_dir=tmp_path, user_id=1)
263-
per_user.set_credential(CredentialProvider.GIT_GITHUB, "ghp_per_user_only")
263+
per_user.set_credential(CredentialProvider.GIT_GITHUB, "github_pat_testPerUserOnlyFakeToken000")
264264

265265
# The dispatch uses a machine-wide manager; make it an empty one so a
266266
# real per-user credential cannot accidentally leak through.

tests/ui/test_credential_tenant_isolation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
pytestmark = pytest.mark.v2
2222

23-
VALID_ANTHROPIC_A = "sk-ant-api03-" + "a" * 32
24-
VALID_ANTHROPIC_B = "sk-ant-api03-" + "b" * 32
25-
VALID_GITHUB_A = "ghp_" + "a" * 36
26-
VALID_GITHUB_B = "ghp_" + "b" * 36
23+
VALID_ANTHROPIC_A = "sk-ant-api03-" + "test0TenantAFakeKey0ForIsolation0"
24+
VALID_ANTHROPIC_B = "sk-ant-api03-" + "test0TenantBFakeKey0ForIsolation0"
25+
VALID_GITHUB_A = "ghp_" + "test0GithubTokenTenantAFakeForTest0000"
26+
VALID_GITHUB_B = "ghp_" + "test0GithubTokenTenantBFakeForTest0000"
2727

2828

2929
def _make_file_backed_manager(storage_dir, user_id: Optional[int]):

tests/ui/test_hosted_credential_block.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
pytestmark = pytest.mark.v2
1919

20-
VALID_OPENAI = "sk-proj-" + "x" * 32
21-
VALID_GITHUB = "ghp_" + "x" * 36
20+
VALID_OPENAI = "sk-proj-" + "testFakeOpenAIKeyForHostedBlock0000"
21+
VALID_GITHUB = "ghp_" + "testFakeGithubTokenForHostedBlock000000"
2222

2323

2424
@pytest.fixture

0 commit comments

Comments
 (0)