fix: Dev to main merge - #1166
Open
Dhruvkumar-Microsoft wants to merge 2 commits into
Open
Dhruvkumar-Microsoft wants to merge 2 commits into
Dhruvkumar-Microsoft wants to merge 2 commits into
Conversation
fix: fix other ICM issue and added local setup steps for mcp server
Coverage Report •
|
||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Fix missing-plan_id validation behavior and update the endpoint documentation.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Strengthens agent-message authorization and improves MCP environment configuration and documentation.
Changes:
- Validates plan ownership and authenticated user identity.
- Adds authorization and identity regression tests.
- Adds
APP_ENVconfiguration and local setup guidance.
| File | Summary |
|---|---|
src/tests/backend/services/test_plan_service.py |
Tests authenticated user-ID enforcement. |
src/tests/backend/api/test_router.py |
Tests authorization and validation behavior. |
src/mcp_server/services/image_service.py |
Selects credentials by environment. |
src/mcp_server/config/settings.py |
Adds app_env configuration. |
src/mcp_server/.env.example |
Documents environment variables. |
src/backend/services/plan_service.py |
Enforces authenticated user identity. |
src/backend/api/router.py |
Adds plan ownership validation and message handling. |
docs/LocalDevelopmentSetup.md |
Clarifies MCP environment setup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.

Purpose
This pull request strengthens security around agent message handling, improves environment configuration for local development, and adds related tests and documentation updates. The changes ensure that agent messages can only be associated with plans owned by the authenticated user, preventing cross-user data injection, and clarify how environment variables are managed for development and deployment.
Security and Authorization Improvements:
/api/v4/agent_messageendpoint now requires aplan_idand verifies that the plan belongs to the authenticated user before processing agent messages, returning a 404 if the plan is not found or not owned by the user. This prevents cross-user message injection.build_agent_message_from_agent_message_responsefunction now always uses the authenticated user's ID, ignoring any user ID supplied in the payload, to prevent unauthorized data injection.Testing Enhancements:
plan_idreturns a 400, and that the authenticated user ID is always enforced in the service layer. [1] [2]Local Development and Environment Configuration:
.envfile and configuring development-specific settings. [1] [2].env.exampleand introduced theAPP_ENVvariable to control dev vs. prod behavior. [1] [2]APP_ENVconfiguration for selecting credentials, defaulting to development settings when appropriate.Does this introduce a breaking change?
How to Test
What to Check
Verify that the following are valid
Other Information