Repository navigation
Conversation
## Motivation and Context `inspect` is what error reporters, consoles and log lines print an object with, and the default one walks every instance variable. On `MCP::Client::HTTP` that printed the values of the static `headers:`, often an API key, the userinfo and query of the URL, and the session id. On `ClientCredentialsProvider` it printed a `private_key` given as a PEM String in full. On `MCP::Client::Stdio` it printed the `env:` and the arguments given to the server process, where its API keys usually go, and on the server side `IntrospectionVerifier`, `JWTVerifier` and `RequestStateSecurity` printed their client secret or key. `MCP::Client#inspect` prints its transport, so it showed the same. `InMemoryStorage` already keeps the tokens and the client secret out of its `inspect` for this reason. `MCP::Client::HTTP#inspect` now shows the header names, the URL without its userinfo and query, and whether a session is open, and `ClientCredentialsProvider#inspect` shows whether a key is held. Each names the class of the provider or storage it holds and prints nothing of it, since what a custom one prints is its own to decide. `MCP::Client::Stdio#inspect` shows the command, the number of arguments and the names of the variables, and the three server classes show whether they hold a secret or a key. ## How Has This Been Tested? `test/mcp/client/http_test.rb`, `test/mcp/client/oauth/client_credentials_provider_test.rb`, `test/mcp/client/stdio_test.rb`, `test/mcp/server/oauth/introspection_verifier_test.rb`, `test/mcp/server/oauth/jwt_verifier_test.rb` and `test/mcp/server/request_state_security_test.rb`. Against the previous library each new test finds the secret in the output. ## Breaking Changes None, unless a caller parsed the default `inspect` output of these classes.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
inspectis what error reporters, consoles and log lines print an object with, and the default one walks every instance variable. OnMCP::Client::HTTPthat printed the values of the staticheaders:, often an API key, the userinfo and query of the URL, and the session id. OnClientCredentialsProviderit printed aprivate_keygiven as a PEM String in full. OnMCP::Client::Stdioit printed theenv:and the arguments given to the server process, where its API keys usually go, and on the server sideIntrospectionVerifier,JWTVerifierandRequestStateSecurityprinted their client secret or key.MCP::Client#inspectprints its transport, so it showed the same.InMemoryStoragealready keeps the tokens and the client secret out of itsinspectfor this reason.MCP::Client::HTTP#inspectnow shows the header names, the URL without its userinfo and query, and whether a session is open, andClientCredentialsProvider#inspectshows whether a key is held. Each names the class of the provider or storage it holds and prints nothing of it, since what a custom one prints is its own to decide.MCP::Client::Stdio#inspectshows the command, the number of arguments and the names of the variables, and the three server classes show whether they hold a secret or a key.How Has This Been Tested?
test/mcp/client/http_test.rb,test/mcp/client/oauth/client_credentials_provider_test.rb,test/mcp/client/stdio_test.rb,test/mcp/server/oauth/introspection_verifier_test.rb,test/mcp/server/oauth/jwt_verifier_test.rbandtest/mcp/server/request_state_security_test.rb. Against the previous library each new test finds the secret in the output.Breaking Changes
None, unless a caller parsed the default
inspectoutput of these classes.Types of changes
Checklist