Commit graph

11 commits

Author SHA1 Message Date
d1403c8069 Fix failing tests and clean up code
- Fix doctests for Accounts, Agents.Stats, Snmp to match actual behavior
- Fix dynamic_extra_test vendor post-processing tests to seed sensor data
- Fix activity_controller_test to seed devices for feed data
- Fix session_manager_test to create browser session for test
- Fix topology_test link creation for connection test
- Fix device_monitor/driver_worker tests for unique job constraints
- Fix accounts_test expired_tokens assertion (magic link token is expired)
- Fix happy_path_test and show_events_test to seed monitor data
- Fix admin user_live_test user.name -> user.email (no name field)
- Fix schema_test to seed activity data
- Fix mobile_qr_live_test to match actual template text
- Fix SnmpKit.MIB doctests and tests for enriched return values
- Fix onboarding_live, mobile_controller, mib_test weak assertions
- Remove dead code and fix credo warnings
2026-06-16 14:54:34 -05:00
5e2a3c229e credo fixes 2026-06-14 08:56:02 -05:00
4421727e61 fix: resolve all Elixir 1.20 type system warnings across project
Removes unreachable catch-all clauses, drops unused `require Logger`
lines, adds pin operators to bitstring size patterns, reorders function
heads for correct dispatch, and replaces deprecated LoggerBackends calls.
2026-05-28 14:52:30 -05:00
320ced2d23 fix: MIB archive bomb protection, atom exhaustion guard, and vendor caching
- Enforce upload size limit (100 MB), max extracted files (2000), max
  uncompressed size (500 MB), and reject symlinks in MIB archives
- Replace unbounded String.to_atom calls in SNMP tokenizer with
  safe_atom/1 that warns when approaching the atom table limit
- Cache MIB vendor listing with persistent_term, invalidated on
  upload/delete to avoid blocking synchronous Path.wildcard scans
2026-05-12 08:31:01 -05:00
05d79287bc
chore: remove sobelow dependency 2026-03-12 16:03:08 -05:00
10e4690e97
fix: handle atom-based errors in MIB compiler and fix Oban test API
- Added case clause to handle {:error, :yecc_not_available} and other atom errors
- Refactored compile_string to reduce cyclomatic complexity (extracted error handling)
- Fixed DevicePollerWorker test to use new Oban API (Worker.perform(%Oban.Job{}))
- Removed unused Oban.Testing import

Fixes test failures:
- test/snmpkit/snmp_lib/mib_test.exs:398
- test/towerops/workers/device_poller_worker_test.exs:659
2026-03-05 12:05:36 -06:00
fb1d4c564f
security: fix critical vulnerabilities and atom exhaustion risks
Critical fixes:
- Add [:safe] option to binary_to_term to prevent RCE attacks
- Implement whitelist validation for String.to_atom conversions
- Add input validation before String.to_existing_atom usage

Changes:
- MIB compiler and cache: Use safe binary deserialization
- SNMP contexts: Whitelist protocol, device type, and source atoms
- API controllers: Validate error message keys before atom conversion
- Reduce function nesting to comply with Credo standards

All 6,145 tests passing with zero Credo issues.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-08 10:30:30 -06:00
29f00c37ed
credo fixes 2026-01-23 16:49:02 -06:00
f59cdbbd7a
credo fixes 2026-01-23 14:01:52 -06:00
7fcfdbf2e9
credo improvements 2026-01-23 13:40:49 -06:00
a0ba9285dd
bring in snmpkit 2026-01-23 12:52:17 -06:00