|
|
1d928d4356
|
security: implement comprehensive security audit fixes
Critical Fixes:
- Remove /health/time endpoint exposing system time information
* Prevents attackers from detecting time sync issues for TOTP attacks
* Removed route and controller function, updated tests
- Add email confirmation check to account data export
* GDPR export now requires confirmed email address
* Prevents unconfirmed accounts from accessing data export
- Add path traversal validation for MIB archive uploads
* Extract to temp directory, validate all paths, then copy if safe
* Prevents malicious tar/zip files from writing outside target directory
* Added validate_extracted_paths/1 helper function
High Priority Fixes:
- Add comprehensive input validation for mobile auth
* Length limits: device_name (255), device_os (100), app_version (50), push_token (512)
* Prevents database corruption and storage exhaustion
- Add heartbeat rate limiting to agent channel
* Limit database updates to once per 30 seconds (max ~2/min per agent)
* Prevents malicious agents from exhausting database connections
- Sanitize 500 error responses
* Return generic error messages to clients
* Log full details server-side with request_id for support
* Prevents leaking stack traces and module names
- Add message size limits to agent channel
* 10MB maximum for all protobuf messages (result, heartbeat, error)
* Prevents DoS attacks via oversized payloads
Medium Priority Fixes:
- Add GraphQL query depth limits (max_depth: 10)
* Prevents DoS from deeply nested queries
* Complements existing complexity limits
Code Quality:
- Refactor agent channel handlers to reduce nesting depth
* Extract message processing into separate private functions
* Fixes Credo warnings about excessive nesting
* Improves code readability and maintainability
Files changed:
- lib/towerops_web/controllers/health_controller.ex
- lib/towerops_web/controllers/api/account_data_controller.ex
- lib/towerops_web/controllers/api/v1/mib_controller.ex
- lib/towerops/mobile_sessions/mobile_session.ex
- lib/towerops_web/channels/agent_channel.ex
- lib/towerops_web/controllers/error_json.ex
- lib/towerops_web/router.ex
- CHANGELOG.txt
- priv/static/changelog.txt
- test/towerops_web/controllers/health_controller_test.exs
- test/towerops_web/controllers/error_json_test.exs
All 7,424 tests passing.
|
2026-03-05 13:08:10 -06:00 |
|
|
|
61a06fc11c
|
Add firmware version tracking system
- Add firmware context module with upsert, query, and logging functions
- Add FirmwareVersionFetcherWorker to fetch MikroTik RSS daily
- Add Oban cron schedules (2 AM dev, 4 AM prod)
- Add version change detection to Discovery module
- Track firmware history with PubSub broadcasts
- All tests passing
Phase 3-5 of firmware tracking implementation complete.
Next: LiveView UI indicators.
|
2026-02-01 10:46:27 -06:00 |
|