-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[TT-14798] Replace JSEscapeString with json.Marshal for RFC 8259-compliant error responses #7527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…liant error responses
🚨 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. |
|
API Changes no api changes detected |
🔍 Code Analysis ResultsThis pull request refactors the error handling mechanism for JSON responses to ensure RFC 8259 compliance. The core change is replacing the Files Changed Analysis
Architecture & Impact AssessmentWhat this PR accomplishesThis PR fixes a bug where error messages in JSON responses were not escaped according to the JSON standard (RFC 8259). This ensures that API consumers receive well-formed JSON error payloads, preventing parsing issues when error messages contain special characters. Key technical changes introducedThe key change is the switch from Affected system componentsThe primary component affected is the Gateway's Error Handler. This handler is invoked whenever a middleware in the request processing chain returns an error. Because middleware is used for fundamental features like authentication, rate limiting, and request validation, this change impacts a wide range of error scenarios across all APIs managed by the gateway. Here is a diagram illustrating the error handling flow: sequenceDiagram
participant Client
participant Gateway
participant MiddlewareChain
participant ErrorHandler
Client->>Gateway: API Request
Gateway->>MiddlewareChain: Process Request
MiddlewareChain-->>Gateway: Error (e.g., Auth Failed)
Gateway->>ErrorHandler: HandleError(err)
ErrorHandler-->>Gateway: Create JSON Error Response
Note over ErrorHandler: Escapes error message using json.Marshal
Gateway-->>Client: 4xx/5xx Response with valid JSON body
Scope Discovery & Context ExpansionThe investigation into the usage of This means the corrected escaping will apply to errors generated by:
Essentially, any scenario that results in a synchronous error response during the request lifecycle will now benefit from the corrected JSON escaping. The change is confined to the gateway's core, and no other services or modules are directly affected, but all API consumers will see the corrected output. Metadata
Powered by Visor from Probelabs Last updated: 2025-11-08T19:33:00.796Z | Triggered by: opened | Commit: 40efe08 💡 TIP: You can chat with Visor using |
🔍 Code Analysis ResultsSecurity Issues (1)
Architecture Issues (1)
Performance Issues (1)
Quality Issues (2)
✅ Dependency Check PassedNo dependency issues found – changes LGTM. ✅ Connectivity Check PassedNo connectivity issues found – changes LGTM. Powered by Visor from Probelabs Last updated: 2025-11-08T19:33:01.497Z | Triggered by: opened | Commit: 40efe08 💡 TIP: You can chat with Visor using |
|




Description
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
Ticket Details
TT-14798
Generated at: 2025-11-08 19:25:42