-
Notifications
You must be signed in to change notification settings - Fork 36
Add manual test script for bucket mounting #191
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
base: main
Are you sure you want to change the base?
Conversation
Enable sandboxes to mount S3-compatible buckets as local filesystem paths using s3fs-fuse. This allows code executing in sandboxes to read and write files directly to cloud storage using standard file operations. The implementation provides automatic credential detection from environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) and intelligent provider detection from endpoint URLs. Supported providers include AWS S3, Cloudflare R2, Google Cloud Storage, MinIO, Backblaze B2, Wasabi, and DigitalOcean Spaces. Each provider has optimized s3fs flags (e.g., R2 requires nomixupload and endpoint=auto) to ensure reliable operation. Users can override these defaults by providing custom s3fsOptions.
Remove examples and verbose logging to keep the codebase clean. Inline single-use injectCredentials method. Update CI workflow to pass R2 credentials from GitHub secrets instead of relying on local .env setup.
Apply stricter criteria for v1 by reducing provider list from 8 to 4. Remove backblaze, wasabi, and digitalocean support. Updated type definitions, detection logic, and test cases accordingly.
Enable bucket mounting/unmounting from session objects returned by createSession(). Sessions share the filesystem, so mount operations affect all sessions in the sandbox.
Add shell escaping for user-provided input in mount paths, bucket names, git URLs, and branch names. Use shellEscape() utility in shared package for consistent POSIX single-quote escaping. Fix race condition in mountBucket() by reserving mount path before executing mount operations. Fix provider detection to use endsWith() instead of includes() to prevent malicious subdomain matching.
Provides test script and documentation for validating bucket mounting with proper FUSE support. Required because wrangler dev doesn't support passing Docker device flags for local testing. Script uses environment variables for credentials and validates complete data round-trip through R2 using independent verification via wrangler CLI.
|
Claude Code ReviewPR Summary: Manual test script for bucket mounting with FUSE support. Not intended for merge - reference for local testing workaround. Issues1. Shell script uses hardcoded version CONTAINER_IMAGE="cloudflare/sandbox-test:0.4.14"This will become outdated. Consider using 2. Incomplete cleanup on early failures Add trap for guaranteed cleanup: cleanup() {
docker stop "$CONTAINER_NAME" 2>/dev/null || true
docker rm "$CONTAINER_NAME" 2>/dev/null || true
rm -f "$R2_TEMP_FILE" "$WRANGLER_CONFIG"
}
trap cleanup EXIT3. Wrangler config contains credentials in plaintext 4. Verification retry logic could be clearer Minor
VerdictCode works for its intended purpose. The cleanup issues should be fixed before merge (if this ever merges). Otherwise, script correctly validates the complete FUSE+R2 flow. |
commit: |
🐳 Docker Image PublishedFROM cloudflare/sandbox:0.0.0-pr-191-66be952Version: You can use this Docker image with the preview package from this PR. |
Manual test script for bucket mounting with FUSE support.
Required because wrangler dev doesn't support --device and --cap-add flags for local testing. Uses environment variables for credentials and validates complete data round-trip through R2.
Not intended to be merged - reference for manual testing until local dev tooling supports FUSE device passthrough.