mirror of
https://github.com/Shiva108/ai-llm-red-team-handbook.git
synced 2026-02-12 14:42:46 +00:00
- Extracted all code examples from handbook chapters - Organized into 15 attack categories - Created shared utilities (api_client, validators, logging, constants) - Added workflow orchestration scripts - Implemented install.sh for easy setup - Renamed all scripts to descriptive functional names - Added comprehensive README and documentation - Included pytest test suite and configuration
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Testing API Provider Security
|
|
|
|
Source: Chapter_13_Data_Provenance_and_Supply_Chain_Security
|
|
Category: supply_chain
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
def test_api_provider_security(api_endpoint, api_key):
|
|
"""Red team tests for API security"""
|
|
|
|
tests = []
|
|
|
|
# Test 1: API key exposure
|
|
tests.append(test_api_key_in_errors(api_endpoint))
|
|
|
|
# Test 2: Rate limiting
|
|
tests.append(test_rate_limiting(api_endpoint, api_key))
|
|
|
|
# Test 3: Input validation
|
|
tests.append(test_input_injection(api_endpoint, api_key))
|
|
|
|
# Test 4: Data leakage
|
|
tests.append(test_cross_tenant_isolation(api_endpoint, api_key))
|
|
|
|
# Test 5: TLS/encryption
|
|
tests.append(test_encryption_standards(api_endpoint))
|
|
|
|
return generate_security_report(tests)
|
|
|
|
|
|
def main():
|
|
"""Command-line interface."""
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("--verbose", "-v", action="store_true", help="Verbose output")
|
|
args = parser.parse_args()
|
|
|
|
# TODO: Add main execution logic
|
|
pass
|
|
|
|
if __name__ == "__main__":
|
|
main() |