Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@veshij
Copy link
Contributor

@veshij veshij commented Jun 5, 2025

1. Why is this pull request needed and what does it do?

cache plugin mutates responses of other plugins:
https://github.com/coredns/coredns/blob/master/plugin/cache/cache.go#L216-L228
The behavior seems to be against the plugin guideline:

Using a custom ResponseWriter, a plugin can mutate a response when another plugin further down the chain writes the response to the client. If a plugin mutates a response it MUST make a copy of the entire response before doing so. A response is a pointer to a dns.Msg and as such you will be manipulating the original response, which could have been generated from a data store.

2. Which issues (if any) are related?

Fixes #7335

3. Which documentation changes (if any) need to be made?

None

4. Does this introduce a backward incompatible change or deprecation?

No

@veshij veshij marked this pull request as ready for review June 5, 2025 21:19
@veshij veshij requested review from chrisohaver and miekg as code owners June 5, 2025 21:19
@codecov
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.91%. Comparing base (93c57b6) to head (87a41cf).
Report is 1492 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7357      +/-   ##
==========================================
+ Coverage   55.70%   59.91%   +4.21%     
==========================================
  Files         224      273      +49     
  Lines       10016    17919    +7903     
==========================================
+ Hits         5579    10737    +5158     
- Misses       3978     6559    +2581     
- Partials      459      623     +164     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yongtang yongtang merged commit 27273a3 into coredns:master Jun 6, 2025
13 checks passed
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.

Cache plugin mutates state of other plugins

2 participants