Skip to content

feat: add SFTP module - #3782

Merged
mdelapenya merged 2 commits into
testcontainers:mainfrom
mdelapenya:feat/module-sftp
Jul 16, 2026
Merged

feat: add SFTP module#3782
mdelapenya merged 2 commits into
testcontainers:mainfrom
mdelapenya:feat/module-sftp

Conversation

@mdelapenya

Copy link
Copy Markdown
Member

🤖 Automated implementer agentthis comment was posted by the implementer bot from Docker Agentic Platform, not by a human developer

Adds the sftp testcontainers-go module.

Part of the broader effort to add missing modules — split from #3762.

Part of the broader effort to add missing modules — split from testcontainers#3762.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@mdelapenya, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b68df03e-ab0a-4243-8bbb-d1a8b18b2d9a

📥 Commits

Reviewing files that changed from the base of the PR and between c92ea61 and 3ae3818.

⛔ Files ignored due to path filters (1)
  • modules/sftp/go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • .github/dependabot.yml
  • .vscode/.testcontainers-go.code-workspace
  • docs/modules/sftp.md
  • mkdocs.yml
  • modules/sftp/Makefile
  • modules/sftp/examples_test.go
  • modules/sftp/go.mod
  • modules/sftp/options.go
  • modules/sftp/sftp.go
  • modules/sftp/sftp_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy Preview for testcontainers-go ready!

Name Link
🔨 Latest commit 3ae3818
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-go/deploys/6a58a81daead23000925caa2
😎 Deploy Preview https://deploy-preview-3782--testcontainers-go.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mdelapenya
mdelapenya marked this pull request as ready for review July 16, 2026 09:36
@mdelapenya
mdelapenya requested a review from a team as a code owner July 16, 2026 09:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread modules/sftp/options.go Outdated
// 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))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Comment thread modules/sftp/sftp.go Outdated
return "", fmt.Errorf("sftp port: %w", err)
}

return fmt.Sprintf("%s:%s", host, port.Port()), nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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.
@mdelapenya mdelapenya added the enhancement New feature or request label Jul 16, 2026
@mdelapenya
mdelapenya merged commit 683af20 into testcontainers:main Jul 16, 2026
17 checks passed
@mdelapenya
mdelapenya deleted the feat/module-sftp branch July 16, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant