Skip to content

Commit c0d1295

Browse files
committed
security: enforce moderator anonymization to protect privacy
- Add mandatory anonymize_moderators=true enforcement - Block application startup if anonymize_moderators=false is attempted - Update documentation with security warnings - Prevent accidental exposure of moderator identities in public wikis BREAKING: anonymize_moderators=false is now permanently disabled for security
1 parent 999e752 commit c0d1295

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

CLAUDE.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ All configuration options can be set via environment variables:
8181
- `RETENTION_DAYS`: Database cleanup period in days
8282
- `BATCH_SIZE`: Entries fetched per run
8383
- `UPDATE_INTERVAL`: Seconds between updates in daemon mode
84-
- `ANONYMIZE_MODERATORS`: `true` or `false` for moderator anonymization
84+
- `ANONYMIZE_MODERATORS`: **MUST be `true`** (enforced for security)
8585

8686
#### Advanced Settings
8787
- `WIKI_ACTIONS`: Comma-separated list of actions to show (e.g., "removelink,removecomment,approvelink")
@@ -129,9 +129,11 @@ python modlog_wiki_publisher.py --debug --batch-size 25 # CLI takes priority
129129
```
130130

131131
### Display Options
132-
- `anonymize_moderators`: Whether to show "HumanModerator" for human mods (default: true)
133-
- `true` (default): Shows "AutoModerator", "Reddit", or "HumanModerator"
134-
- `false`: Shows actual moderator usernames
132+
- `anonymize_moderators`: **REQUIRED** to be `true` for security (default: true)
133+
- `true` (ENFORCED): Shows "AutoModerator", "Reddit", or "HumanModerator"
134+
- `false`: **BLOCKED** - Would expose moderator identities publicly
135+
136+
**SECURITY NOTE**: Setting `anonymize_moderators=false` is permanently disabled to protect moderator privacy. The application will refuse to start if this is attempted.
135137

136138
### Action Types Displayed
137139

@@ -186,7 +188,16 @@ Use `--test` flag to verify configuration and Reddit API connectivity without ma
186188

187189
User profile links are a privacy concern and not useful for modlog purposes.
188190

189-
## Recent Improvements (v2.2)
191+
## Recent Improvements (v1.2)
192+
193+
### Environment Variable Support & Validation
194+
- ✅ Complete environment variable support for all configuration options
195+
- ✅ Standard configuration hierarchy: CLI args → Environment vars → Config file
196+
- ✅ Container/Docker ready with secure credential handling
197+
- ✅ Strict validation with 44+ known Reddit modlog actions in `VALID_MODLOG_ACTIONS`
198+
- ✅ Fail-fast validation rejects invalid actions with clear error messages
199+
200+
## Previous Improvements (v1.1)
190201

191202
### Enhanced Removal Tracking
192203
- ✅ Added approval action tracking for `approvelink` and `approvecomment`

modlog_wiki_publisher.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,10 @@ def apply_config_defaults_and_limits(config):
178178
if field not in reddit_config or not reddit_config[field]:
179179
raise ValueError(f"Missing required reddit configuration field: {field}")
180180

181+
# CRITICAL SECURITY CHECK: Never allow moderator de-anonymization on live Reddit
182+
if not config.get('anonymize_moderators', True):
183+
raise ValueError("SECURITY: anonymize_moderators=false is not allowed. This would expose moderator identities publicly.")
184+
181185
return config
182186

183187
def migrate_database():

0 commit comments

Comments
 (0)