🐛 fix(docker): read sockguard's reason field in docker error bodies - #80
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe Docker client now parses 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
35f1f13 to
125f97d
Compare
Summary
#77 taught
extractDockerErrorMessage(internal/docker/client.go) to parse the Docker error body'smessagefield so denials reach the caller instead of a bare status code. But sockguard'sDenialResponsestruct (app/internal/filter/middleware.goin the sockguard repo) always setsmessageto the generic constant"request denied by sockguard policy"— the actual denial cause ("not allowed by portwing preset", "exec denied: privileged exec is not allowed", ...) lives in a separatereasonfield, populated only when sockguard'sdeny_verbosityisverbose(default isminimal, message-only). So #77's fix never actually surfaced sockguard's detailed reasons for the common case.extractDockerErrorMessagenow also readsreason. If bothmessageandreasonare non-empty and differ, they're combined as<message>: <reason>; if only one is present, it's used alone; the existing fallback to the raw trimmed body (when neither JSON field parses or both are empty) is unchanged, and plain Docker daemon errors ({"message": ...}only) behave exactly as before.internal/docker/client_dockererror_test.gowith message+reason, reason-only, and identical-value cases, plus a call-site propagation test onCreateExec.reasonfield and sockguard'sdeny_verbositysetting.Test plan
gofmt -l .cleango vet ./...go test ./internal/docker/...go testacrossinternal/... cmd/...(excludinginternal/banner/gen, matching CI) — total 96.2%, floor is 96%Changelog
reasonfield parsing (combinedmessage: reason,reason-only, and identical-value handling).CreateExecerror propagation to include sockguardreasonunder verbose denial.deny_verbosity(detailed reason only withverbose; generic denial underminimal).CreateExecpropagation.Concerns / issues to address
deny_verbosity: verbosevsminimal.