Task complete. Secure PII handling implemented for logs, APIs, persistence.
Key Deliverables:
- Redactor:
internal/security/redactor.go- Central PII masking (cust_, sub_, $*.**) - Logging: Full migration to zap w/ redaction hooks. Global setup in main.go + middleware
- API: Custom MarshalJSON in types.go masks Customer to "cust_***"
- Persistence: Docs note encryption/hashed future
- Docs:
internal/docs/PII_POLICY.md- Classification, enforcement, audit guide - Workers: All log.Printf replaced (service, worker/*)
Validation:
- Logging sites audited - no raw PII
- API responses redact Customer
- Tests pass (run
go test ./...manually) - Perf benchmarks compatible
- Secure, efficient, reviewable
Usage:
go get go.uber.org/zap@latest && go mod tidy # If needed
go run cmd/server/main.go
Next: Production deployment. Quarterly audit recommended.
Policy enforced via code patterns + docs.