mirror of
https://github.com/Shiva108/ai-llm-red-team-handbook.git
synced 2026-05-14 20:58:09 +02:00
b3d3bac51f
- 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
44 lines
1.2 KiB
Python
44 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Validating Training Data Authenticity
|
|
|
|
Source: Chapter_13_Data_Provenance_and_Supply_Chain_Security
|
|
Category: supply_chain
|
|
"""
|
|
|
|
import argparse
|
|
import sys
|
|
|
|
def verify_data_sources(data_manifest):
|
|
"""Check that training data comes from expected sources"""
|
|
|
|
issues = []
|
|
|
|
for data_item in data_manifest:
|
|
# Check source URL is legitimate
|
|
if not is_trusted_source(data_item['source_url']):
|
|
issues.append(f"Untrusted source: {data_item['source_url']}")
|
|
|
|
# Verify data checksum
|
|
actual_hash = compute_hash(data_item['file_path'])
|
|
if actual_hash != data_item['expected_hash']:
|
|
issues.append(f"Data integrity violation: {data_item['file_path']}")
|
|
|
|
# Check license compliance
|
|
if not is_license_compatible(data_item['license']):
|
|
issues.append(f"License issue: {data_item['license']}")
|
|
|
|
return issues
|
|
|
|
|
|
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() |