Conversation
|
This pull request resolves a critical bug that caused panics when a Go plugin writes its own HTTP response. The issue stemmed from duplicate The fix introduces a control-flow mechanism using two new sentinel errors, Files Changed Analysis
Architecture & Impact Assessment
Middleware Control FlowsequenceDiagram
participant Client
participant MiddlewareHandler
participant GoPluginMiddleware
participant Plugin
Client->>+MiddlewareHandler: Sends Request
MiddlewareHandler->>+GoPluginMiddleware: ProcessRequest(w, r)
GoPluginMiddleware->>+Plugin: Executes plugin function
alt Plugin sends custom error response
Plugin-->>Plugin: w.WriteHeader(403)#59; w.Write(...)
Plugin-->>-GoPluginMiddleware: returns
GoPluginMiddleware-->>-MiddlewareHandler: return ErrResponseErrorSent
MiddlewareHandler-->>MiddlewareHandler: Detects ErrResponseErrorSent, skips its own error response
MiddlewareHandler-->>-Client: Returns plugin's 403 response
else Plugin succeeds and sends response
Plugin-->>Plugin: w.WriteHeader(200)#59; w.Write(...)
Plugin-->>-GoPluginMiddleware: returns
GoPluginMiddleware-->>-MiddlewareHandler: return ErrResponseSucceed
MiddlewareHandler-->>MiddlewareHandler: Detects ErrResponseSucceed, stops processing
MiddlewareHandler-->>-Client: Returns plugin's 200 response
end
Scope Discovery & Context ExpansionThe fix is well-contained within the Go plugin middleware system. However, it highlights a design limitation in the generic While this PR effectively solves the problem for Go plugins, any other custom middleware that might need to write a response directly could face the same issue. A future architectural improvement could involve refactoring the Metadata
Powered by Visor from Probelabs Last updated: 2026-04-15T04:02:16.022Z | Triggered by: pr_updated | Commit: 7d14a28 💡 TIP: You can chat with Visor using |
✅ Security Check PassedNo security issues found – changes LGTM. ✅ Performance Check PassedNo performance issues found – changes LGTM. Quality Issues (1)
Powered by Visor from Probelabs Last updated: 2026-04-15T04:01:56.460Z | Triggered by: pr_updated | Commit: 7d14a28 💡 TIP: You can chat with Visor using |
…-malformed-responses-from-golang-plugins
|
API Changes --- prev.txt 2026-04-15 04:02:03.454609934 +0000
+++ current.txt 2026-04-15 04:01:55.014563200 +0000
@@ -9489,6 +9489,18 @@
ErrNoMatchingKIDFound = errors.New("no matching KID could be found")
)
var (
+ ErrResponseSucceed = errpack.New(
+ "response succeed",
+ errpack.WithType(errpack.TypeDomain),
+ errpack.WithLogLevel(logrus.TraceLevel),
+ )
+ ErrResponseErrorSent = errpack.New(
+ "plugin error",
+ errpack.WithType(errpack.TypeDomain),
+ errpack.WithLogLevel(logrus.DebugLevel),
+ )
+)
+var (
ProxyingRequestFailedErr = errors.New("there was a problem proxying the request")
GraphQLDepthLimitExceededErr = errors.New("depth limit exceeded")
)
@@ -15082,6 +15094,14 @@
func MyResponsePluginAccessingOASAPI2(rw http.ResponseWriter, _ *http.Response, req *http.Request)
MyResponsePluginAccessingOASAPI2 fake plugin which modifies headers
+func RejectWithBody(
+ rw http.ResponseWriter,
+ _ *http.Request,
+)
+func RejectWithoutBody(
+ rw http.ResponseWriter,
+ _ *http.Request,
+)
# Package: ./tests/accesslog
# Package: ./tests/coprocess |
…-malformed-responses-from-golang-plugins
…-malformed-responses-from-golang-plugins
🚨 Jira Linter FailedCommit: The Jira linter failed to validate your PR. Please check the error details below: 🔍 Click to view error detailsNext Steps
This comment will be automatically deleted once the linter passes. |
|



Description
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist