Skip to content

fix(security): block role escalation, harden review updates, strip se…#259

Open
crackle2k wants to merge 1 commit into
mainfrom
claude/quirky-wozniak-4e1de8
Open

fix(security): block role escalation, harden review updates, strip se…#259
crackle2k wants to merge 1 commit into
mainfrom
claude/quirky-wozniak-4e1de8

Conversation

@crackle2k

Copy link
Copy Markdown
Owner

…nsitive public profile fields

  • Reject business_owner/admin self-registration; role must be granted via claim flow
  • Add user_id filter to review UPDATE query as DB-layer defense-in-depth
  • Remove subscription_tier from public user profiles
  • Mask admin role as customer in public profiles to prevent admin enumeration

…nsitive public profile fields

- Reject business_owner/admin self-registration; role must be granted via claim flow
- Add user_id filter to review UPDATE query as DB-layer defense-in-depth
- Remove subscription_tier from public user profiles
- Mask admin role as customer in public profiles to prevent admin enumeration

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vantage Ready Ready Preview, Comment Jun 29, 2026 2:45pm

@crackle2k crackle2k added rust Pull requests that update rust code security Improves or revolves around the site's security backend Revolves purely around the backend labels Jun 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several security and privacy improvements, including restricting self-registration for business owners and admins, ensuring users can only update their own reviews by matching the authenticated user ID, hiding admin roles on public profiles, and restricting the subscription tier field to private profiles. The review feedback suggests further hardening user privacy by also stripping detailed user preferences from public profiles when private information is not requested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 165 to 169
if include_private {
value["email"] = json!(email);
value["subscription_tier"] =
json!(metadata_str(&user.app_metadata, "subscription_tier").unwrap_or("FREE"));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

While removing subscription_tier from public profiles is a great step toward privacy hardening, the public profile still exposes highly detailed user preferences (such as preferences, preferred_categories, preferred_vibes, prefer_independent, price_pref, discovery_mode, and preferences_completed). These fields contain sensitive personal preferences and should be stripped from public profiles when include_private is false.

We can clean these up in the else block of the include_private check to ensure they are never leaked publicly.

    if include_private {
        value["email"] = json!(email);
        value["subscription_tier"] = 
            json!(metadata_str(&user.app_metadata, "subscription_tier").unwrap_or("FREE"));
    } else if let Some(obj) = value.as_object_mut() {
        obj.remove("preferences");
        obj.remove("preferred_categories");
        obj.remove("preferred_vibes");
        obj.remove("prefer_independent");
        obj.remove("price_pref");
        obj.remove("discovery_mode");
        obj.remove("preferences_completed");
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Revolves purely around the backend rust Pull requests that update rust code security Improves or revolves around the site's security

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant