Skip to content

fix: brain security hardening — PII, IP rate limit, anti-Sybil#235

Merged
ruvnet merged 1 commit intomainfrom
fix/brain-security-pii-ratelimit
Mar 3, 2026
Merged

fix: brain security hardening — PII, IP rate limit, anti-Sybil#235
ruvnet merged 1 commit intomainfrom
fix/brain-security-pii-ratelimit

Conversation

@ruvnet
Copy link
Owner

@ruvnet ruvnet commented Mar 3, 2026

Summary

  • PII redaction expanded (12 → 15 rules): Phone numbers, SSNs, and credit cards now stripped. 555-867-5309<PHONE_1>, 078-05-1120<SSN_1>, 4111-1111-1111-1111<CC_1>
  • IP-based rate limiting: Secondary per-IP write limit (1500/hr) prevents Sybil key rotation from a single source
  • Anti-Sybil vote dedup: One vote per IP per memory, regardless of API key count. Returns 403 on duplicates

Files Changed

File Changes
crates/rvf/rvf-federation/src/pii_strip.rs Add phone, SSN, credit card rules + 7 tests
crates/mcp-brain-server/src/rate_limit.rs Add IP write/read buckets, IP vote dedup map
crates/mcp-brain-server/src/routes.rs Add extract_client_ip(), wire IP limits to share/vote
crates/mcp-brain-server/src/verify.rs Update docs, add phone/SSN/CC tests
docs/adr/ADR-082-* Full security audit and hardening decisions

Test plan

  • 16 PII tests pass (phone, SSN, CC detection + redaction)
  • 63 brain server tests pass
  • Live verification: phone/SSN/CC redacted in stored content
  • Live verification: second vote from different key, same IP → 403
  • Deployed to Cloud Run (revision ruvbrain-00076-2jz)

🤖 Generated with claude-flow

…-Sybil votes

Expand PiiStripper from 12 to 15 regex rules: add phone number,
SSN, and credit card detection/redaction. Add IP-based rate limiting
(1500 writes/hr per IP) to prevent Sybil key rotation bypass. Add
per-IP vote deduplication (one vote per IP per memory) to prevent
quality score manipulation.

63 server tests + 16 PII tests pass. Deployed to Cloud Run.

Co-Authored-By: claude-flow <ruv@ruv.net>
@ruvnet ruvnet merged commit 5d51e0b into main Mar 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant