-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add user isolation with --isolated-user and --keep-user options #33
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
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #30
Question about User Isolation RequirementsI'm working on implementing user isolation for issue #30. Based on the issue description:
I understand this to mean running commands as a different user (similar to Proposed ImplementationAdd a # Simple user isolation
$ --user john -- npm start
# Combined with screen isolation
$ --isolated screen --user john -- npm start
# Combined with docker (uses Docker's --user flag)
$ --isolated docker --image node:20 --user 1000:1000 -- npm installQuestions
Please let me know if this approach aligns with your vision for this feature, or if you had something different in mind. |
Implements user isolation feature that allows running commands as a different user. This addresses issue #30 by enabling both process isolation (screen/tmux/docker) and user isolation to work together. Changes: - Add --user option to run commands as specified user - For screen/tmux: Wraps commands with `sudo -n -u <user>` - For docker: Uses Docker's native `--user` flag - Add comprehensive tests for user isolation in args-parser and isolation modules - Update documentation (README, REQUIREMENTS) with user isolation examples - Add help text and usage examples for --user option Usage examples: - Simple user switch: $ --user www-data -- node server.js - With screen: $ --isolated screen --user john -- npm start - With docker: $ --isolated docker --image node:20 --user 1000:1000 -- npm install Note: User isolation with screen/tmux requires sudo NOPASSWD configuration for the target user, as it uses non-interactive sudo (-n flag). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
✅ Implementation CompleteThe user isolation feature has been successfully implemented and is ready for review! Summary
Key Implementation Details
TestingAll functionality has been tested:
Next StepsPlease review the implementation and let me know if:
Thank you! |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
Resolve conflicts, and make sure we by default create user with the same permissions. For example if our user is in sudo group - created user should also be, and if our user have access to docker the created user also should be. Make sure it nicely integrates with all other isolation levels. |
|
🤖 AI Work Session Started Starting automated work session at 2025-12-25T14:56:17.955Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
…move features This merge combines: - User isolation feature from issue-30 branch (--user option) - Keep-alive feature from main (--keep-alive option) - Auto-remove docker container feature from main (--auto-remove-docker-container option) All features now work together seamlessly: - --user works with all isolation backends (screen, tmux, docker) - --keep-alive keeps sessions alive after command completes - --auto-remove-docker-container for docker cleanup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
… permissions Adds the ability to create a new isolated user that inherits the same group memberships as the current user (sudo, docker, wheel, etc.). This enables true user isolation while preserving necessary access permissions. Features: - --create-user [username]: Create isolated user with same groups as current user - Automatically generates unique username if not specified - User is automatically deleted after command completes - Works with screen/tmux isolation (not docker) - Cannot be combined with --user option Implementation: - Add user-manager.js module for user creation/deletion utilities - Add --create-user option parsing to args-parser.js - Add runAsUser function to isolation.js for direct user execution - Integrate user creation into cli.js runWithIsolation flow - Add comprehensive tests in user-manager.test.js Documentation: - Update README.md with Automatic User Creation section - Update REQUIREMENTS.md with section 6.6 for automatic user creation - Update isolation options table to include --create-user - Update changeset with feature description 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
No, there is no way to use existing user to run the command, user isolation should mean we create user - run command using this user, after command have finished we can delete user, unless we have |
|
🤖 AI Work Session Started Starting automated work session at 2025-12-25T17:23:34.578Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Based on user feedback, simplified the user isolation API: - Remove --user option for running as existing users - Rename --create-user to --user (since it's the only user isolation) - Add -u shorthand for --user - Add --keep-user option to prevent user deletion after command completes - Remove runAsUser export from isolation.js (no longer needed) The --user option now always creates a new isolated user with same group permissions as the current user. User is deleted after command completes unless --keep-user is specified. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Move runAsIsolatedUser function to isolation.js - Condense printUsage() using template literals - Reduce cli.js from 1024 to 981 lines 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
|
I think we can make it more clear. should be replaced with So we make sure, for example not only So it clearly visible that user is used as isolated execution method. |
|
🤖 AI Work Session Started Starting automated work session at 2025-12-26T19:45:37.820Z The PR has been converted to draft mode while work is in progress. This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback. |
Renamed the user isolation option from --user to --isolated-user to make it clearer that this is an isolation method, consistent with --isolated for process isolation. Changes: - Renamed --user to --isolated-user throughout codebase - Updated all tests to use --isolated-user - Updated documentation (README, REQUIREMENTS, changeset) - Updated error messages to reference --isolated-user - Short form -u remains unchanged This makes the naming more consistent: --isolated for process isolation, --isolated-user for user isolation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
Implements user isolation support for issue #30. This allows running commands as a new isolated user with the same group permissions as the current user.
Changes
User Isolation (
--isolated-user,-u)--keep-user)--isolated-user=mynameor-u mynameKeep User (
--keep-user)sudo userdel -r <username>Usage
How It Works
sudo useraddinheriting groups (sudo, docker, wheel, etc.)sudo -n -u <user>sudo userdel -r <user>(unless--keep-user)Requirements
useradd,userdel, andsudo -uTest Plan
--isolated-useroption parsing--keep-useroption🤖 Generated with Claude Code
Fixes #30