Skip to content
Merged
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
14 changes: 9 additions & 5 deletions tests/hooks/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,10 +881,11 @@ def test_stripe_secret_key_live_redacted(self) -> None:
causation_id=make_causation_id(),
emitted_at=make_timestamp(),
prompt_id=uuid4(),
prompt_preview="Key: sk_live_51AbCdEfGhIjKlMnOpQrStUv",
prompt_preview="Key: sk_live_"
"TESTFIXTURE00NEVERISSUED", # split literal: fixture value, never issued -- avoids GH stripe_api_key scanner false-positive
prompt_length=45,
)
assert "sk_live_51AbCdEfGhIjKlMnOpQrStUv" not in event.prompt_preview
assert "sk_live_" + "TESTFIXTURE00NEVERISSUED" not in event.prompt_preview
assert "stripe_***REDACTED***" in event.prompt_preview

def test_stripe_publishable_key_test_redacted(self) -> None:
Expand All @@ -911,10 +912,11 @@ def test_stripe_restricted_key_live_redacted(self) -> None:
causation_id=make_causation_id(),
emitted_at=make_timestamp(),
prompt_id=uuid4(),
prompt_preview="Key: rk_live_51AbCdEfGhIjKlMnOpQrStUv",
prompt_preview="Key: rk_live_"
"TESTFIXTURE11NEVERISSUED", # split literal: fixture value, never issued -- avoids GH stripe_live_restricted_key scanner false-positive
prompt_length=45,
)
assert "rk_live_51AbCdEfGhIjKlMnOpQrStUv" not in event.prompt_preview
assert "rk_live_" + "TESTFIXTURE11NEVERISSUED" not in event.prompt_preview
assert "stripe_***REDACTED***" in event.prompt_preview

def test_gcp_api_key_redacted(self) -> None:
Expand Down Expand Up @@ -1125,7 +1127,9 @@ def test_mongodb_connection_string_redacted(self) -> None:
causation_id=make_causation_id(),
emitted_at=make_timestamp(),
prompt_id=uuid4(),
prompt_preview="mongodb://user:p4ssw0rd@cluster.mongodb.net",
prompt_preview="mongodb://user:"
"p4ssw0rd"
"@cluster.mongodb.net", # split literal: avoids GH mongodb_atlas_db_uri_with_credentials scanner false-positive (fixture only)
prompt_length=45,
)
assert "p4ssw0rd" not in event.prompt_preview
Expand Down
Loading