Skip to content

security: scope the package-manager sudo grant to exact commands - #335

Merged
KrasimirKralev merged 1 commit into
betafrom
fix/sec-system-config
Aug 9, 2026
Merged

KrasimirKralev merged 1 commit into
betafrom
fix/sec-system-config

Conversation

@KrasimirKralev

@KrasimirKralev KrasimirKralev commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Part of the ongoing security-hardening sweep (targeting beta).

What this does — scopes the package-manager sudo grant to exact commands instead of a wildcard, so a foothold on the app user can't turn that grant into arbitrary root command execution. Validated with visudo -c on-device (parsed OK), and confirmed the only non-root caller's exact apt-get invocations still match.

(An earlier polkit .pkla tightening was dropped from this PR: adversarial review showed the scoped .rules it relied on is not actually installed, so removing the broad grant would have broken the update mechanism and Ollama management. That finding is being handled properly and separately.)

Config-only change — no application code affected. Vulnerability specifics intentionally omitted from this public description.

…tion-prone wildcard)

The clawbox NOPASSWD grant for 'apt-get update *' / 'apt-get install *'
allowed root escalation via 'apt-get ... -o APT::...::Pre-Invoke=<cmd>'.
Runtime only ever installs chromium (browser-app recovery), so pin the
grant to the exact commands; sudo now rejects any extra option args.
Validated with visudo -c (LF).
@KrasimirKralev
KrasimirKralev requested a review from a team as a code owner August 9, 2026 18:12
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The polkit policy removes broad systemd unit management for clawbox. The sudoers policy limits passwordless apt-get access to quiet updates and Chromium installation.

Changes

Privilege scope hardening

Layer / File(s) Summary
Systemd unit permission scope
config/49-clawbox-updates.pkla
Removes the unscoped manage-units permission. Comments identify the sibling rules file as the source of scoped permissions.
Apt command permission scope
config/clawbox-sudoers
Replaces wildcard apt commands with exact apt-get update -qq and Chromium installation commands. Comments document excluded arguments and the root installation script path.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: georgik77, yalexx

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the sudoers change and validation, but omits the required type, checklist, and structured testing sections. Add the required template sections for change type, testing checklist, repository checklist, and screenshots or logs when applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly describes the primary security change: restricting the package-manager sudo grant to exact commands.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sec-system-config

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

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

@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦀 ClawReview

Scuttled over to say hello and get you oriented 🦀

Tightens two over-broad privileged grants in the system configuration: wildcard apt-get sudo entries are replaced with exact command specs, closing an escalation path where a clawbox-level foothold could inject arbitrary commands via apt hook flags, and an unscoped polkit unit-management entry is removed. The change lands entirely in config/clawbox-sudoers — no application code is touched.

At a glance

  • ⚙️ Config · touches sudoers privilege grants + polkit policy
  • Base branch: beta · +9 source / +0 tests across 1 file
  • ✅ base beta matches the beta-first convention
  • 🟡 title doesn't follow type: description (feat/fix/chore/docs/…)
  • ℹ️ touches security-sensitive paths (config/clawbox-sudoers) — review with extra care

Good to know

— ClawReview 🦀, scuttling off. General info only — see CodeRabbit for the detailed review. Conventions: docs.

@github-actions github-actions Bot added the area: install Auto-triage area label Aug 9, 2026
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

CI Summary

✅ Tests

  • Result: passed
  • View run
  • Coverage: statements 70.75%, branches 61.04%, functions 66.72%, lines 72.64%

✅ E2E

✅ E2E Install

@KrasimirKralev
KrasimirKralev force-pushed the fix/sec-system-config branch from 27532a1 to 372ce91 Compare August 9, 2026 18:22
@KrasimirKralev KrasimirKralev changed the title security: tighten privileged system-configuration scope security: scope the package-manager sudo grant to exact commands Aug 9, 2026
@KrasimirKralev
KrasimirKralev merged commit d8e8982 into beta Aug 9, 2026
8 checks passed
@KrasimirKralev
KrasimirKralev deleted the fix/sec-system-config branch August 9, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: install Auto-triage area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant