-
-
Notifications
You must be signed in to change notification settings - Fork 415
[FEAT] : ADD HEADERS FW to tools #271
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
Open
GlisseManTV
wants to merge
16
commits into
open-webui:dev
Choose a base branch
from
GlisseManTV:main
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+204
−43
Conversation
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
Update pyproject.toml
Changed logging levels from debug to info in header filtering and processing functions to improve visibility of header decisions in logs. This provides clearer operational insights without overwhelming logs with debug-level messages. The changes are consistent across filter_headers, process_headers_for_server, and tool endpoint logging, maintaining clarity while reducing noise.
Refactored the handling of forwarded headers in tool endpoint calls to pass headers as arguments instead of using meta. This change simplifies the interface by removing the need for a separate meta dictionary, improves consistency, and aligns with the expected argument structure of session.call_tool. The logger messages were updated to reflect the new argument structure, and error handling was preserved for robustness.
Changed the internal header storage key from `__mcpo_forwarded_headers__` to `mcpo_headers` for consistency and clarity. This improves code readability and maintains a uniform naming convention across the codebase.
Adds a new function `mask_sensitive_headers` to obfuscate sensitive header values (like Authorization, API keys) in log output. This improves security by preventing sensitive data from being exposed in logs while maintaining debuggability. The masking is applied to headers in the request arguments before logging, replacing values with placeholders like "Bearer *****" or "*****". This change ensures that even when detailed request data is logged, sensitive information remains protected.
Removed deprecated mask_sensitive_headers function and updated logging to display raw arguments instead of masked ones. This simplifies the codebase by eliminating unused functionality while maintaining clarity in logs. The change improves maintainability and reduces potential confusion around sensitive data handling.
Adds a utility function to mask sensitive header values (e.g., authorization, API keys) in log output to enhance security and prevent accidental exposure of credentials. The function recursively masks values like Bearer, Basic, and API-Key tokens, replacing them with placeholders. Applied in tool handler logging to ensure sensitive data is not logged in plain text. The change also updates the argument key from "__mcpo_forwarded_headers__" to "mcpo_headers" for consistency and improves logging output by masking sensitive data before being logged.
Changed logging in get_tool_handler to output raw arguments instead of masked arguments for better debugging and monitoring. This change helps in troubleshooting by providing access to the actual arguments passed to endpoints, while still maintaining the security of masked headers in the actual request processing.
Disabled the masking of sensitive headers in the tool handler to allow for debugging and testing of header forwarding functionality. The masking logic can be re-enabled once the header handling is fully validated. This change affects the get_tool_handler function in src/mcpo/utils/main.py where the mask_sensitive_headers call was commented out.
- Replace shallow copy with deep copy in mask_sensitive_headers function to properly handle nested dictionaries - Apply sensitive data masking to arguments before logging to prevent exposure of sensitive information - Ensure headers are properly masked before being logged for debugging purposes
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.
Pull Request Checklist
Before submitting, make sure you've checked the following:
devbranch.Changelog Entry
Description
using a custom arg "mcpo_headers" pushed in arguments list.
Adding a function to mask headers in logs.
Added
Changed
Deprecated
Removed
Fixed
Security
Breaking Changes
Additional Information
Screenshots or Videos