Skip to content

Prove that a behavior runs without privilege, for osapi's and an extension's #1959

Backlog

Description

@retr0h

The lab found each privilege bug of #1943 only on a real host: ping under SELinux, sysctl under PrivateDevices, the journal group, apt's setuid helper, the netplan read, ip link and CAP_NET_ADMIN, the pipes on systemd 257. The author of a behavior, and of an extension, needs to find these before a lab run, and needs to learn the rule from osapi itself (#1948).

Three layers:

  1. Static, in osapi dsl behavior validate:

    • A provider that runs a program (os/exec or the exec helper) outside a declared root call or step is refused.
    • A read of a path that the agent user cannot read (from a list: shadow, the SSH host keys, /root) must go through a declared read step.
    • The message names the fix: do it in Go, or declare a call or step with its Needs.
  2. Generated test, osapi dsl behavior verify: runs each method of the behavior the way that the agent runs it:

    • as a non-root user, in the agent's systemd sandbox (the same unit properties);
    • with a broker, against a container or a VM;
    • on an SELinux-enforcing host (Fedora) and on a non-SELinux host (Debian) at least.

    It reports each method that needs a privilege that it does not declare. CI runs it for osapi's behaviors. An extension author runs it against the lab or a VM.

  3. Teach it:

    • spec get and the build-a-behavior skill give the rules: prefer Go to running a program (the ping example); when root is needed, declare the narrowest call or step with Needs; and a confined program under SELinux cannot use the broker's files.
    • Each refusal of the broker says which declaration is missing.

Part of #1948 (discoverability, with source and with extensions).

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions