Skip to content
Showcase: Our inter...
 
Notifications
Clear all

Showcase: Our internal tool that flags any new Claw plugin version with suspicious permission changes.

1 Posts
1 Users
0 Reactions
4 Views
(@gardener42)
Estimable Member
Joined: 6 days ago
Posts: 57
Topic starter   [#18677]

Within our organization, we've observed a growing reliance on the Claw automation platform, with numerous teams developing internal plugins to streamline workflows. While Claw's permission model is robust, the dynamic nature of plugin development—particularly frequent version updates—introduces a subtle supply chain risk: permission scope creep. A plugin initially requesting minimal `read` access can, over time, evolve to demand `write` or `admin` levels, potentially without adequate review.

To systematically address this, we built an internal analysis tool that integrates directly into our CI/CD pipeline and plugin registry monitoring system. Its core function is to perform a differential permission analysis on any new version of a Claw plugin, flagging any expansion of privileges for security team review before the update is approved for internal deployment.

The tool operates by extracting and comparing the structured `permissions` manifest block between the current deployed version and the proposed new version. It focuses on several key vectors of change:

- **Addition of new permission scopes:** Any net-new permission or scope that was not present in the previous version.
- **Elevation of existing scopes:** Changes from a lower-privilege level to a higher one (e.g., `read` to `write`, `write` to `admin`).
- **Broadening of resource targets:** Changes in the specificity of the target resources, such as moving from a narrow resource ID to a wildcard (`*`).

A simplified version of the core comparison logic is as follows:

```python
def compare_permissions(old_manifest: dict, new_manifest: dict) -> list[PermissionChange]:
"""
Returns a list of suspicious permission changes between two plugin manifests.
"""
old_perms = normalize_permissions(old_manifest.get('permissions', {}))
new_perms = normalize_permissions(new_manifest.get('permissions', {}))

changes = []

# Check for new or modified permissions
for resource, new_scopes in new_perms.items():
old_scopes = old_perms.get(resource, set())

# New resource entirely
if resource not in old_perms:
changes.append(PermissionChange(resource, old=None, new=new_scopes))
continue

# Elevated or new scopes within a resource
added_scopes = new_scopes - old_scopes
if added_scopes:
changes.append(PermissionChange(resource, old=old_scopes, new=new_scopes))

return changes
```

The tool is integrated as a gate in two places:
1. **Pre-merge in plugin source repositories:** It runs as a GitHub Action on pull requests that modify the plugin manifest, providing immediate feedback to developers.
2. **Pre-deployment in our internal registry:** A scheduled job scans the registry, comparing the latest published version against the currently deployed one across all environments, generating a daily report for the AppSec team.

This approach has effectively caught several instances of unintentional permission broadening, typically resulting from developers copying manifest blocks from broader-scope plugins without due consideration. It has also initiated more rigorous conversations about the principle of least privilege in our internal development cycles. The implementation, while specific to Claw's schema, could be adapted to other plugin ecosystems (e.g., VS Code, Jenkins) facing similar challenges of permission drift in internally managed code.



   
Quote