Filter regexes run on the linear-time engine, so a match timeout no longer lets a blocked name through #53
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lantea-one/ninlil#53
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Every wildcard and regex entry runs with a wall-clock 250 ms timeout (
src/dotnet/src/Ninlil.Dns.Server.Filtering/DnsFilterEngine.cs:92). A timeout counts as "no match" (:597-618):The timeout is wall-clock, so a thread stalled by load or a GC pause trips it too. B23-16 found this while fixing a flaky test and kept it as the ReDoS guard.
What changes
RegexOptions.NonBacktracking, which matches in linear time and needs no timeout. A pattern that engine refuses (backreferences, lookarounds, atomic groups and the like throwNotSupportedExceptionat construction) falls back to the backtracking engine with today's timeout and today's rule.CompileOrNull(:626) is also used byFilterListEntriesControllerandFilterPatternPreviewController, so what counts as a valid pattern must not change.DnsFilterIndex/DnsFilterListIndex.cs, record which entries use the fallback; the preview endpoint may report it (optional; if it adds a response field, anapi-regenstep follows in the same PR).DnsFilterPatternPrefilterTestsparity tests andEvaluateDomainAsync_ForARegexThatTimesOut_AllowsTheNameAndLogsAWarningare updated: the timeout test now uses a pattern that needs the fallback.Acceptance
^(a+)+$matched against 40 a's is blocked in linear time (no timeout, no warning); fails on HEAD.dotnet test src/dotnet/tests/Ninlil.Dns.Server.Filtering.Testspasses 20 times in a row.Source
b23-design.md:522(B23-16 production concern);DnsFilterEngine.cs:606-616.Owner decision 2026-10-31 (Q-BUG-1): "NonBacktracking first".
Ghost referenced this issue2026-11-05 03:03:37 -05:00