-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add non-root user to devcontainers for enhanced security and immutability #960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| ✅ ACTION | actionlint | 21 | 0 | 0 | 0.51s | |
| ✅ DOCKERFILE | hadolint | 2 | 0 | 0 | 0.83s | |
| ✅ GHERKIN | gherkin-lint | 6 | 0 | 0 | 2.21s | |
| ✅ JSON | npm-package-json-lint | yes | no | no | 0.45s | |
| ✅ JSON | prettier | 15 | 2 | 0 | 0 | 0.5s |
| ✅ JSON | v8r | 15 | 0 | 0 | 8.94s | |
| markdownlint | 11 | 0 | 1 | 0 | 0.85s | |
| ✅ MARKDOWN | markdown-table-formatter | 11 | 0 | 0 | 0 | 0.25s |
| ✅ REPOSITORY | gitleaks | yes | no | no | 0.64s | |
| ✅ REPOSITORY | git_diff | yes | no | no | 0.01s | |
| ✅ REPOSITORY | grype | yes | no | no | 28.61s | |
| ✅ REPOSITORY | secretlint | yes | no | no | 0.97s | |
| ✅ REPOSITORY | syft | yes | no | no | 1.95s | |
| ✅ REPOSITORY | trivy | yes | no | no | 5.62s | |
| ✅ REPOSITORY | trivy-sbom | yes | no | no | 0.24s | |
| ✅ REPOSITORY | trufflehog | yes | no | no | 2.37s | |
| ✅ SPELL | lychee | 72 | 0 | 0 | 21.32s | |
| ✅ YAML | prettier | 27 | 0 | 0 | 0 | 0.81s |
| ✅ YAML | v8r | 27 | 0 | 0 | 7.94s | |
| ✅ YAML | yamllint | 27 | 0 | 0 | 0.92s |
Detailed Issues
⚠️ MARKDOWN / markdownlint - 1 error
.github/copilot-instructions.md:32 MD040/fenced-code-language Fenced code blocks should have a language specified [Context: "```"]
See detailed reports in MegaLinter artifacts
Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)
- Documentation: Custom Flavors
- Command:
npx [email protected] --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,DOCKERFILE_HADOLINT,GHERKIN_GHERKIN_LINT,JSON_V8R,JSON_PRETTIER,JSON_NPM_PACKAGE_JSON_LINT,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_GRYPE,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R
📦 Container Size AnalysisNote Comparing 📈 Size Comparison Table
|
📦 Container Size AnalysisNote Comparing 📈 Size Comparison Table
|
Co-authored-by: rjaegers <[email protected]>
| "forwardPorts": [ | ||
| 6080 | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MegaLinter] reported by reviewdog 🐶
| "forwardPorts": [ | |
| 6080 | |
| ], | |
| "forwardPorts": [6080], |
Co-authored-by: rjaegers <[email protected]>
|
@copilot we use conventional commit style pull-request titles, can you please update the .github/copilot-instructions.md to make sure you apply that rule? And correct the title of this PR? |
Co-authored-by: rjaegers <[email protected]>
I've updated the |
|
@copilot it seems the Ubuntu base image used in this repository already includes a user with GID/UID 1000. Please fix this by removing the default user in the image before adding the 'code' user. |
Co-authored-by: rjaegers <[email protected]>
Fixed the UID/GID 1000 conflict by removing the default Ubuntu user and group before creating the 'code' user (commit 3b4a5c2). Both Dockerfiles now properly handle the existing ubuntu user in the base image. |
|




✅ COMPLETED: Adding non-root 'code' user to devcontainers
This PR successfully adds a non-root user called 'code' to both C++ and Rust devcontainers, creating a secure, immutable development environment.
Requirements Implementation Status:
remoteUserproperty per official documentationChanges Made:
C++ Container (
/.devcontainer/cpp/):/cache/.ccache,/cache/.cpm,/cache/.python)/opt/conan) with appropriate permissionsdevcontainer.jsonwithremoteUser: "code"Rust Container (
/.devcontainer/rust/):/usr/local/cargo,/usr/local/rustup)devcontainer.jsonwithremoteUser: "code"Documentation:
.github/copilot-instructions.mdwith conventional commit guidelinesSecurity Features:
Compatibility:
Testing Performed:
The devcontainers now provide a secure, non-root development environment that meets all specified requirements while maintaining full functionality and cross-platform compatibility.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.