Skip to content

Security fixes#2

Open
magicbadger wants to merge 3 commits intofrandallfarmer:masterfrom
magicbadger:security_fixes
Open

Security fixes#2
magicbadger wants to merge 3 commits intofrandallfarmer:masterfrom
magicbadger:security_fixes

Conversation

@magicbadger
Copy link
Copy Markdown

Asked Claude to recommend some fixes to cover security issues, and it proposed a range of critical and low priority fixes. Haven't tested them yet but hope to test soon.

magicbadger and others added 3 commits February 24, 2026 09:21
Phase 1 — Critical:
- arlo-viewer: fail-fast if AUTH_PASSWORD/AUTH_SECRET/THUMBNAIL_SECRET/TLS vars unset
- arlo-viewer: replace SHA256 swizzle with PBKDF2 (100k iterations) for session tokens
- arlo-viewer: switch HTTP server to HTTPS (TLS cert path from env)
- arlo-viewer: cookie hardening — SameSite=Strict, Secure flag, 30-day Max-Age
- arlo-viewer: safeFilePath() using path.resolve() prefix check on all file endpoints
- arlo-viewer: rate limit /login to 10 attempts per 15 minutes (express-rate-limit)
- api.py: bind Flask to 127.0.0.1:5000 only (fix lambda bug in get_thread too)
- api.py: serial number format validation in validate_camera_request()
- api.py: snapshot endpoint — identifier regex, realpath path check, 5MB size limit
- api.py: require_bool() helper applied to userstreamactive endpoint
- api.py: fix bare except -> except Exception
- install.sh: generate AUTH_SECRET, THUMBNAIL_SECRET, VIEWER_PASSWORD at install time
- install.sh: write /etc/arlo/viewer.env (mode 640, root:user)
- install.sh: generate self-signed TLS cert in /etc/arlo/tls/
- install.sh: write ThumbnailSecret into arlo-cam-api config.yaml
- install.sh: add EnvironmentFile to installed arlo-viewer.service
- install.sh: print generated password at completion

Phase 2 — High:
- arlo-viewer: HMAC-SHA256 token required on /api/thumbnail/:filename
- arlo-viewer: /api/recordings includes pre-signed thumbnailUrl per entry
- webhook_manager: append ?token=<hmac> to ntfy Attach thumbnail URL

Phase 3 — Medium:
- arlo-viewer.service: add EnvironmentFile=/etc/arlo/viewer.env
- config.yaml.example: document ThumbnailSecret field
- package.json: add express-rate-limit dependency

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…session

1. Sanitize verbose exception messages (api.py)
   - stream_start/stop now log internally and return generic error strings
   - Internal IPs, paths, and exception details no longer leak to clients

2. Security headers (server.js)
   - Add X-Content-Type-Options: nosniff
   - Add X-Frame-Options: DENY
   - Add Referrer-Policy: no-referrer

3. XSS fix in recording gallery (index.html)
   - Add escapeHtml() helper
   - All user-controlled values (serial, friendlyName, filename, camera, timestamp)
     now escaped in HTML context
   - onclick handlers use data attributes instead of string interpolation
     to prevent JS injection via crafted camera names

4. Friendly name length validation (api.py)
   - Reject names over 64 characters or non-string values

5. Socket timeout (arlo/socket.py)
   - ArloSocket now sets 30s timeout on all sockets at construction
   - Prevents hung connection threads when cameras stop sending mid-message

6. Absolute database path (server.py, arlo/camera.py, api/api.py, helpers/connectivity_checker.py)
   - All sqlite3.connect() calls now use DB_PATH computed from __file__
   - No longer dependent on process working directory

7. Reduce session cookie lifetime from 30 days to 24 hours (server.js)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant