Commit Graph

1389 Commits

Author SHA1 Message Date
Catena cyber
625f6c9307 perf: avoid string concatenation in loops (#7572)
* perf: avoid string concatenation in loops

Apply perfpsrint linter

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>

* ci: enable perfsprint

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>

---------

Signed-off-by: Philippe Antoine <contact@catenacyber.fr>
2025-10-06 00:05:58 -07:00
Olli Janatuinen
83ce0baeac plugin/nomad: Add a Nomad plugin (#7467)
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-09-30 09:35:32 -07:00
Ville Vesilehto
70fb03f711 fix(file): fix data race in tree Elem.Name (#7574)
Eagerly set name in newElem and make Name() read-only to avoid
racy lazy writes under concurrent lookups. Add tests for empty-name
comparisons and concurrent access to Less/Name(). In addition,
regression tests to CloudDNS plugin.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-28 19:49:47 -07:00
Ville Vesilehto
31e285994b plugin/loop: avoid panic on invalid server block (#7568)
Ignore invalid ServerBlockKeys in loop plugin that fail
normalization. Retain the default “.” zone instead of
indexing into an empty slice. This prevents an
index-out-of-range panic triggered by malformed
inputs such as "unix://".

Added tests to validate and increase test coverage.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-21 22:44:36 -07:00
Ville Vesilehto
0d05791404 lint: enable nakedret (#7569)
Replace naked returns with explicit return values to satisfy nakedret
linter and improve readability.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-21 08:17:35 -07:00
Ville Vesilehto
dd029c931f chore: bump coredns/caddy dependency to latest (#7567)
To fix Corefile related import cycle issue. Update docs.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-20 16:33:00 -07:00
Ville Vesilehto
6ec327836b fix: prevent SIGTERM/reload deadlock (#7562) 2025-09-19 04:01:53 -07:00
Ville Vesilehto
5532ba8484 fix(plugin): prevent panic when ListenHosts is empty (#7565) 2025-09-19 03:59:37 -07:00
Ville Vesilehto
051d8d6f05 fix(plugin): normalize panics on invalid origins (#7563)
Previously OriginsFromArgsOrServerBlock accessed the output of
NormalizeExact() by index 0, which could panic when normalization
returned an empty slice on error. This happens with malformed input
surfaced by fuzzing, for example "unix://<non‑UTF8>".

This change hardens normalization in the server block path.
If normalization yields no entries, the original value is preserved.
The function still returns a newly copied slice.

This preserves legacy semantics for valid inputs while eliminating
the crash on malformed ones. Added tests to validate.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-18 19:15:40 -07:00
Ville Vesilehto
0440e54bcf fix(dnstap): add bounds for plugin args (#7557)
Validate dnstap writebuffer (MiB) and queue (x10k) args. Reject
non-integers and out-of-range values with clear errors. Updated
plugin documentation and tests.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-18 19:14:51 -07:00
Ville Vesilehto
3c950b8552 fix(forward): deflake TestFailover (#7558)
In CI, the first two upstream attempts can stall on UDP and each
consume the default 2s read timeout. Possibly exhausting most of
the 5s forward deadline before the healthy third upstream is tried.
Lower the read timeout to make retries faster.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-15 14:28:26 -07:00
Ville Vesilehto
a30954ea71 test(view): improve test coverage (#7543)
Cover edge cases in config parser. Add rudimentary View/Filter
tests. Improves test coverage from 44% to 82%.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-15 10:17:35 -07:00
Ville Vesilehto
c916cf4259 fix(plugin): nilness findings (#7556)
Enable nilness linter in govet.

Plugin-by-plugin rationale:

- plugin/transfer: reuse error instead of shadowing it inside the for
  loop by declaring "ret" outside of the loop
- plugin/view: remove redundant err check
- plugin/dnstap: avoid possible nil dereference in error reporting
  path in setup test
- plugin/forward: prevent nil deference or empty-slice dereference on
  error paths in setup test

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-15 10:17:06 -07:00
Ville Vesilehto
ba7d5ff55a test(metrics): improve test coverage (#7538)
Add more unit tests for metrics plugin, around registration
deduplication, zone management, restart/shutdown behavior and
context helpers.

Increases test coverage from 54.8% to 76.1%.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-13 15:15:25 -07:00
Ville Vesilehto
c149567dbe fix: lint issues from plugin/forward and plugin/pkg/dnstest (#7539)
To fix CI pipeline issues on master.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-13 15:14:10 -07:00
Fitz_dev
9683de0feb fix: No failover to next upstream when receiving SERVFAIL or REFUSED response codes(#7457) (#7458) 2025-09-12 14:45:01 -07:00
Ville Vesilehto
155f451957 test(grpc): add fuzzer (#7513) 2025-09-12 14:43:56 -07:00
Ville Vesilehto
8817d8f2f9 fix(grpc): enforce DNS message size limits (#7490)
Add DNS wire size validation for requests/replies. Limit gRPC
recv/send via default call options, accounting necessary
framing/protobuf overhead. An error is returned for oversized
messages. Add test.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-12 08:21:33 +03:00
Ville Vesilehto
39abf5aeba chore(lint): modernize Go (#7536)
Use modern Go constructs through the modernize analyzer from the
golang.org/x/tools package.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-10 13:08:27 -07:00
Ville Vesilehto
d2e0e6a459 chore(docs): remove extra whitespace from readmes (#7532) 2025-09-09 14:30:27 -07:00
Ville Vesilehto
0dd76bd9b1 fix(transfer): goroutine leak on axfr err (#7516) 2025-09-05 13:13:11 -07:00
Ville Vesilehto
8c2cfb01e3 plugin/etcd: fix import order for ttl test (#7515) 2025-09-05 11:45:30 -07:00
Ville Vesilehto
e1768a5d27 Merge commit from fork
Instead of casting lease ID to uint32, fix the TTL() function
to use etcd time-to-live API for determining TTL. Add configurable
min-lease-ttl and max-lease-ttl options to prevent extreme TTL
values. By default, lease records now go through bounds checking
with 30s to 1d as the min/max.

Added unit tests for validation and docs.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-09-04 17:14:27 -07:00
Ville Vesilehto
066e51675c fix(grpc): check proxy list length in policies (#7512) 2025-09-03 16:24:44 -07:00
Ville Vesilehto
1ea6a7f682 fix(plugin): guard nil lookups across plugins (#7494) 2025-09-02 13:46:47 -07:00
Ville Vesilehto
ecdff70354 lint: add missing prealloc to backend lookup test (#7510) 2025-09-02 00:41:06 -07:00
Ville Vesilehto
21176fbf1a fix(grpc): span leak on error attempt (#7487) 2025-09-01 18:09:51 -07:00
Ville Vesilehto
5424d9dc58 test(plugin): improve backend lookup coverage (#7496) 2025-09-01 18:06:31 -07:00
Ville Vesilehto
359632a2f4 lint: enable prealloc (#7493) 2025-09-01 18:05:15 -07:00
Ville Vesilehto
4d3061a9c4 lint: enable durationcheck (#7492) 2025-09-01 18:04:35 -07:00
Ilya Kulakov
89fb5058d6 plugin: Use %w to wrap user error (#7489) 2025-08-29 05:27:11 -07:00
Ville Vesilehto
5a6700c39c fix(metrics): add timeouts to metrics HTTP server (#7469)
Add ReadTimeout, WriteTimeout, and IdleTimeout (5s each) to metrics HTTP
server and test to verify timeout behavior prevents hanging connections.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-28 20:03:55 -07:00
Ville Vesilehto
2f981ff797 fix(forward): use netip package for parsing (#7472)
Replace manual host:port parsing using net.SplitHostPort +
strconv.ParseUint with the standard library net/netip function
ParseAddrPort. This eliminates integer conversion warnings and
improves type safety.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-25 13:06:44 -07:00
Ville Vesilehto
f4ab4d9ed5 test(plugin): improve test coverage for pprof (#7473)
Add tests for Startup/Shutdown methods and HTTP endpoints.
Enhance setup tests with edge cases. Increases test coverage
from 58% to 100%.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-25 13:06:19 -07:00
wencyu
2c99f62acb plugin/file: fix label offset problem in ClosestEncloser (#7465)
Signed-off-by: yuwenchao <ywc689@163.com>
2025-08-20 16:02:41 -07:00
Ville Vesilehto
2b273d48ab feat(trace): migrate dd-trace-go v1 to v2 (#7466)
- Upgrade dd-trace-go dependency to v2.2.2
- Separate Zipkin and DataDog code paths for better maintainability
- Add proper tracer shutdown through OnShutdown()
- Replace deprecated opentracer.New() with direct tracer.Start()
- Added tests

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2025-08-20 16:00:21 -07:00
Qasim Sarfraz
712a5050bd plugin/header: Remove deprecated syntax (#7436)
Signed-off-by: Qasim Sarfraz <qasimsarfraz@microsoft.com>
2025-08-08 15:38:41 -07:00
Olli Janatuinen
52639bc66c plugin/loadbalance: support prefer option (#7433)
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
2025-08-05 11:34:38 -07:00
Guillaume Jacquet
1025a199e9 Properly create hostname from IPv6 (#7431)
Generate valid hostname from IPv6 when the address ends with `::`.

Signed-off-by: Guillaume Jacquet <guillaume.jacquet@gmail.com>
2025-08-04 16:53:40 -07:00
harshith-2411-2002
6ba43927b6 fix: handle cached connection closure in forward plugin (#7427) 2025-07-28 12:06:26 -07:00
houpo-bob
2c2b075eaa refactor: use slices.Equal to simplify code (#7426) 2025-07-28 12:04:53 -07:00
Syed Azeez
1981f22170 plugin/test: fix TXT record comparison for multi-chunk vs multiple records (#7413) 2025-07-15 05:11:25 -07:00
dependabot[bot]
d5932041f7 build(deps): bump github.com/miekg/dns from 1.1.66 to 1.1.67 (#7406)
* build(deps): bump github.com/miekg/dns from 1.1.66 to 1.1.67

Bumps [github.com/miekg/dns](https://github.com/miekg/dns) from 1.1.66 to 1.1.67.
- [Changelog](https://github.com/miekg/dns/blob/master/Makefile.release)
- [Commits](https://github.com/miekg/dns/compare/v1.1.66...v1.1.67)

---
updated-dependencies:
- dependency-name: github.com/miekg/dns
  dependency-version: 1.1.67
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix build failure

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yong Tang <yong.tang.github@outlook.com>
2025-07-14 22:48:29 -07:00
Syed Azeez
d8906ce610 plugin/file: preserve case in SRV record names and targets per RFC 6763 (#7402) 2025-07-14 18:56:59 -07:00
Cameron Steel
0aee758833 fix(auto/file): return REFUSED when no next plugin is available (#7381) 2025-07-04 02:39:19 -07:00
Stephen Kitt
1449cb660e Port to AWS Go SDK v2 (#6588) 2025-07-03 02:19:21 -07:00
Sebastian Mayr
ae5e03a94d fix(cache): data race when refreshing cached messages (#7398) 2025-07-02 19:39:46 -07:00
Sebastian Mayr
06da7dcd98 fix(cache): data race when updating the TTL of cached messages (#7397) 2025-07-02 19:20:47 -07:00
Dennis Simmons
b2a2a5f648 plugin/rewrite: Add EDNS0 Unset Action (#7380)
* plugin/rewrite: EDNS0 unset action

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* plugin/rewrite: EDNS0 unset tests

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* plugin/rewrite: EDNS0 unset documentation

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* gofmt whitespace fixes

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

* plugin/rewrite: improve edns0 test coverage

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>

---------

Signed-off-by: Dennis Simmons <215134900+dennis-ix@users.noreply.github.com>
2025-06-19 17:49:37 -04:00
Dave Brown
ab74d3acf2 add args: startup_timeout for kubernetes plugin (#7068)
Signed-off-by: mangoyhuang <mangoyhuang@tencent.com>
Co-authored-by: mangoyhuang <mangoyhuang@tencent.com>
2025-06-11 11:22:07 -07:00