fix: fixed uid/gid not being set during session creation - #1184
Conversation
|
|
📝 WalkthroughWalkthroughThe change maps sandbox container identity to UID and GID 1000. It also adds macOS-only justfile targets that build initramfs artifacts and run the startup flow without Docker compilation. ChangesSandbox container identity
macOS no-Docker build flow
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
justfile (1)
122-123: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLock the dependency graph for the no-Docker build.
initramfs-nodockeromits--locked, while the adjacentminvmd-buildandminimal-clirecipes use it. If Cargo resolves dependencies, this path can produce a differentminimalddependency graph. Add--locked, or confirm the equivalent option for the repository’scargo-zigbuildversion.Proposed change
- cargo zigbuild -p minimald --profile initramfs \ + cargo zigbuild -p minimald --profile initramfs --locked \ --target {{musl-target}} --features {{features}}🤖 Prompt for 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. In `@justfile` around lines 122 - 123, Update the initramfs-nodocker recipe’s cargo zigbuild command to pass --locked, using the same dependency-locking behavior as the adjacent minvmd-build and minimal-cli recipes.
🤖 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.
Nitpick comments:
In `@justfile`:
- Around line 122-123: Update the initramfs-nodocker recipe’s cargo zigbuild
command to pass --locked, using the same dependency-locking behavior as the
adjacent minvmd-build and minimal-cli recipes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0ded0198-72d8-47f4-8388-a4ebf1fe1013
📒 Files selected for processing (2)
crates/sandbox2/src/lib.rsjustfile
Fixes #1181
Summary
uid and gid were not being set properly when starting the sandbox. They were defaulting to the current uid/gid (hackoniwa default). This worked on Linux in previous testing because it was always tested from users with uid/gid 1000 (the same as the sandbox user we create), but it would have blown up if a user with a different uid/gid tried to use it. Because minimald is run as root within a VM on macOS, users were being incorrectly dumped into the session as root.
This PR fixes the issue by explicitly setting uid and gid to 1000 during sandbox creation.
Testing
Started a session on macOS and verified that I was running as the correct user
Checklist
BREAKING CHANGE:footer present if this is a breaking changeNo doc changes necessary as this is just a bug fix. While this does technically change behaviour it changes the behaviour to the correct behaviour so we'll call it a fixing change rather than a breaking change.
Note
Fix UID/GID not being set to 1000 during sandbox session creation
uidmap(1000)andgidmap(1000)calls inSandbox::new_containerin lib.rs, overriding the hakoniwa default of inheriting the current process UID/GID.just initramfs-nodockerrecipe to build the initramfs usingcargo zigbuildand a musl target without Docker/cross.just up-nodockeraggregate recipe that sequences the full stack build using the no-Docker initramfs path.Sandbox::new_containernow always run as UID/GID 1000 instead of the invoking user's IDs.Macroscope summarized 6a378f4.
Summary by CodeRabbit
New Features
Bug Fixes