Profile Privacy & Visibility Controls
Why it matters
Profiles without visibility controls violate GDPR Art. 25 (data protection by design) and CCPA §1798.100 (consumer right to control their data). Under OWASP A01 (Broken Access Control) and CWE-284, any user whose profile is marked private but still returned to strangers has had their consent overridden by a code defect. Beyond compliance, exposed private profiles leak follower graphs, contact hints, and behavioral patterns to scrapers and stalkers — a direct user safety failure.
Severity rationale
High because bypassed privacy controls expose user data to unauthorized parties at query time, constituting a broken access control failure with immediate personal safety implications.
Remediation
Gate every profile fetch through an access-control layer in lib/db.ts that checks the is_private flag and the viewer's follow status before returning any data. Never expose even partial profile fields to unauthorized viewers.
// lib/db.ts
export async function getUserProfile(userId: string, viewerId?: string) {
const user = await db.user.findUnique({ where: { id: userId } })
if (!user) return null
if (!user.is_private) return user
if (viewerId === userId) return user
const isFollower = await db.follow.findFirst({
where: { followingId: viewerId, followedId: userId }
})
return isFollower ? user : null
}
Also add is_private Boolean @default(false) to your Prisma User model if the field does not yet exist.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Social Features & Engagement Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-284 — Improper Access Control
- owasp:2021 · A01 — Broken Access Control
- gdpr · Art. 25 — Data Protection by Design and by Default
- ccpa · §1798.100 — Consumer Right to Know
Taxons
History
- 2026-04-18·v1.0.0·Initial import from community-social-engagement·automated