Skip to content

Prevent inheritance of Admin stats across sessions - #33

Open
Rukafuu wants to merge 1 commit into
mainfrom
fix/gamification-session-isolation-1839689210855009075
Open

Prevent inheritance of Admin stats across sessions#33
Rukafuu wants to merge 1 commit into
mainfrom
fix/gamification-session-isolation-1839689210855009075

Conversation

@Rukafuu

@Rukafuu Rukafuu commented Jun 15, 2026

Copy link
Copy Markdown
Owner

This PR implements session isolation for gamification stats to prevent high-level or admin stats from leaking between user sessions or into guest sessions via local storage.

Key changes:

  1. GamificationContext.tsx:

    • Added a clearLocalGamification helper to consistently remove related localStorage keys.
    • Enhanced the "SECURITY FIX" logic to clear local storage if isSuspiciousData (level >= 10 or coins > 5000) is detected.
    • Updated the recovery flow to clear local storage after a successful import to the server or if the server state is already non-default (authoritative).
    • Added a suspicious data check to the guest user loading logic to prevent unauthorized access to high-level features for guests.
    • Removed a duplicate setStats(mapped) call.
  2. userService.ts:

    • Updated the logout function to clear all gamification-related localStorage keys in the finally block, ensuring a clean state for subsequent sessions on the same machine.

PR created automatically by Jules for task 1839689210855009075 started by @Rukafuu

- Remove duplicate setStats call in GamificationContext.tsx
- Refactor security fix in GamificationContext.tsx to clear suspicious or redundant local storage stats
- Implement suspicious data check for guest users in GamificationContext.tsx
- Ensure gamification stats are cleared from local storage upon logout in userService.ts

Co-authored-by: Rukafuu <111822334+Rukafuu@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lira-os Ready Ready Preview, Comment Jun 15, 2026 5:46pm

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