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).
This commit is contained in:
Graham McIntire 2026-02-06 10:41:30 -06:00 committed by Graham McIntire
parent a4dd7210d8
commit d03ad72aec
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -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",