Skip to content

Improve safety, security, and stability#77

Open
AdamJ wants to merge 2 commits intomainfrom
claude/improve-safety-security-n4llD
Open

Improve safety, security, and stability#77
AdamJ wants to merge 2 commits intomainfrom
claude/improve-safety-security-n4llD

Conversation

@AdamJ
Copy link
Owner

@AdamJ AdamJ commented Mar 25, 2026

Security:

  • Remove unverified third-party script (cdn.gpteng.co/gptengineer.js)
  • Add Content Security Policy meta tag (connect-src, frame-src, object-src, base-uri)
  • Patch 12 high-severity npm vulnerabilities via audit fix + overrides
  • Move Gemini API calls server-side via Supabase Edge Function (ai-proxy);
    VITE_GEMINI_API_KEY no longer exposed to the browser

Stability:

  • Wrap all localStorage.setItem calls in try-catch to handle QuotaExceededError
    and private/incognito mode (Safari) without crashing
  • Fix beforeunload handler: async save replaced with synchronous localStorage
    write as a crash-safe backup (async saves cannot be awaited on page unload)
  • Replace Promise.all with Promise.allSettled in forceSyncToDatabase so a single
    failed save no longer silently leaves other data in an inconsistent state
  • Show destructive toast when endDay save fails instead of only logging to console
  • Add private requireUser() helper in SupabaseService to validate user ID before
    every DB operation; removes scattered inconsistent null-check pattern
  • Wrap localStorage access in InstallPrompt in try-catch for private mode safety
  • Sanitize chart ID and color values before interpolation into dangerouslySetInnerHTML
  • Add SCHEMA_VERSION stamp to all localStorage writes; version mismatch on read
    clears stale data and returns safe defaults instead of passing corrupt state
    through the application; legacy bare-array format remains readable

claude added 2 commits March 25, 2026 02:50
Security:
- Remove unverified third-party script (cdn.gpteng.co/gptengineer.js)
- Add Content Security Policy meta tag (connect-src, frame-src, object-src, base-uri)
- Patch 12 high-severity npm vulnerabilities via audit fix + overrides
- Move Gemini API calls server-side via Supabase Edge Function (ai-proxy);
  VITE_GEMINI_API_KEY no longer exposed to the browser

Stability:
- Wrap all localStorage.setItem calls in try-catch to handle QuotaExceededError
  and private/incognito mode (Safari) without crashing
- Fix beforeunload handler: async save replaced with synchronous localStorage
  write as a crash-safe backup (async saves cannot be awaited on page unload)
- Replace Promise.all with Promise.allSettled in forceSyncToDatabase so a single
  failed save no longer silently leaves other data in an inconsistent state
- Show destructive toast when endDay save fails instead of only logging to console
- Add private requireUser() helper in SupabaseService to validate user ID before
  every DB operation; removes scattered inconsistent null-check pattern
- Wrap localStorage access in InstallPrompt in try-catch for private mode safety
- Sanitize chart ID and color values before interpolation into dangerouslySetInnerHTML
- Add SCHEMA_VERSION stamp to all localStorage writes; version mismatch on read
  clears stale data and returns safe defaults instead of passing corrupt state
  through the application; legacy bare-array format remains readable

https://claude.ai/code/session_01JorBRWb89cm8BakhSoeWVx
The saveArchivedDays test checked the raw localStorage value as a bare
array, but after adding schema versioning the format is now the envelope
{ days: [...], _v: 1 }. Update assertions to match the new structure and
also verify the version field is present.

https://claude.ai/code/session_01JorBRWb89cm8BakhSoeWVx
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 25, 2026

Deploying timetrackerpro with  Cloudflare Pages  Cloudflare Pages

Latest commit: 413e807
Status: ✅  Deploy successful!
Preview URL: https://7b1c376c.timetrackerpro.pages.dev
Branch Preview URL: https://claude-improve-safety-securi.timetrackerpro.pages.dev

View logs

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.

2 participants