-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(tools): added sftp tool to accompany smtp and ssh tools #2261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis PR adds comprehensive SFTP functionality to complement the existing SMTP and SSH tools. The implementation provides five core operations (upload, download, list, delete, mkdir) with robust security measures and follows established patterns in the codebase. Key Changes:
Security Measures:
Architecture:
Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant Block as SFTP Block
participant Tool as SFTP Tool Config
participant API as API Route
participant Utils as SFTP Utils
participant Server as Remote SFTP Server
User->>Block: Configure SFTP operation
Note over User,Block: Host, port, credentials,<br/>operation type, params
Block->>Tool: Map params to tool config
Note over Block,Tool: Select tool based on operation<br/>(upload/download/list/delete/mkdir)
Tool->>API: POST request with connection config
Note over Tool,API: Authentication via checkHybridAuth
API->>Utils: Validate & sanitize paths
Note over API,Utils: isPathSafe, sanitizePath,<br/>sanitizeFileName
API->>Utils: createSftpConnection
Utils->>Server: Connect via SSH2 client
Note over Utils,Server: Password or private key auth
Server-->>Utils: Connection established
Utils-->>API: Return client & SFTP wrapper
alt Upload Operation
API->>Utils: downloadFileFromStorage
Utils-->>API: File buffer
API->>Server: Upload via createWriteStream
else Download Operation
API->>Server: Download via createReadStream
Server-->>API: File content (utf-8 or base64)
else List Operation
API->>Server: readdir(remotePath)
Server-->>API: Directory entries with metadata
else Delete Operation
API->>Server: unlink/rmdir (recursive if needed)
else Mkdir Operation
API->>Server: mkdir (recursive if needed)
end
API->>Utils: Close connection
Utils->>Server: client.end()
API-->>Tool: Return operation result
Tool-->>Block: Transform response
Block-->>User: Display success/error with output
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
23 files reviewed, no comments
Summary
Type of Change
Testing
Tested manually
Checklist