Files
Alexander Myasoedov 8c956e0cb4 Harden the LLM judge, redact secrets in logs, add contributor docs
- Fence the target model's output in a <target_output> block the output
  can't close, so a jailbroken reply can't steer the judge's verdict.
- Mask credentials (secret query params, Bearer tokens, x-api-key, sk-/
  sk-ant-/hf_/AKIA keys) in every log record; hold httpcore at WARNING.
- Add a localhost OpenAI/Anthropic stand-in (tests/fakes) and a
  fake_llm_api fixture; it records header names only.
- Replace any set *_API_KEY with a placeholder in tests unless marked live.
- Add CONTRIBUTING.md, CLAUDE.md, a PR template and a real SECURITY.md.
2026-11-25 17:51:06 +02:00

17 lines
504 B
Python

"""The conftest isolation fixture keeps real keys out of unit tests."""
import os
from tests.conftest import PLACEHOLDER_API_KEY
def test_set_api_keys_are_replaced_with_a_placeholder():
for name, value in os.environ.items():
if name.endswith("_API_KEY") and value:
assert value == PLACEHOLDER_API_KEY, name
def test_monkeypatch_inside_a_test_still_wins(monkeypatch):
monkeypatch.setenv("OPENAI_API_KEY", "test-key")
assert os.environ["OPENAI_API_KEY"] == "test-key"