Internalize json_rpc_handler along with an XSS vulnerability fix #175
      
        
          +816
        
        
          −2
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Motivation and Context
The ruby-sdk gem is the only popular gem that uses the json_rpc_handler gem. For tweaks around transport error handling, there is an ongoing awkwardness of working around the opinions of the json_rpc_handler gem or needing to extend that gem to make its API more flexible.
Just internalizing the JSON-RPC handling will alllow mcp gem development to move faster.
Incidentally, we also pick up an unreleased security fix on json_rpc_handler:
Reviewers: Follow individual commits to see the incremental steps I took in copying things over, so you're not tasked with reviewing the entire internalized "new" code. Code copied from commit Shopify/json-rpc-handler@b41c412
How Has This Been Tested?
Existing unit tests pass.
Breaking Changes
The gem becomes stringent on the format of JSON-RPC call ids by default, to prevent an XSS vulnerability.
Types of changes
Checklist
Additional context