rmetzger opened a new issue, #1465:
URL: https://github.com/apache/flink-agents/issues/1465

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   The Python MCPServer serializes its auth field (an httpx.Auth object) with 
cloudpickle and base64. When it reads the field back, a 
model_validator(mode="before") runs cloudpickle.loads() on any string auth 
value. This has three problems:
   
   - The agent plan and YAML definitions contain an opaque binary blob that 
cannot be read, compared or edited.
   - A config value is executed as Python code instead of being parsed as data. 
This also applies to auth values in YAML mcp_servers entries and in resource 
descriptor arguments.
   - The Python and Java MCPServer use different auth formats. Java has typed 
ApiKeyAuth, BasicAuth and BearerTokenAuth.
   
   Proposed changes:
   
   1. Add typed Pydantic auth models that match the Java classes: BasicAuth, 
BearerTokenAuth and ApiKeyAuth, with a type field to tell them apart. Convert 
them to httpx.Auth only when the HTTP client is created.
   2. Remove cloudpickle from mcp.py. Serialize auth as plain JSON.
   3. Reject a string auth value with a clear error, without decoding it.
   4. If users need custom httpx.Auth subclasses, let them reference the class 
by name (import path plus constructor arguments) instead of pickling an 
instance.
   5. Add tests for each auth type: a JSON round-trip, YAML loading, and a 
check that a base64 string in auth is rejected and never unpickled.
   
   ### How to reproduce
   
   -
   
   ### Version and environment
   
   main
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to