feat(sdk): make platform defaults the happy path in serve#2290
feat(sdk): make platform defaults the happy path in serve#2290
Conversation
…ackend, telemetry) in serve Signed-off-by: Radek Ježek <radek.jezek@ibm.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the setup process for the SDK by configuring Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request updates the Server.serve() method to use platform-native implementations for telemetry, context storage, and authentication by default, aligning with the goal of simplifying initial configuration and providing a 'happy path' for new users. However, this change introduces a high-severity security vulnerability. The new default authentication backend, PlatformAuthBackend, is susceptible to Host Header Injection for audience validation when not explicitly configured with a public URL, potentially allowing cross-service token usage. It also lacks issuer validation and exhibits verbose error handling that could leak sensitive information. It is recommended to enforce the configuration of a trusted public URL or improve the default security of the PlatformAuthBackend before making it the default.
|
|
||
| context_store = context_store or InMemoryContextStore() | ||
| context_store = context_store or PlatformContextStore() | ||
| auth_backend = auth_backend or PlatformAuthBackend() |
There was a problem hiding this comment.
The pull request changes the default auth_backend to PlatformAuthBackend(), which introduces a significant security risk. The PlatformAuthBackend implementation (in apps/agentstack-sdk-py/src/agentstack_sdk/server/middleware/platform_auth_backend.py) defaults to using the request's Host header for JWT audience validation when PLATFORM_AUTH__PUBLIC_URL is not configured (line 107). This makes the agent vulnerable to Host Header Injection, where an attacker can use a valid JWT issued for a different agent on the same platform to authenticate by manipulating the Host header. Additionally, the backend lacks issuer (iss) validation and leaks internal error details (such as platform URLs and discovery failures) in authentication responses. Making this the default 'happy path' without enforcing secure configuration significantly weakens the SDK's default security posture.
What
Changes defaults in
Server.serve()to use platform-native implementations out of the box:configure_telemetry=True(wasFalse)context_storedefaults toPlatformContextStore()(wasInMemoryContextStore())auth_backenddefaults toPlatformAuthBackend()(wasNone)Why
This makes the happy path work without any configuration — agents connect to the platform context store, authenticate via the platform auth backend, and emit telemetry by default. Users can still override any of these by passing explicit values to
serve().