Skip to content

drive: add write tools and safety controls#31

Open
walac wants to merge 2 commits into
LeGambiArt:mainfrom
walac:main
Open

drive: add write tools and safety controls#31
walac wants to merge 2 commits into
LeGambiArt:mainfrom
walac:main

Conversation

@walac
Copy link
Copy Markdown
Contributor

@walac walac commented May 13, 2026

The Google Drive plugin previously only supported read operations. This change introduces write capabilities by adding upload, rename, move, copy, soft-delete, and folder creation tools, expanding the plugin's utility for file management.

To support these operations, the OAuth scope is upgraded to full read-write access. A lazy scope probing mechanism is implemented using GenerateIds on the first write attempt. If the token lacks the required scope, the tool returns an error guiding the user to re-authorize. This probe automatically resets upon encountering a 403 error to ensure subsequent attempts re-evaluate the scope.

Safety is prioritized across all new operations. All write tools default to a dry-run mode and are marked with write access requirements to trigger user confirmation. Upload paths are strictly confined to the user's home directory, with symlink resolution enforced on both the home directory and target paths to prevent directory traversal escapes. Deletions are implemented as recoverable soft-deletes to the trash. Comprehensive test coverage validates these safety mechanisms, scope gating, and parameter handling.

Assisted-by: Claude Code:claude-opus-4-6 [PAL]

@walac walac force-pushed the main branch 2 times, most recently from 3adc9d4 to a1f92db Compare May 13, 2026 20:45
Copy link
Copy Markdown
Contributor

@sergio-correia sergio-correia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to update context.md for write tools. It currently says the plugin is read-only and "cannot create, modify, or delete files.". Please update it to reflect the write capabilities.

Consider also adding httptest-based tests for the non-dry-run paths of upload, rename, copy, and delete, similar to TestToolCreateFolderActual.

Comment thread plugins/google-drive/tools.go Outdated
walac added 2 commits May 25, 2026 11:37
The Google Drive plugin previously only supported read operations.
This change introduces write capabilities by adding upload, rename,
move, copy, soft-delete, and folder creation tools, expanding the
plugin's utility for file management.

To support these operations, the OAuth scope is upgraded to full
read-write access. A lazy scope probing mechanism is implemented
using GenerateIds on the first write attempt. If the token lacks
the required scope, the tool returns an error guiding the user to
re-authorize. This probe automatically resets upon encountering a
403 error to ensure subsequent attempts re-evaluate the scope.

Safety is prioritized across all new operations. All write tools
default to a dry-run mode and are marked with write access
requirements to trigger user confirmation. Upload paths are strictly
confined to the user's home directory, with symlink resolution
enforced on both the home directory and target paths to prevent
directory traversal escapes. Deletions are implemented as recoverable
soft-deletes to the trash. Comprehensive test coverage validates
these safety mechanisms, scope gating, and parameter handling.

Assisted-by: Claude Code:claude-opus-4-6 [PAL]
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
govulncheck identified four vulnerabilities affecting the codebase.
Adding the toolchain go1.25.10 directive addresses an html/template
XSS via meta content URL escaping bypass (GO-2026-4982), an
html/template escaper bypass leading to XSS (GO-2026-4980), and a
net package panic triggered by NUL bytes in Dial/LookupPort on
Windows (GO-2026-4971).

Bumping golang.org/x/net from v0.51.0 to v0.53.0 resolves an HTTP/2
infinite loop caused by a bad SETTINGS_MAX_FRAME_SIZE (GO-2026-4918).
The transitive dependency bumps for x/crypto, x/sync, x/sys, x/term,
and x/text follow from the x/net upgrade.

Assisted-by: Claude Code:claude-opus-4-6 [PAL]
Signed-off-by: Wander Lairson Costa <wander@redhat.com>
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.

2 participants