Chunk #522

Aus: Sicherheit (Index: 10)

85 Tokens
Synced Status
« Vorheriger (#9) Nächster (#11) »

Taxonomie

Kategorie Sicherheit
Pfad Sicherheit > MCP-DB Sicherheit > Migration
Heading-Pfad Sicherheit > MCP-DB Sicherheit > Migration von direkten DB-Zugriffen > Migration Schritt-für-Schritt > 3. Python-Hooks auf Environment-Variablen umstellen

Entities

Name Typ
DB_CONFIG CONFIG
Python-Hooks COMMAND
dotenv SERVICE
os.environ.get COMMAND

Keywords

Migration Sicherheit Environment Variables Python

Inhalt

# Vorher (unsicher)
DB_CONFIG = {
    'user': 'claude_code',
    'password': 'klartext_passwort'  # UNSICHER
}

# Nachher (sicher)
from dotenv import load_dotenv
load_dotenv(Path(__file__).parent / '.env')

DB_CONFIG = {
    'user': os.environ.get('CLAUDE_DB_USER', 'claude_code'),
    'password': os.environ.get('CLAUDE_DB_PASSWORD', '')
}

Clean Content

```
`# Vorher (unsicher)
DB_CONFIG = {
 'user': 'claude_code',
 'password': 'klartext_passwort' # UNSICHER
}

# Nachher (sicher)
from dotenv import load_dotenv
load_dotenv(Path(__file__).parent / '.env')

DB_CONFIG = {
 'user': os.environ.get('CLAUDE_DB_USER', 'claude_code'),
 'password': os.environ.get('CLAUDE_DB_PASSWORD', '')
}`
```

Metadaten

Analysiert am20.12.2025 12:42:32
Analyse-Modellgemma3:4b-it-qat
Embedding-Modellmxbai-embed-large
Qdrant-ID17a4f451-b57d-4fdb-a06b-86e54d1888e5
Erstellt20.12.2025 12:34:42
Aktualisiert20.12.2025 12:53:38