feat: add SFTP module - #3782
Conversation
Part of the broader effort to add missing modules — split from testcontainers#3762.
|
Warning Review limit reached
Next review available in: 44 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 613fdfbbdb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Multiple calls to WithUser will accumulate users. | ||
| func WithUser(username, password string) Option { | ||
| return func(o *options) { | ||
| o.users = append(o.users, fmt.Sprintf("%s:%s:::", username, password)) |
There was a problem hiding this comment.
Create a writable upload directory for WithUser
When callers use the documented WithUser("alice", "secret") path and then try to upload a file, atmoz/sftp will not create /home/alice/upload: its command syntax only creates writable directories named in the final field (for example foo:pass:::upload), while the chroot home itself is root-owned and not writable. This builds alice:secret::: with no directory field, so the default module configuration starts a server that accepts the user but fails normal upload workflows with permission denied unless callers override the whole command themselves.
Useful? React with 👍 / 👎.
| return "", fmt.Errorf("sftp port: %w", err) | ||
| } | ||
|
|
||
| return fmt.Sprintf("%s:%s", host, port.Port()), nil |
There was a problem hiding this comment.
Use JoinHostPort for IPv6 Docker hosts
In environments where Host(ctx) returns an IPv6 address, this formats the endpoint as something like ::1:49160, which is not a valid host:port string for net.Dial/SFTP clients. The core container implementation already handles this via PortEndpoint/net.JoinHostPort, which would return [::1]:49160, so Address should use that instead of manual concatenation.
Useful? React with 👍 / 👎.
…ress - WithUser now appends 'username:password:::upload' so atmoz/sftp creates a writable /home/<username>/upload directory; without the dir field the chroot home is root-owned and uploads fail with permission denied. - Address() now uses net.JoinHostPort instead of fmt.Sprintf so IPv6 hosts are correctly bracketed, e.g. [::1]:49160 instead of ::1:49160.
Adds the
sftptestcontainers-go module.Part of the broader effort to add missing modules — split from #3762.