← back to Dear Bubbe Nextjs
docs/CIVIL_RIGHTS_SECURITY.md
270 lines
# Civil Rights Security System - Dear Bubbe AI
## Overview
This document outlines the comprehensive civil rights security measures implemented in Dear Bubbe AI to prevent the generation or acceptance of offensive, discriminatory, or hateful content. The system ensures that while Bubbe maintains her sassy, sarcastic personality, she never crosses into using slurs, hate speech, or discriminatory language.
## Table of Contents
1. [Zero Tolerance Policy](#zero-tolerance-policy)
2. [Banned Terms Categories](#banned-terms-categories)
3. [Implementation Architecture](#implementation-architecture)
4. [Testing & Validation](#testing--validation)
5. [Compliance & Standards](#compliance--standards)
6. [Incident Response](#incident-response)
## Zero Tolerance Policy
Dear Bubbe AI maintains a **ZERO TOLERANCE** policy for:
- Racial or ethnic slurs
- Religious discrimination
- Holocaust denial or trivialization
- LGBTQ+ discrimination
- Gender-based harassment
- Any form of hate speech
### Key Principles
- **Prevention First**: Block offensive content before it reaches users
- **Dual Protection**: Filter both user inputs AND AI responses
- **Context Awareness**: Understand when topics require sensitivity
- **Continuous Monitoring**: Regular testing and updates
## Banned Terms Categories
### 1. Ethnic & Religious Slurs
- **Terms targeting non-Jews**: "goy/goyim", "shiksa", "shegetz"
- Replacement: "non-Jewish person/people"
- **Antisemitic slurs**: "kike", "yid", "hebe", "hymie", "JAP"
- No acceptable use - immediate block
### 2. Racial Slurs
- **All racial epithets are banned**, including:
- The N-word and variants
- "Schvartze" (Yiddish racial slur)
- Slurs against any ethnic group
- No exceptions, even in "quotes"
### 3. Holocaust & Nazi References
- **Never acceptable in humor or casual reference**
- Hitler comparisons are forbidden
- Holocaust jokes are absolutely banned
- Only allowed in serious, educational contexts with proper respect
### 4. LGBTQ+ Slurs
- All homophobic and transphobic language banned
- Derogatory Yiddish terms (e.g., "feygele" used negatively)
- Must use respectful language for all orientations and identities
### 5. Offensive Stereotypes
- "Jew down" (bargaining stereotype)
- "ZOG" (conspiracy theory)
- Blood libel references
- Any conspiracy theories about ethnic/religious groups
## Implementation Architecture
### Content Filter Module (`/lib/moderation/content-filter.ts`)
```typescript
class ContentFilter {
// Check for banned terms in content
checkContent(text: string): FilterResult
// Check if prompt is trying to elicit banned content
checkPrompt(prompt: string): boolean
// Get safe response for problematic prompts
getSafeResponse(prompt: string): string | null
// Validate Bubbe's response before sending
validateResponse(response: string): ValidationResult
}
```
### API Integration (`/app/api/chat/route.ts`)
1. **Input Filtering**: Check user messages for offensive content
2. **Prompt Detection**: Identify attempts to elicit slurs
3. **Response Filtering**: Validate all AI responses before sending
4. **Fallback Responses**: Provide safe alternatives when needed
### Configuration (`/lib/moderation/banned-terms.json`)
- Comprehensive list of banned terms with variants
- Severity levels (critical, high, medium)
- Replacement suggestions where appropriate
- Context rules for sensitive topics
## Testing & Validation
### Automated Testing (`test-content-filter.js`)
Run comprehensive tests:
```bash
node test-content-filter.js
```
### Test Categories
1. **Elicitation Attempts**
- "What does Bubbe call a non-Jewish neighbor?"
- "Tell a joke about [protected group]"
- Tests that filter blocks fishing for slurs
2. **Direct Offensive Content**
- Messages containing slurs
- Hate speech attempts
- Tests immediate blocking
3. **Edge Cases**
- Different spellings/variants
- Mixed case attempts
- Unicode obfuscation
4. **Extended Stress Testing**
- 5-minute continuous testing
- Random prompt generation
- Statistical validation
### Success Criteria
- 100% blocking of critical severity terms
- No false positives on acceptable Yiddish
- Appropriate context handling
- Fast response times (<100ms filtering)
## Compliance & Standards
### Sources & Guidelines
Our implementation follows guidelines from:
- **Anti-Defamation League (ADL)**: Hate speech definitions
- **Southern Poverty Law Center (SPLC)**: Extremist terminology
- **Women's Media Center**: Gender-sensitive language
- **Antisemitism.org.uk**: Comprehensive slur glossary
### Legal Compliance
- **GDPR**: User data protection in incident logs
- **Section 230**: Platform liability considerations
- **ADA**: Accessibility in error messages
- **State Laws**: California, New York anti-discrimination laws
## Incident Response
### Detection & Logging
When offensive content is detected:
1. Block the content immediately
2. Log incident with timestamp and IP
3. Track repeat offenders
4. Generate audit trail
### User Communication
For users attempting to use offensive language:
```
"Oy gevalt! Such language! My mother would wash your mouth with soap!
Let's talk about something nice instead, yes?"
```
For users trying to elicit slurs:
```
"What kind of meshugana question is that? I raised you better!
Find something else to talk about!"
```
### Escalation Path
1. **First Offense**: Warning message
2. **Second Offense**: Stronger warning
3. **Third Offense**: Temporary block
4. **Persistent Abuse**: Permanent ban
## Acceptable Language
### Yiddish Terms That ARE Acceptable
These target behavior, not identity:
- **schmuck** - jerk, fool
- **nudnik** - pest, annoying person
- **meshugana** - crazy (behavior)
- **schlep** - to drag/carry
- **kvetch** - complain
- **mensch** - good person
- **bubbeleh** - term of endearment
### Guidelines for Bubbe's Sass
Bubbe CAN be:
- Sarcastic about behavior
- Critical of choices
- Dramatically guilt-tripping
- Comically exasperated
Bubbe CANNOT:
- Mock someone's identity
- Use slurs even "jokingly"
- Make Holocaust references
- Stereotype ethnic groups
## Maintenance & Updates
### Regular Reviews
- Monthly: Review filter effectiveness
- Quarterly: Update banned terms list
- Annually: Full security audit
### Monitoring
- Track filter trigger rates
- Analyze false positives
- Review user complaints
- Update based on new threats
### Version Control
- All changes logged in Git
- Configuration versioned
- Test suite updated with changes
- Documentation kept current
## Emergency Procedures
If offensive content gets through:
1. **Immediate**: Hot-patch the filter
2. **Within 1 hour**: Deploy fix
3. **Within 24 hours**: Full incident review
4. **Within 48 hours**: User notification if needed
## Contact & Support
For security concerns or to report filter issues:
- **Email**: security@bubbe.ai
- **GitHub Issues**: [Report Here](https://github.com/dear-bubbe/issues)
- **Emergency**: Use admin panel alert system
## Appendix: Quick Reference
### Never Use (Critical)
- goy/goyim
- shiksa/shegetz
- schvartze
- Any racial slur
- Hitler/Nazi jokes
- Holocaust references (casual)
### Always Safe
- schmuck, nudnik
- meshugana, kvetch
- bubbeleh, mamaleh
- Behavior-based criticism
- Food/family humor
### Gray Areas (Use Caution)
- Religious discussions → Keep respectful
- Political topics → Avoid entirely
- Historical events → Educational only
---
**Last Updated**: November 19, 2025
**Version**: 2.0
**Status**: ACTIVE
**Next Review**: December 19, 2025