Files
Hanzo Dev 67592ef116 Add comprehensive test suite with runtime-generated secrets
- 70+ tests covering regex-based sanitization
- API keys: OpenAI, Anthropic, GitHub, HuggingFace, Stripe, SendGrid, Google, AWS
- Crypto: Private keys, ETH/BTC addresses, seed phrases
- Financial: Credit cards, SSN
- PII: Email addresses
- Context preservation tests
- Edge cases and JSONL processing

Security: All test secrets generated at runtime to avoid GitHub secret scanning
- No hardcoded secrets in test files
- Uses random generators for realistic test patterns
- Follows security best practices

CI: GitHub Actions workflow for multi-OS/Python testing with coverage
2025-11-14 06:46:51 -08:00

86 lines
2.0 KiB
YAML

name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"
- name: Run tests with pytest
run: |
pytest tests/ -v --cov=claude_sanitizer --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Lint with ruff
run: |
ruff check claude_sanitizer/ tests/ --select E,F,W,I
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bandit safety
- name: Security audit with bandit
run: |
bandit -r claude_sanitizer/ -f json -o bandit-report.json || true
bandit -r claude_sanitizer/ || true
- name: Check dependencies with safety
run: |
pip install -e .
safety check --json || true