fweinberger/fix sensitive local storage #715
Merged
+8
−1
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
CodeQL pointed out we were storing some OAuth information unencrypted in SessionStorage which is not ideal: https://github.com/modelcontextprotocol/inspector/security/code-scanning/8
Not all of this information is sensitive, but the
client_secret
potentially is. We're actually unnecessarily storing this, as it's not used at any point after storage - we're storing it by default right now becuThis PR filters out the
client_secret
before storage of OAuth information to the sessionStorage for improved security.More details:
⏺ When client_secret Gets Supplied
Based on my investigation:
Conclusion
The client_secret:
The simplest fix is to filter it out when storing, since it's not needed after the initial OAuth flow completes.
How Has This Been Tested?
Ran inspector to do some smoke testing with local MCP servers, OAuth still worked, including on refresh.
Ran tests with
npm run test
and these still passed.Breaking Changes
None.
Types of changes
Checklist
Additional context