ECC/docs/tr/rules/golang/security.md

35 lines
587 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
paths:
- "**/*.go"
- "**/go.mod"
- "**/go.sum"
---
# Go Güvenlik
> Bu dosya [common/security.md](../common/security.md) dosyasını Go'ya özgü içerikle genişletir.
## Secret Yönetimi
```go
apiKey := os.Getenv("OPENAI_API_KEY")
if apiKey == "" {
log.Fatal("OPENAI_API_KEY not configured")
}
```
## Güvenlik Taraması
- Statik güvenlik analizi için **gosec** kullan:
```bash
gosec ./...
```
## Context & Timeout'lar
Timeout kontrolü için daima `context.Context` kullan:
```go
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
```