fix: gate github_clone and github_pull behind approval - #488
Open
rkfshakti wants to merge 1 commit into
Open
Conversation
Both tools were registered with kind="read" in TOOL_DEFS, so approval_for_tool() returned False and overrode the approval=True set at the call site. The permission engine then classified them as READ (requires_approval=False → RiskClass.READ), auto-allowing them without ever prompting the user — even though both write to disk (clone creates a new directory, pull fast-forwards an existing repo) and their own descriptions say "Requires user approval". The connector list API (tool_dicts) always reports requires_approval=True, so the UI showed them as gated while the runtime silently bypassed the gate — a mismatch that made the bug invisible to users. Reclassify both as kind="write" so the §36 kind→approval mapping correctly gates them.
Author
|
Hi maintainers — just a friendly nudge on this one. The fix gates github_clone and github_pull behind approval so those operations require explicit consent. I'm excited to see it land. Would appreciate a review when you have a moment. Thanks! |
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.
Both
github_cloneandgithub_pullwere registered withkind="read"inTOOL_DEFS, which causedapproval_for_tool()to returnFalseand override theapproval=Trueflag set at the call site inintegration_tools.py.The permission engine reads
requires_approvalfrom the tool metadata to classify risk:Falsemaps toRiskClass.READ, whichis_consequential()returnsFalsefor, so the engine auto-allows the call without ever prompting the user. Yet both tools write to disk —github_clonecreates a new directory and populates it with a full repository, andgithub_pullfast-forwards an existing clone to the latest upstream commits. Their own schema descriptions say "Requires user approval," and the_attachcall passesapproval=True, but none of that matters because the registry kind wins.What makes this particularly hard to notice is that the connector list API (
tool_dictsintool_defs.py) always setsrequires_approval: Truein its response, so the UI shows both tools as gated. The runtime silently disagrees — the UI says "approval required," the engine says "low risk, go ahead."This is the same class of bug as #399 (
browser_open_urlregistered askind="read"), just in a different connector. The fix is the same: reclassify both tools askind="write"so the §36 kind→approval mapping correctly gates them.Changes:
coworker/connectors/tool_defs.py:github_cloneandgithub_pullchanged fromkind="read"tokind="write"tests/test_send_target_resolution.py: regression test asserting both tools now haverequires_approval is TrueAll 1015 tests pass, ruff clean.