fix: Setting the proper content type for errors.#720
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the API's error handling by ensuring that all error responses consistently use the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly updates the content type for error responses to "application/problem+json" across both JSON-RPC and REST handlers, with updated tests reflecting these changes. However, a critical security issue was identified in the REST transport: error response bodies are constructed using manual string concatenation, which could lead to JSON injection vulnerabilities. It is strongly recommended to use a proper JSON library for serialization to ensure all output is correctly escaped. Additionally, I've provided suggestions to improve code quality by reducing constant duplication, leveraging standard library constants, and enhancing test robustness by adjusting constant visibility.
transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
Outdated
Show resolved
Hide resolved
reference/jsonrpc/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java
Outdated
Show resolved
Hide resolved
transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
Outdated
Show resolved
Hide resolved
The expected content type is application/problem+json when there is an error and not application/json Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
The expected content type is application/problem+json when there is an error and not application/json
Fixes #719 🦕