Skip to content

Conversation

@Mossaka
Copy link
Collaborator

@Mossaka Mossaka commented Jul 25, 2025

This PR adds a new policy management to Weld by allowing each component to associate with a policy file for it's capabilities. This PR adds a few new built-in Tools:

grant-storage-permission: Grants a fine-grained storage permission
grant-network-permission: Grants a fine-grained network permission
get-policy: Gets the policy for a component
In addition, it deprecates the global policy flag. Weld no longer accepts the policy-file argument in it's CLI.

The policy file will be co-locate the policy.yaml and policy.meta.json files to plugin_dir.

image

@Mossaka Mossaka marked this pull request as ready for review July 25, 2025 22:20
@Mossaka Mossaka force-pushed the grant-policy branch 3 times, most recently from 0de360c to dd830af Compare August 1, 2025 17:39
Mossaka added 13 commits August 1, 2025 14:49
This commit adds a dynamic policy management system to the MCP server.
You can now attach, detach, and get policies for individual components.
The policy can be attached from a local file, an OCI reference, or a URL,
and co-located with the component in plugin_dir directory.

Signed-off-by: Jiaxiao Zhou <[email protected]>
This commit refactos the resource loading logic by abstracting the "Loadable"
trait for handling different types of resources (i.e. component, policy, etc.)

Signed-off-by: Jiaxiao Zhou <[email protected]>
Signed-off-by: Jiaxiao Zhou <[email protected]>
This commit adds a new permission control system to the Weld MCP server.
It deprecates the 'attach-policy' and 'detach-policy' tools, and introduces
new tools for managing permissions:
- 'grant-storage-permission'
- 'grant-network-permission'

These grant permission Tools can be used to grant fine-grained permissions to
components. For example, a component can be granted permission to read from a
specific file system path, or to access a specific network host.

This PR adds more integration tests for the new permission system and a
design document for it.

What's left to do:
- The error message needs to be improved to inform the LLM that the whether
the erorr is due to the permission system or the execution of the component.

This error message needs to also inform the LLM what's then next step to
fix if the error is due to the permission system.

Signed-off-by: Jiaxiao Zhou <[email protected]>
…documentation

This commit refactors the Justfile to remove unnecessary policy file arguments from the run commands for filesystem, get-weather, and fetch-rs plugins. Additionally, it updates the tools.rs file to enhance the description of the URI property for storage resources. The lib.rs file is modified to correct the usage of the OCI client type and streamline the lifecycle manager's policy attachment and detachment methods. Lastly, the design document is corrected for a typo in the overview section.

Signed-off-by: Jiaxiao Zhou <[email protected]>
To fix the breaking changes from the mcp SDK

Signed-off-by: Jiaxiao Zhou <[email protected]>
This commit enforces network policies by filtering outgoing HTTP requests based on list of
allowed hosts defined in the policy file associated with the component.

This commit adds an integration test for the network policy enforcement.

Note that this commit implements a simplified version of the network policy enforcement.
The policy is only enforced for exact host matches, no wildcard matching is supported.

The policy also does not enforce IP address matching.

Signed-off-by: Jiaxiao Zhou <[email protected]>
Signed-off-by: Jiaxiao Zhou <[email protected]>
@Mossaka Mossaka merged commit 5b66483 into main Aug 1, 2025
5 checks passed
@Mossaka Mossaka deleted the grant-policy branch August 1, 2025 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need a way to configure policies for multiple tool / components Figure out a way to grant environment variables to the components

3 participants