🛡️ Sentinel: Fix IDOR in Newsletter Unsubscribe#46
🛡️ Sentinel: Fix IDOR in Newsletter Unsubscribe#46google-labs-jules[bot] wants to merge 1 commit intomainfrom
Conversation
🚨 Severity: CRITICAL
💡 Vulnerability: Insecure Direct Object Reference (IDOR) in `app/api/newsletter/unsubscribe/route.ts` allowed any user to unsubscribe any other user by knowing their `userId`.
🎯 Impact: Unauthorized modification of user preferences (email subscription status).
🔧 Fix:
1. Introduced `lib/newsletter-security.ts` to generate and verify HMAC-SHA256 tokens signed with `CSRF_SALT`.
2. Updated `scripts/send-newsletter.ts` to append a signed `token` to unsubscribe links.
3. Updated `app/unsubscribe/page.tsx` to read the token and pass it to the API.
4. Updated `app/api/newsletter/unsubscribe/route.ts` to verify the token before allowing the action.
✅ Verification: Confirmed via manual inspection and local simulation that the API now rejects requests without a valid token.
|
👋 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 For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Secured the newsletter unsubscribe endpoint against IDOR attacks by implementing HMAC token verification for unsubscribe links.
PR created automatically by Jules for task 11771459334124998463 started by @SamuelZ12