Skip to content

fix(caddyfile): guard snippet import cycles#8

Merged
yongtang merged 1 commit into
coredns:masterfrom
thevilledev:fix/import-loop
Sep 19, 2025
Merged

fix(caddyfile): guard snippet import cycles#8
yongtang merged 1 commit into
coredns:masterfrom
thevilledev:fix/import-loop

Conversation

@thevilledev

@thevilledev thevilledev commented Sep 18, 2025

Copy link
Copy Markdown

Add a cycle guard for Caddyfile snippet imports. Track snippet expansions with a hard cap (1000) and error on trivial self-imports in snippet bodies to prevent infinite recursion.

Add tests for snippet self-import, to validate the newly added failure state. Run the TestSnippetImportCycle test against master branch and you will see it times out:

$ go test ./caddyfile -timeout=5s -run ^TestSnippetImportCycle$
panic: test timed out after 5s

Originally found in OSS-Fuzz issue #42486385 while fuzzing CoreDNS.

Once merged, could we publish a new release and bump the dependency in CoreDNS?

Add a cycle guard for Caddyfile snippet imports. Track snippet
expansions with a hard cap (1000) and error on trivial self-imports
in snippet bodies to prevent infinite recursion. Add tests for
snippet self-import failure.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
@thevilledev

Copy link
Copy Markdown
Author

cc @miekg @yongtang - just realised there's no CODEOWNERS file present in the repo, thus no notifications 😃

@yongtang yongtang merged commit fabd98a into coredns:master Sep 19, 2025
1 check passed
jdamick pushed a commit to jdamick/caddy that referenced this pull request Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants