mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-08 07:37:48 +02:00
31 lines
573 B
Markdown
31 lines
573 B
Markdown
---
|
|||
|
|
description: "Python security extending common rules"
|
||
|
|
globs: ["**/*.py", "**/*.pyi"]
|
||
|
|
alwaysApply: false
|
||
|
|
---
|
||
|
|
# Python Security
|
||
|
|
|
||
|
|
> This file extends the common security rule with Python specific content.
|
||
|
|
|
||
|
|
## Secret Management
|
||
|
|
|
||
|
|
```python
|
||
|
|
import os
|
||
|
|
from dotenv import load_dotenv
|
||
|
|
|
||
|
|
load_dotenv()
|
||
|
|
|
||
|
|
api_key = os.environ["OPENAI_API_KEY"] # Raises KeyError if missing
|
||
|
|
```
|
||
|
|
|
||
|
|
## Security Scanning
|
||
|
|
|
||
|
|
- Use **bandit** for static security analysis:
|
||
|
|
```bash
|
||
|
|
bandit -r src/
|
||
|
|
```
|
||
|
|
|
||
|
|
## Reference
|
||
|
|
|
||
|
|
See skill: `django-security` for Django-specific security guidelines (if applicable).
|