UNPKG

@dawans/promptshield

Version:

Secure your LLM stack with enterprise-grade RulePacks for AI safety scanning

246 lines (234 loc) 5.64 kB
# Copyright (c) 2025 Sawyer0 # Licensed under proprietary terms. See LICENSE for details. version: '1.0.0' last_updated: '2025-01-15' name: Bias Detection Rules description: Detects potentially biased language and content rules: # Gender bias keywords - id: gender_bias description: Detects gender-biased language match_keywords: [ 'he should', 'she should', 'he must', 'she must', 'man up', 'grow a pair', 'be a man', 'act like a lady', 'bossy', 'aggressive', 'emotional', 'hysterical', ] severity: medium category: bias enabled: true case_sensitive: false # Age bias keywords - id: age_bias description: Detects age-biased language match_keywords: [ 'old-fashioned', 'outdated', 'behind the times', 'young and inexperienced', 'too young', 'too old', 'millennial', 'boomer', 'gen z', ] severity: medium category: bias enabled: true case_sensitive: false # Socioeconomic bias keywords - id: socioeconomic_bias description: Detects socioeconomic bias match_keywords: [ 'poor people', 'rich people', 'privileged', 'underprivileged', 'low-income', 'high-class', 'white collar', 'blue collar', ] severity: medium category: bias enabled: true case_sensitive: false # Ability bias keywords - id: ability_bias description: Detects ability/disability bias match_keywords: [ 'normal people', 'regular people', 'able-bodied', 'handicapped', 'crippled', 'retarded', 'insane', 'crazy', 'lame', 'blind to', 'deaf to', ] severity: high category: bias enabled: true case_sensitive: false # Religious bias keywords - id: religious_bias description: Detects religious bias match_keywords: [ 'god-fearing', 'heathen', 'pagan', 'infidel', 'religious fanatic', 'zealot', 'cult', ] severity: medium category: bias enabled: true case_sensitive: false # Stereotypical phrases using regex - id: stereotypes description: Detects stereotypical phrases match_regex: [ "\\b(all|every|no)\\s+\\w+\\s+(are|is)\\s+\\w+\\b", "\\b\\w+\\s+people\\s+(always|never|usually)\\b", ] severity: medium category: bias enabled: true case_sensitive: false # Implicit bias patterns - id: implicit_bias description: Detects implicit bias language patterns match_keywords: [ 'surprisingly articulate', 'well-dressed for a', 'clean-cut', 'speaks well', 'not like other', 'one of the good ones', 'credit to their race', 'so articulate', 'very presentable', 'well-educated for a', ] severity: high category: bias enabled: true case_sensitive: false # Professional bias - id: professional_bias description: Detects professional and workplace bias match_keywords: [ 'cultural fit', 'not a good fit', 'overqualified', 'aggressive negotiator', 'pushy', 'difficult to work with', 'not leadership material', 'lacks executive presence', 'team player', 'go-getter', ] severity: medium category: bias enabled: true case_sensitive: false # Appearance bias - id: appearance_bias description: Detects appearance-based bias match_keywords: [ 'unprofessional hair', 'ethnic hairstyle', 'natural hair', 'dreadlocks', 'tattoos', 'piercings', 'alternative style', 'dress code violation', 'inappropriate attire', 'looks professional', ] severity: medium category: bias enabled: true case_sensitive: false # Cultural bias - id: cultural_bias description: Detects cultural bias and assumptions match_keywords: [ 'foreign-sounding name', 'ethnic name', 'hard to pronounce', 'American name', 'normal name', 'traditional family', 'broken English', 'heavy accent', 'poor English', 'language barrier', ] severity: high category: bias enabled: true case_sensitive: false # Microaggressions - id: microaggressions description: Detects common microaggression phrases match_keywords: [ 'where are you really from', 'you speak English so well', 'can I touch your hair', 'you look exotic', 'what are you mixed with', "I don't see color", "we're all human", 'reverse racism', 'playing the race card', "you're so lucky", ] severity: high category: bias enabled: true case_sensitive: false # Economic assumptions - id: economic_assumptions description: Detects economic status assumptions match_regex: [ 'must be (rich|poor|wealthy|broke)', "can't afford", "probably can't pay", 'lives in the (ghetto|projects|suburbs)', 'from the wrong side of town', 'trailer trash', 'silver spoon', 'born with advantages', ] severity: medium category: bias enabled: true case_sensitive: false