Add sudoers rules and install copy for users.yaml and workspaces.yaml#105
Merged
Add sudoers rules and install copy for users.yaml and workspaces.yaml#105
Conversation
install apply was missing sudoers rules for users.yaml and workspaces.yaml. Without NOPASSWD rules, sudo -n cat fails silently and the bot falls back to ALLOWED_USER_IDS / empty workspace configs with no error logged. - Add cat rules for users.yaml and workspaces.yaml in _generate_sudoers - Refactor services.yaml copy in _apply_secrets into a loop that handles all three YAML config files identically - Update dry_run message to reflect YAML configs - Update test_contains_cat_rules to assert the two new rules Fixes #104
Owner
Author
Review by KaiPR looks clean overall. The fix is correct, minimal, and follows established patterns. No critical or warning-level issues. Suggestion — # dry_run branch (line ~1282):
print(f"[DRY RUN] Would copy: /etc/kai/{yaml_name} (mode 0600)")
# real branch below uses the variable:
yaml_dst = etc_kai / yaml_name
print(f" Copied {yaml_dst}")The dry-run message hardcodes No issues with:
|
Owner
Author
Review by KaiPR looks good. The prior suggestion was addressed. The dry-run branch now correctly uses No new findings:
Clean to merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
install applywas missing sudoers rules and file copy logic forusers.yamlandworkspaces.yaml. Without NOPASSWD sudoers rules,_read_protected_file()inconfig.pyfails silently (sudo -n catexits non-zero), and the bot falls back toALLOWED_USER_IDS/ empty workspace configs with no error logged.Changes
1. Sudoers rules (
_generate_sudoersininstall.py)Added
catrules for/etc/kai/users.yamland/etc/kai/workspaces.yamlbetween the existingservices.yamlandtotp.secretrules. Config files are now grouped together in the sudoers output.2. File copy during install (
_apply_secretsininstall.py)Refactored the single
services.yamlcopy block into a loop that handles all three YAML config files (services.yaml,users.yaml,workspaces.yaml) identically: copy if exists in source directory, chmod 0600, chown root:root.3. Dry run message (
_apply_secretsininstall.py)Updated the dry_run branch to report which YAML configs would be copied, matching the real code path.
Why this matters
On a protected installation (
/etc/kai/owned by root), the runtime code triessudo -n cat /etc/kai/users.yamlfirst. Without a NOPASSWD rule, this fails silently and_load_user_configs()returns None, falling back toALLOWED_USER_IDS. The multi-user features from PRs #97 and #98 would be completely ignored on a protected installation with no visible error.Fixes #104
Test plan
test_contains_cat_rulesasserts rules for all config files including users.yaml and workspaces.yaml