Skip to content

Commit 4311d34

Browse files
committed
If plugins fail, fail close and drop the response
1 parent d626381 commit 4311d34

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

dnscrypt-proxy/proxy.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ func (proxy *Proxy) processIncomingQuery(
715715
var serverName string = "-"
716716

717717
// Apply query plugins with lazy server selection
718-
query, _ = pluginsState.ApplyQueryPlugins(
718+
query, err := pluginsState.ApplyQueryPlugins(
719719
&proxy.pluginsGlobals,
720720
query,
721721
func() (*ServerInfo, bool) {
@@ -734,6 +734,13 @@ func (proxy *Proxy) processIncomingQuery(
734734
return serverInfo, needsPadding
735735
},
736736
)
737+
if err != nil {
738+
dlog.Debugf("Plugins failed: %v", err)
739+
pluginsState.action = PluginsActionDrop
740+
pluginsState.returnCode = PluginsReturnCodeDrop
741+
pluginsState.ApplyLoggingPlugins(&proxy.pluginsGlobals)
742+
return response
743+
}
737744
if !validateQuery(query) {
738745
return response
739746
}
@@ -746,7 +753,6 @@ func (proxy *Proxy) processIncomingQuery(
746753
}
747754

748755
// Handle synthesized responses from plugins
749-
var err error
750756
if pluginsState.synthResponse != nil {
751757
response, err = handleSynthesizedResponse(&pluginsState, pluginsState.synthResponse)
752758
if err != nil {

0 commit comments

Comments
 (0)