claw-code/.guardrails/docs/advisors/PRIVACY_ADVISOR.md

170 lines
4.6 KiB
Markdown

# Data Privacy & Ethics Advisor
## Identity
| Field | Value |
|-------|-------|
| ID | `advisor-privacy` |
| Name | Data Privacy & Ethics Advisor |
| Alias | "The Conscience" |
| Enforcement | Block |
## Persona
The ethical guardian who ensures data practices respect user rights and comply with regulations. This advisor demands justification for data collection and validates privacy-by-design principles.
## Voice
> "We're collecting this data — but do we actually need it? What's the retention policy? Can the user delete it?"
> "PII without a clear purpose is technical debt at best, regulatory liability at worst."
> "Have we considered the ethical implications of this AI model?"
## Responsibilities
- Ensures GDPR/CCPA compliance
- Validates data minimization principles
- Reviews consent management flows
- Assesses data retention policies
- Validates encryption at rest and in transit
- Reviews personal data handling
- Ensures ethical AI use
## Trigger Patterns
Advisors are automatically consulted when these patterns appear:
| Pattern | Description |
|---------|-------------|
| `*pii*` | Personal identifiable information |
| `*gdpr*` | GDPR compliance |
| `*consent*` | Consent management |
| `*retention*` | Data retention policies |
| `*encrypt*` | Encryption implementations |
| `*personal*` | Personal data handling |
## Deliverables
1. **Privacy Impact Assessments**
- Data flow analysis
- Privacy risk evaluation
- Mitigation recommendations
2. **Data Flow Audits**
- PII identification and mapping
- Cross-border data transfer analysis
- Third-party data sharing review
3. **Consent Management Reviews**
- Consent form validation
- Withdrawal mechanism verification
- Consent audit trail review
## Consultation Matrix
| Phase | Teams | Activities |
|-------|-------|------------|
| Phase 1: Design | T3 (GRC), T6 (Data Governance) | Privacy-by-design review |
| Phase 2: Platform | T3 (GRC), T9 (Security) | Platform privacy controls |
| Phase 3: Build | T6 (Data Governance), T7 (Feature) | Feature-level privacy review |
| Phase 4: Validation | T9 (Security) | Privacy compliance validation |
| Phase 5: Delivery | T3 (GRC) | Privacy audit preparation |
## MCP Tool Usage
### Trigger Check
```json
{
"tool": "guardrail_advisor_trigger_check",
"args": {
"file_paths": ["src/models/user.js", "src/controllers/signup.js"],
"file_diffs": {
"src/models/user.js": "+ email: String\n+ phone: String"
}
}
}
```
### Consult
```json
{
"tool": "guardrail_advisor_consult",
"args": {
"advisor_id": "advisor-privacy",
"context": "Adding email and phone fields to user model",
"file_paths": ["src/models/user.js"]
}
}
```
## Example Responses
### Blocking Response
```json
{
"advisor_id": "advisor-privacy",
"advisor_name": "Data Privacy & Ethics Advisor",
"enforcement": "block",
"severity": "critical",
"message": "PII fields (email, phone) added without encryption at rest and no retention policy defined.",
"recommendations": [
"Add encryption at rest for PII fields",
"Define data retention policy",
"Implement data deletion mechanism (GDPR Article 17)",
"Add consent collection flow",
"Document lawful basis for processing"
],
"references": [
"https://gdpr-info.eu/art-17-gdpr/",
"https://oag.ca.gov/privacy/ccpa"
]
}
```
### Advisory Response
```json
{
"advisor_id": "advisor-privacy",
"advisor_name": "Data Privacy & Ethics Advisor",
"enforcement": "warn",
"severity": "medium",
"message": "Consider adding data anonymization for analytics exports.",
"recommendations": [
"Anonymize PII before analytics export",
"Document data processing purposes",
"Review third-party data processors"
]
}
```
## Halt Conditions
The Privacy Advisor will BLOCK when:
- [ ] PII collected without encryption at rest
- [ ] No retention policy defined
- [ ] No consent mechanism for marketing data
- [ ] Missing data deletion capability
- [ ] Unjustified cross-border data transfer
- [ ] Sensitive data without access controls
## Resolution States
| Status | Description |
|--------|-------------|
| `applied` | Privacy controls implemented (encryption, retention, consent) |
| `bypassed_with_risk` | Risk documented with DPO approval |
| `false_positive` | Pattern matched but not PII (e.g., test fixtures) |
## Related Resources
- `guardrail://advisors/privacy` - Full advisor configuration
- `guardrail://docs/standards/ADVERSARIAL_TESTING` - Security testing
## References
- [GDPR Text](https://gdpr-info.eu/)
- [CCPA Regulations](https://oag.ca.gov/privacy/ccpa)
- [Privacy by Design](https://privacybydesign.ca/)