Feature/pbi 59 account settings#66
Open
eabdelkh wants to merge 60 commits into
Open
Conversation
… github-actions-vas
GitHub actions vas
fixed minor page bug.
Added a filler Home page and updated some tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
1c334e2 to
1033d37
Compare
- Task 1.1: Create settings page layout with responsive sidebar navigation - Task 1.2: Create reusable SettingsNav component with keyboard accessibility - Task 1.3: Add breadcrumb navigation, save/cancel buttons, and unsaved changes handling - Task 1.4: Setup individual routes for each settings section Features: - Responsive settings interface with desktop/mobile layouts - Keyboard navigation support (WCAG 2.1 AA compliant) - Unsaved changes warning system - Breadcrumb navigation - Save/Cancel buttons with loading states - Individual routes: /settings/profile, /settings/privacy, /settings/notifications, /settings/account - Next.js App Router integration - Reusable SettingsPageWrapper component - Mobile hamburger menu with slide-out panel Components: - SettingsNav: Navigation component with accessibility features - SettingsPageWrapper: Shared wrapper for all settings pages - Updated Navbar to include Settings link
1033d37 to
2d410a2
Compare
…onality - Create profile settings form with display name and bio fields - Implement profile picture upload with image processing and validation - Add profile update API endpoints with validation - Integrate TanStack Query for optimistic updates and caching - Add toast notifications for user feedback - Display account information and connected accounts status
Implement comprehensive privacy settings feature including: - Privacy Settings UI with all privacy controls (profile visibility, playlist visibility, listening activity, etc.) - Reusable privacy toggle and radio components with confirmation dialogs - Privacy settings validation schema using Zod - Privacy settings API endpoints (GET/PUT) with authentication and validation - SQL migration for user_privacy_settings table - Privacy enforcement middleware with caching and query filtering Files added: - apps/web/components/PrivacyToggle.jsx (toggle, radio group, dropdown components) - apps/web/app/api/user/privacy/route.js (API endpoints) - apps/web/hooks/usePrivacySettings.js (TanStack Query hooks) - apps/web/lib/schemas/privacySchema.js (validation schema) - apps/web/lib/migrations/create_privacy_settings_table.sql (database migration) - apps/web/lib/privacy/enforcer.js (privacy enforcement utilities) Files modified: - apps/web/app/settings/privacy/page.jsx (complete implementation with API integration)
Implement comprehensive notification preferences feature including: - Notification Preferences UI with all notification types (social, playlist, system) - Reusable NotificationToggle component with icons and animations - Notification preferences validation schema using Zod - Notification preferences API endpoints (GET/PUT) with authentication and validation - SQL migration for user_notification_preferences table - TanStack Query hooks with optimistic updates and cache management Files added: - apps/web/app/api/user/notifications/route.js (API endpoints) - apps/web/components/NotificationToggle.jsx (reusable toggle component) - apps/web/hooks/useNotificationPreferences.js (TanStack Query hooks) - apps/web/lib/schemas/notificationSchema.js (validation schema) - apps/web/lib/migrations/create_notification_preferences_table.sql (database migration) Files modified: - apps/web/app/settings/notifications/page.jsx (complete implementation with API integration) - apps/web/app/api/user/privacy/route.js (improved error handling for missing table) - apps/web/package.json (dependencies) Features: - Support for in-app and email notification channels - Security alerts always enabled (enforced at API and database level) - Master toggle for bulk enable/disable - Email frequency options (instant, daily, weekly) - Optimistic updates for better UX - Toast notifications for save confirmation - Comprehensive error handling and loading states
Implement comprehensive account deletion and data export features including: - Account deletion UI with warnings and account age validation (24-hour minimum) - Multi-step account deletion modal with password verification and confirmation - Account deletion API endpoint with security checks and data cleanup - Account deletion service layer for modular deletion operations - User data export functionality (GDPR compliance) with JSON download - Scheduled deletion job infrastructure for processing pending deletions Files added: - apps/web/app/api/user/account/delete/route.js (deletion API) - apps/web/app/api/user/export/route.js (data export API) - apps/web/app/api/admin/account-deletion-job/route.js (scheduled job endpoint) - apps/web/components/DeleteAccountModal.jsx (multi-step deletion modal) - apps/web/lib/services/accountDeletion.js (deletion service layer) - apps/web/lib/jobs/accountDeletionJob.js (scheduled job logic) Files modified: - apps/web/app/settings/account/page.jsx (deletion UI and data export button) Features: - Password verification for email-based auth - Account age validation (24-hour protection period) - Comprehensive data cleanup (profile, playlists, history, settings, OAuth tokens, storage) - Data export with all user information (GDPR data portability) - Scheduled job structure for grace period deletions - Audit logging for compliance - Error handling and graceful degradation - Toast notifications for user feedback
Implement comprehensive settings persistence system including: - Unified settings store using Zustand with localStorage persistence - Real-time settings sync across tabs/devices using Supabase Realtime - Auto-save functionality with debounced saves and retry logic - Settings migration system for schema versioning and backward compatibility - Smart cache strategy with TanStack Query (5min stale, prefetching, invalidation) - Visual sync indicators showing sync status with tooltips Files added: - apps/web/store/settingsStore.js (unified Zustand store) - apps/web/hooks/useSettingsSync.js (realtime sync hook) - apps/web/hooks/useAutoSave.js (auto-save with debouncing) - apps/web/hooks/useSettingsMigration.js (automatic migrations) - apps/web/lib/cache/settingsCache.js (cache strategy utilities) - apps/web/lib/migrations/settingsMigrations.js (schema migrations) - apps/web/components/SettingsSyncIndicator.jsx (visual sync status) - apps/web/components/SaveStatusIndicator.jsx (save status component) Files modified: - apps/web/components/QueryProvider.jsx (added prefetching) - apps/web/components/SettingsPageWrapper.jsx (added sync indicator) - apps/web/hooks/useProfileUpdate.js (cache integration) - apps/web/hooks/usePrivacySettings.js (cache integration) - apps/web/hooks/useNotificationPreferences.js (cache integration) Features: - Optimistic updates with rollback on error - Conflict resolution (remote/local/prompt strategies) - Offline queue management - Background refetch on window focus - Fallback to stale cache on API failure - Automatic schema migrations with version tracking - Navigation protection (beforeunload warnings) - 5-minute cache stale time, 10-minute cache retention - Real-time sync status indicators
…tion Implement complete validation system and conflict resolution: - Validation schemas with Zod (profile, privacy, notifications) - Client-side validation hook with real-time validation - Server-side validation with sanitization and rate limiting - Validation error display component with animations - Input sanitization utilities (XSS prevention, unicode handling) - Comprehensive test suite (165+ test cases) - Settings conflict resolution with user choice dialog Validation Features: - Schema validation with custom error messages - Field-level and form-level validation - Real-time validation as user types - Server-side input sanitization - Rate limiting per endpoint - Consistent error response format Conflict Resolution: - Multiple resolution strategies (remote, local, user choice, merge) - Conflict detection between local/remote settings - User-friendly conflict dialog - Data loss prevention and warnings - Conflict logging for debugging Files added: - apps/web/lib/schemas/__tests__/ (comprehensive test suite) - apps/web/lib/utils/__tests__/sanitization.test.js - apps/web/lib/utils/settingsConflictResolver.js - apps/web/lib/utils/sanitization.js - apps/web/lib/validation/serverValidation.js - apps/web/components/SettingsConflictDialog.jsx - apps/web/components/ValidationError.jsx - apps/web/hooks/useSettingsValidation.js Files enhanced: - All API routes (profile, privacy, notifications, account, export, picture) - Settings sync hook (conflict resolution integration) - Settings page wrapper (conflict dialog integration) - Validation schemas (file validation, conflict prevention) Testing: - 165+ test cases covering all validation scenarios - Edge cases, boundary conditions, type coercion - Security attack vectors (XSS, injection) - 100% validation logic coverage
…er sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ter sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
- Replace polynomial regex patterns with bounded quantifiers to prevent ReDoS - Implement complete multi-character sanitization for HTML attribute safety - Add context-aware encoding (HTML, attribute, CSS, URL, script) - Remove catastrophic backtracking risks with safe regex patterns - Maintain backward compatibility with existing functionality
- Replace polynomial regex patterns with bounded quantifiers to prevent ReDoS - Implement complete multi-character sanitization for HTML attribute safety - Add context-aware encoding (HTML, attribute, CSS, URL, script) - Remove catastrophic backtracking risks with safe regex patterns - Maintain backward compatibility with existing functionality
- Fix invalid JS syntax that caused Vite import analysis to fail - Ensure proper ES module exports in sanitization utilities - Maintain CodeQL security improvements from previous implementation - All 132 tests now passing with secure sanitization functions
- Export removeDangerousChars function to fix test imports - Enhance dangerous content removal to handle alert(1) and similar patterns - Fix whitespace normalization and trimming in sanitizeDisplayName - Improve HTML tag stripping to remove script content completely - Maintain all CodeQL security improvements (bounded regex, complete encoding) All 132 tests now passing with secure, CodeQL-compliant implementation
- Add missing sanitizeObject function for recursive object sanitization - Fix sanitizeUrl to return null for invalid/empty URLs and accept relative URLs - Fix sanitizeUsername to remove HTML tags before character filtering - Fix removeDangerousChars to properly handle javascript: protocol removal - Add missing sanitizeFormData and checkDangerousContent functions - Update event handler removal regex to handle unquoted values with parentheses All 59 sanitization tests now passing
- Replace unbounded quantifiers (\s*) with bounded quantifiers (\s{0,10}) in event handler patterns to prevent ReDoS attacks
- Fix script end tag regex to handle whitespace (tabs, newlines) between script and >
- Add vbscript: protocol check to URL sanitization
- Update CSS and XSS pattern regexes to use bounded quantifiers for consistency
Addresses 3 high severity CodeQL security vulnerabilities
CodeQL alert: Bad HTML filtering regexp - script end tags with attributes
Browsers accept closing tags like </script foo="bar"> even though it's invalid HTML.
The previous regex [\s>]* only matched whitespace or >, missing attributes.
Fix: Change to [^>]{0,500} to match any characters (including attributes)
between </script and >, with bounded quantifier to prevent ReDoS.
This matches the browser behavior and prevents XSS attacks using malformed
script closing tags.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: Account Settings Feature (PBI #59)
Overview
This PR implements a comprehensive account settings system with profile management, privacy controls, notification preferences, account deletion, settings persistence, and validation/conflict resolution.
Features Implemented
Task 1: Settings Page Foundation
Task 2: Profile Settings
Task 3: Privacy Settings
Task 4: Notification Preferences
Task 5: Account Management
Task 6: Settings Persistence & Sync
Task 7: Validation & Conflict Resolution
Technical Highlights
Architecture
Security
User Experience
Data Safety
Files Changed
New Components
SettingsNav.jsx- Settings navigationSettingsPageWrapper.jsx- Settings page layoutProfilePictureUpload.jsx- Profile picture uploadPrivacyToggle.jsx- Privacy toggle componentPrivacyRadioGroup.jsx- Privacy radio groupNotificationToggle.jsx- Notification toggleDeleteAccountModal.jsx- Account deletion modalValidationError.jsx- Validation error displaySettingsConflictDialog.jsx- Conflict resolution dialogSettingsSyncIndicator.jsx- Sync status indicatorSaveStatusIndicator.jsx- Auto-save status indicatorNew Hooks
useProfile.js/useProfileUpdate.js- Profile data hooksusePrivacySettings.js- Privacy settings hooksuseNotificationPreferences.js- Notification hooksuseSettingsSync.js- Realtime sync hookuseAutoSave.js- Auto-save hookuseSettingsMigration.js- Settings migration hookuseSettingsValidation.js- Validation hookNew Utilities
settingsConflictResolver.js- Conflict resolutionsanitization.js- Input sanitizationserverValidation.js- Server-side validationsettingsStore.js- Zustand settings storesettingsCache.js- Cache configurationsettingsMigrations.js- Migration systemenforcer.js- Privacy enforcementNew Schemas
profileSchema.js- Profile validationprivacySchema.js- Privacy validationnotificationSchema.js- Notification validationAPI Routes
/api/user/profile- Profile CRUD/api/user/profile/picture- Profile picture upload/delete/api/user/privacy- Privacy settings CRUD/api/user/notifications- Notification preferences CRUD/api/user/account/delete- Account deletion/api/user/export- Data export/api/admin/account-deletion-job- Scheduled deletion jobDatabase Migrations
create_privacy_settings_table.sqlcreate_notification_preferences_table.sqlTests
Database Requirements
Required Tables:
users(with display_name, bio, profile_picture_url)user_privacy_settingsuser_notification_preferencesRequired Storage:
profile-picturesbucketRequired Features:
Testing
Unit Tests
Manual Testing
Breaking Changes
None - All features are new additions.
Performance Considerations
Security Considerations
Future Enhancements