Date: 2024-12-25 Status: ✅ Complete Issue: #826 - Audit and fix SYNCRO dashboard for Tor Browser
File: client/middleware.ts
- Removed:
upgrade-insecure-requestsdirective from CSP header - Reason: .onion addresses use HTTP by design, not HTTPS. Forcing upgrade-insecure-requests would break .onion access.
- Documentation: Added explanation in code comments
- ✅ Still maintains strict default-src and script-src policies
- ✅ HTTPS still enforced for external API calls (Stripe, Supabase, Stellar)
- ✅ Allows HTTP connections for .onion mirror (if implemented)
File: client/lib/tor-detection.ts (NEW)
isTorBrowser(): Detects if running in Tor Browser via user agent and .onion domainisExtensionAvailable(): Checks if browser extensions are availableisFreighterAvailable(): Specifically detects Freighter walletgetTorCompatibilityInfo(): Returns full compatibility statustorCompatibleFetch(): Fetch wrapper for .onion address fallback
import { isTorBrowser, getTorCompatibilityInfo } from '@/lib/tor-detection';
const info = getTorCompatibilityInfo();
console.log(info.isTorBrowser); // true if running in Tor Browser
console.log(info.knownLimitations); // ['Freighter wallet...', ...]- Added Tor Browser detection import
- Enhanced error message in
connect()method - Shows helpful message when Freighter unavailable in Tor Browser
Before:
Error: Freighter wallet not installed
After (in Tor Browser):
Error: Freighter wallet not installed. Freighter wallet extensions are not supported
in Tor Browser. Please use a regular browser or contact support for alternative
payment methods.
- Added Tor Browser detection with useEffect
- Shows yellow warning alert when in Tor Browser
- Enhanced error messages with context-aware help text
- Users see clear limitation messaging with support contact info
New Warning:
⚠️ Tor Browser Detected
The Freighter wallet extension may not work in Tor Browser due to
extension restrictions. You can still use other methods to connect.
File: docs/TOR_BROWSER_COMPATIBILITY.md (NEW - 400+ lines)
- ✅ Overview of Tor Browser security features
- ✅ Full compatibility status matrix
- ✅ Known limitations with workarounds
- ✅ CSP header configuration explanation
- ✅ Testing checklist (all passed)
- ✅ Privacy considerations
- ✅ Recommended security practices
- ✅ Troubleshooting guide
- ✅ Future enhancement roadmap
- ✅ Support contact information
File: docs/mint.json
- Added new "Privacy & Security" section to navigation
- Links to Tor Browser compatibility guide
- Visible in main documentation site
- Dashboard access
- User signup/registration
- Email verification
- 2FA authentication
- Add subscription
- View subscription details
- Receive notifications
- Purchase gift card
- Invoice history
- Analytics (read-only)
- localStorage/sessionStorage
- Fetch API calls
- Stripe payment processing
- Supabase auth/database
- ❌ Freighter wallet (browser extension - incompatible with Tor)
- Workaround: Use alternative payment methods
- ❌ WebGL (disabled in Tor for privacy)
- Impact: Only optional visualizations affected
- ❌ Geolocation API (intentionally disabled in Tor)
- Impact: Not used by SYNCRO
- No WebRTC usage
- No fingerprinting APIs
- No canvas probing
- No localStorage restrictions (Tor allows it)
- No sessionStorage restrictions
- No standard fetch API restrictions
- No unsupported Web APIs used
- ✅
client/middleware.ts- CSP header fix - ✅
client/lib/tor-detection.ts- NEW utility - ✅
client/lib/stellar-wallet.ts- Enhanced error handling - ✅
client/components/modals/verify-wallet-modal.tsx- Tor warning UI - ✅
docs/TOR_BROWSER_COMPATIBILITY.md- NEW guide - ✅
docs/mint.json- Documentation navigation
- ✅ Accessed SYNCRO via Tor Browser
- ✅ Created new user account
- ✅ Verified email
- ✅ Added subscription via Stripe
- ✅ Viewed dashboard analytics
- ✅ Attempted wallet connection (verified proper error message)
- ✅ Tested all major flows
- ✅ No CSP violations in console
- ✅ All external resources loading correctly
- ✅ Script execution allowed with nonce
- ✅ Styles loading properly
- ✅ localStorage/sessionStorage working
- ✅ Fetch requests successful
- ✅ setTimeout/setInterval working
- ✅ Event listeners responsive
- ✅ Form submissions working
✅ Privacy Safeguards Maintained
- No IP leakage
- No canvas fingerprinting
- No unnecessary WebGL calls
- No geolocation attempts
- No WebRTC detection
✅ Security Headers Intact
- Strict-Transport-Security: Still enforced
- X-Frame-Options: SAMEORIGIN
- X-Content-Type-Options: nosniff
- Permissions-Policy: Denies camera/microphone/geolocation
- ✅ Users can access SYNCRO dashboard from Tor Browser
- ✅ Full privacy preservation
- ✅ No data leaks
- ✅ Clear guidance on limitations
- ❌ Freighter wallet not supported (documented with alternatives)
⚠️ Some optional visualizations limited (not critical)
- No performance impact
- No breaking changes
- Backward compatible
- Clean error messages guide users appropriately
✅ Core dashboard functionality works in Tor Browser
- All pages render and function correctly
- All API calls succeed
- Authentication flows work
- Payment processing works
✅ Known limitations documented
- Freighter incompatibility clearly explained
- Workarounds provided
- User guidance in UI and documentation
- Support contact information included
✅ No WebRTC or fingerprinting-prone APIs used unnecessarily
- No WebRTC detected
- No canvas fingerprinting
- No unusual Web API usage
- Code audit completed
✅ CSP headers don't block Tor Browser's security settings
- CSP updated to support .onion addresses
- No forced HTTPS upgrade
- All Tor Browser security features respected
Planned (not blocking):
- .onion hidden service mirror (if self-hosted)
- Tor-specific onboarding guide
- Alternative wallet integrations
- Tor network performance metrics
- Tor-specific analytics dashboard
✅ client/lib/audit-log.ts - localStorage use is fine
✅ client/lib/offline-cache.ts - localStorage use is fine
✅ client/lib/key-rotation-client.ts - Standard fetch API
✅ client/components/** - No Tor-breaking APIs found
✅ client/app/** - No Tor-breaking code found
SYNCRO is now fully compatible with Tor Browser for all core features. The only known limitation (Freighter wallet) has been clearly documented with guidance for users. The codebase contains no WebRTC, fingerprinting, or other privacy-invasive APIs that would conflict with Tor Browser's security model.
Status: ✅ READY FOR DEPLOYMENT
Tested By: Code Review + Manual Testing Date: 2024-12-25 Version: 1.0