From d03ad72aec1bcb661d56d9da2b2b6ddb9c586e05 Mon Sep 17 00:00:00 2001 From: mayor Date: Fri, 6 Feb 2026 10:41:30 -0600 Subject: [PATCH] Increase max OID values limit from 1,000 to 50,000 Fixes discovery failures on enterprise network devices with many interfaces and routing table entries. Issue: Discovery was failing with "too_many_oids - OID values map exceeds 1000 entries" on SNMPv3 devices. Enterprise routers/switches during discovery can easily return 10k-50k OIDs from: - 100+ interfaces with 20-30 OIDs each - System info, routing tables, ARP tables, neighbor tables - Various MIB objects The original limit of 1,000 was too restrictive for real-world devices while still being intended as DoS protection. Changes: - Increase @max_oid_values from 1,000 to 50,000 - Update test to generate 50,100 OIDs (exceeds new limit) - Add comment explaining why limit is set to 50k This maintains DoS protection (prevents multi-million OID attacks) while accommodating realistic device discovery scenarios. All tests passing (5578 tests, 0 failures). --- lib/towerops/agent/validator.ex | 3 ++- test/towerops/agent/validator_test.exs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/towerops/agent/validator.ex b/lib/towerops/agent/validator.ex index 60a84241..9689db7b 100644 --- a/lib/towerops/agent/validator.ex +++ b/lib/towerops/agent/validator.ex @@ -60,7 +60,8 @@ defmodule Towerops.Agent.Validator do # Collection limits (prevent DoS via large batches) @max_metrics_per_batch 10_000 - @max_oid_values 1_000 + # Discovery on enterprise devices can return 10k-50k OIDs (interfaces, routing tables, etc.) + @max_oid_values 50_000 @max_mikrotik_sentences 1_000 @max_capabilities 20 diff --git a/test/towerops/agent/validator_test.exs b/test/towerops/agent/validator_test.exs index a1553b0c..8f28857c 100644 --- a/test/towerops/agent/validator_test.exs +++ b/test/towerops/agent/validator_test.exs @@ -365,8 +365,8 @@ defmodule Towerops.Agent.ValidatorTest do end test "rejects too many OID values" do - # Create map with more than max allowed OIDs - oid_values = Map.new(1..1100, fn i -> {"1.3.6.1.#{i}", "value"} end) + # Create map with more than max allowed OIDs (max is 50_000) + oid_values = Map.new(1..50_100, fn i -> {"1.3.6.1.#{i}", "value"} end) result = %SnmpResult{ device_id: "550e8400-e29b-41d4-a716-446655440000",