Skip to content

feat(config): add securityOpt passthrough to container create#169

Merged
skevetter merged 1 commit into
mainfrom
d226/securityopt-passthrough
May 3, 2026
Merged

feat(config): add securityOpt passthrough to container create#169
skevetter merged 1 commit into
mainfrom
d226/securityopt-passthrough

Conversation

@skevetter

@skevetter skevetter commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Wire securityOpt values from devcontainer.json through to docker run as --security-opt flags
  • Fix missing SecurityOpt field in the dockerless container creation path (getDockerlessRunOptions)
  • Add unit tests covering single opt, multiple opts, empty opts, and combined cap-add + security-opt
  • Add E2E test and testdata for docker provider validating seccomp=unconfined and apparmor=unconfined applied to container

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Docker security options configuration in devcontainer files, enabling users to customize security enforcement settings including seccomp and AppArmor profiles.
  • Tests

    • Added comprehensive test suite covering Docker security option argument generation, configuration parsing, and end-to-end fixture validation with various security option combinations.

Wire securityOpt from devcontainer.json through to docker run as
--security-opt flags. The dockerless code path was missing this field.
Add unit tests for the security opt arg assembly and an E2E test
validating securityOpt on docker containers.
@netlify

netlify Bot commented May 3, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 01bf483
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/69f6dd85243dda000888e155

@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5454daae-0c13-4cfe-81e7-18e03dc65fff

📥 Commits

Reviewing files that changed from the base of the PR and between 1c618f1 and 01bf483.

📒 Files selected for processing (4)
  • e2e/tests/up/provider_docker.go
  • e2e/tests/up/testdata/docker-securityopt/.devcontainer.json
  • pkg/devcontainer/single.go
  • pkg/driver/docker/docker_test.go

📝 Walkthrough

Walkthrough

This PR extends devcontainer support to honor Docker security options (securityOpt from .devcontainer.json). It updates the dockerless driver to propagate security options, adds unit tests for security option argument generation, and includes an end-to-end test verifying that containers are created with the specified security settings.

Changes

Docker Security Options Support

Layer / File(s) Summary
Core Implementation
pkg/devcontainer/single.go
getDockerlessRunOptions now includes SecurityOpt: mergedConfig.SecurityOpt in the driver RunOptions passed to the dockerless driver.
Unit Tests
pkg/driver/docker/docker_test.go
Four new test methods added (TestAddCapabilityArgs_SingleSecurityOpt, TestAddCapabilityArgs_MultipleSecurityOpts, TestAddCapabilityArgs_EmptySecurityOpt, TestAddCapabilityArgs_CapAddAndSecurityOpt) covering addCapabilityArgs behavior with various SecurityOpt configurations and combinations with CapAdd.
E2E Test & Fixture
e2e/tests/up/provider_docker.go, e2e/tests/up/testdata/docker-securityopt/.devcontainer.json
New "security options" e2e test case verifies that containers created from a fixture with securityOpt: ["seccomp=unconfined", "apparmor=unconfined"] are inspected and confirmed to have those security options in their HostConfig.SecurityOpt.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@github-actions github-actions Bot added the size/m label May 3, 2026
@skevetter
skevetter marked this pull request as ready for review May 3, 2026 06:19
@skevetter
skevetter merged commit 3ef60f9 into main May 3, 2026
51 checks passed
@skevetter
skevetter deleted the d226/securityopt-passthrough branch May 3, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant