The original application had a hardcoded password ('manakai') in the source code, which was visible in the GitHub repository. This has been fixed with a secure authentication system.
- Separate auth file: Password moved to
src/config/auth.js - Git ignored:
src/config/auth.jsis excluded from version control - Environment variables: Support for
REACT_APP_COLLECTOR_PASSWORDenvironment variable - Example file:
src/config/auth.example.jsprovides a template
- Centralized validation function in
src/config/auth.js - Consistent validation across all components
- No hardcoded passwords in source code
# Run the interactive setup script
./setup-auth.sh# Copy the example file
cp src/config/auth.example.js src/config/auth.js
# Edit the file with your secure password
nano src/config/auth.js# Set environment variable and build
VITE_COLLECTOR_PASSWORD=your-secure-password npm run build- Use strong, unique passwords
- Minimum 8 characters
- Include uppercase, lowercase, numbers, and symbols
- Avoid common words or patterns
# Set secure environment variable
export VITE_COLLECTOR_PASSWORD="your-very-secure-password"
# Build with environment variable
npm run build- Change the collector password regularly
- Use different passwords for development and production
- Monitor access logs for suspicious activity
# Set environment variable on server
export VITE_COLLECTOR_PASSWORD="production-secure-password"
# Build with secure password
npm run build
# Deploy using rsync script
./deploy-rsync.sh <SERVER_IP> <USERNAME> /var/www/biomap- Go to Vercel dashboard
- Navigate to your project settings
- Add environment variable:
VITE_COLLECTOR_PASSWORD - Set the value to your secure password
- Redeploy the application
src/
βββ config/
β βββ auth.js # π SECURE - Contains actual password (gitignored)
β βββ auth.example.js # π EXAMPLE - Template for setup
βββ components/
β βββ LandingPage.jsx # β
UPDATED - Uses secure validation
β βββ LandingPage_backup.jsx # β
UPDATED - Uses secure validation
βββ ...
- Never commit
src/config/auth.js- It's in.gitignore - Use strong passwords - Avoid default or weak passwords
- Environment variables for production - Don't rely on default values
- Regular updates - Change passwords periodically
-
Check that
src/config/auth.jsis not tracked by git:git status src/config/auth.js # Should show "untracked" or not appear at all -
Verify
.gitignorecontains the auth file:grep "auth.js" .gitignore # Should show: src/config/auth.js
-
Test the application with the new password
- Password not working: Check
src/config/auth.jsexists and has correct password - Build errors: Ensure
src/config/auth.jsis properly formatted - Environment variable not working: Verify
VITE_prefix is used
If you lose access to the collector mode:
- Check
src/config/auth.jsfor the current password - If file is missing, run
./setup-auth.shto recreate it - For production, check environment variables on your deployment platform
- Always use HTTPS in production
- Configure SSL certificates properly
- Redirect HTTP to HTTPS
- Implement rate limiting for password attempts
- Consider adding CAPTCHA for multiple failed attempts
- Implement session timeouts
- Clear sensitive data on logout
- Use secure session storage
- Log authentication attempts
- Monitor for suspicious activity
- Regular security audits
Remember: Security is an ongoing process. Regularly review and update your security measures!