Repository navigation
🐛 fix(docker): surface proxy/daemon error bodies in exec errors - #77
Conversation
Non-2xx Docker API responses (CreateExec, StartExec, ResizeExec,
InspectContainer, and siblings in internal/docker/client.go) previously
discarded the response body and returned only a bare status code. When
sockguard denies exec with a 403, the real reason ("exec denied: no
commands are allowlisted") never reached the edge exec_end frame sent to
the controller. A shared dockerError/extractDockerErrorMessage helper now
reads a bounded (4 KiB) slice of the body, extracts Docker's
{"message":"..."} JSON shape (or falls back to the raw trimmed body), and
every non-2xx path in the file uses it consistently. The edge failStart
path already interpolates err into the exec_end reason, so the enriched
message reaches Drydock without further changes to internal/edge/tunnel.go.
- ✨ examples/docker-compose.edge-with-exec.yml + sockguard-with-exec.yaml:
pairs edge mode with sockguard's portwing-with-exec.yaml preset, since
the plain preset denies all exec by design.
- 📝 README: point at the new example from the with-sockguard section and
call out the exec-denial-by-default behavior.
- 📝 CHANGELOG: Added/Fixed entries under Unreleased.
Test changes: removed readAndCloseBody (now dead after the refactor) and
its four dedicated unit tests; updated TestResizeExec_BodyReadError and
TestStartExec_Non101Response assertions to match the new error format.
|
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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDocker client error responses are now read with a size limit, parsed for Docker Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/docker/client_unix_test.go`:
- Around line 204-205: Update the shortTempDir helper used by this Unix-socket
test to create temporary directories with the mandated "lk" prefix via
os.MkdirTemp("", "lk"), while preserving the existing cleanup and return
behavior.
In `@README.md`:
- Line 226: Update the README description of the default sockguard preset to
state that denied exec requests return HTTP 403 with the reason “exec denied: no
commands are allowlisted,” rather than describing the response as a bare 403;
preserve the surrounding guidance about the edge-with-exec preset and controller
error propagation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ab9cca15-7bfe-45b1-881d-42429663adbd
⛔ Files ignored due to path filters (1)
CHANGELOG.mdis excluded by!CHANGELOG.md
📒 Files selected for processing (9)
README.mdexamples/docker-compose.edge-with-exec.ymlexamples/sockguard-with-exec.yamlinternal/docker/client.gointernal/docker/client_dockererror_test.gointernal/docker/client_errors_test.gointernal/docker/client_test.gointernal/docker/client_unix_test.gointernal/edge/exec_docker_test.go
💤 Files with no reviewable changes (1)
- internal/docker/client_test.go
…es (#78) - README.md: deny-all preset returns 403 "not allowed by portwing preset", not the with-exec preset's "exec denied: no commands are allowlisted"; clarify the denial reason now reaches portwing's exec error and the exec_end reason forwarded to the controller (drydock-side display pending) - examples/docker-compose.edge-with-exec.yml: same correction in the header comment, plus a pointer to sockguard's audited tri-tool bundle - examples/README.md: index docker-compose.edge-with-exec.yml and sockguard-with-exec.yaml, added in #77 but missing from the table - docs/content/docs/drydock-integration.mdx: document the exec_* Edge Mode message types and note exec_end's reason field
From the portwing↔sockguard fit audit: when Docker access goes through sockguard, a denied exec returns 403 with the real reason in the body (e.g.
exec denied: no commands are allowlisted) — portwing discarded it, so drydock's controller only ever saw a bare status code.internal/docker/client.go: newdockerError/extractDockerErrorMessagehelpers — every non-2xx path now bound-reads the body (4 KiB cap), extracts Docker's JSONmessagewhen present, and includes it in the error.StartExeckeeps its 101-wording and appends the body message.internal/edge: no change needed —failStartalready interpolates the error, so the denial reason now reaches the controller'sexec_endframe (covered by a new test).examples/docker-compose.edge-with-exec.yml+ preset copy: the Edge-Mode pairing that actually supports exec (portwing-with-exec.yaml); the plain preset denies all exec by design. README + CHANGELOG updated.exec_endreason forwarding. Coverage 96.3% total (internal/docker95.8%,internal/edge96.9%, new helpers 100%), floor 96 passes.Changelog
messageextraction.StartExec, and edgeexec_endforwarding.Concerns