refactor: let Claude handle security checks intelligently

- Remove brittle hardcoded API key checks from validate_notebooks.py
- Enhance Claude review to check for any secrets (not just Anthropic)
- Claude understands context (e.g., educational 'bad examples' are OK)
This commit is contained in:
Alex Notov
2025-09-07 16:50:53 -06:00
parent 027216e0d6
commit 97647e97e2
2 changed files with 4 additions and 9 deletions

View File

@@ -25,14 +25,6 @@ def validate_notebook(path: Path) -> list:
if output.get('output_type') == 'error':
issues.append(f"Cell {i}: Contains error output")
# Check for hardcoded API keys
for i, cell in enumerate(nb['cells']):
if cell['cell_type'] == 'code':
source = ''.join(cell['source'])
if 'sk-ant-' in source or 'anthropic_api_key=' in source.lower():
issues.append(f"Cell {i}: Potential hardcoded API key")
if 'api_key' in source.lower() and 'os.environ' not in source and 'getenv' not in source:
issues.append(f"Cell {i}: API key not using environment variable")
return issues