Repository navigation
Conversation
|
Standards review at 44a078b. Changes requested. What meets the rules:
Open, each a written rule:
CI, run https://github.com/osapi-io/osapi/actions/runs/47577464515, also fails these. Each is a rule that a check enforces:
Notes that do not block:
The label is now |
|
Standards review at 44a078b, part 2: the docs, the generated pages, CONTRIBUTING.md and the skills. The team lead asked for these parts. My review of the test conventions is in #1943 (comment), and it still applies. What meets the rules:
Open:
The label stays |
|
Code review: changes requested (head 44a078b). I read Required
Notes, not blocking
What I checked and found correct
|
|
Standards re-review at a634a9d. Approved. Each finding from my two reviews at 44a078b is fixed:
The PR title has 36 characters, and the squash uses it. Each of the 26 commits has a subject of 50 characters or fewer, and its trailer. No em dash. The branch is on the current Notes that do not block:
The label is now |
|
Code review: changes requested (head a634a9d). I re-read the delta from 44a078b, ran Fixed, and checked by running it
Required
Notes, not blocking
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1943 +/- ##
==========================================
- Coverage 99.99% 99.99% -0.01%
==========================================
Files 457 499 +42
Lines 27050 30152 +3102
==========================================
+ Hits 27049 30150 +3101
- Misses 1 2 +1
... and 112 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
Standards re-review at 0c65464, of the three commits after a634a9d. Approved again.
The new test code is rows in the tables that were there, with no custom message. No em dash. The commits are a fast-forward from a634a9d and are on the current The label stays |
|
Code review: clean at 0c65464. I read the delta from a634a9d and ran Checked by running or reading:
|
0c65464 to
08d127b
Compare
|
Standards re-review at 08d127b, after the rebase onto main with #1707. Approved again. The rescue through the broker:
The docs:
No em dash. The PR title has 36 characters, and the squash uses it. Each of the 7 commits has a subject of 50 characters or fewer, and its trailer. The branch is on the current Note that does not block: no unit test holds the shape of The label stays |
|
Code review: clean at 7a0265b for the rescue and check part (the change from 08d127b). I re-ran my reproducer against it and ran |
|
Standards re-review at 68dc6ef, of the five commits after 08d127b. Approved again.
Note that does not block:
The label stays |
|
Code review: clean at 68dc6ef for the commits after 7a0265b (1f770f4, c3a5109, e178bc3, 68dc6ef). I ran the checks below on the head, and ran no real unit. file Secrets in the chain. Not blocking
|
|
Standards re-review at 0e1a80b, of the commit after 68dc6ef. Approved again.
Notes that do not block:
The label stays |
StopUnit takes a unit that systemd does not have as stopped: exit 5 of systemctl stop, or "not loaded" from systemctl kill. A watch tick in the few ms between the end of a unit and the return of systemd-run no longer fails a good run. Closes #1962 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Standards review: approved (head 764f368). Checked: 764f368 on 3993dc9 (which I approved), a fast-forward, rebased on main, with its trailer. The two new |
|
Code review: clean at 764f368 (one commit on 3993dc9, based on current main). StopUnit returns nil with no record and no kill when Note, not blocking: Server.run also calls Stop when the agent closes the connection. If that lands before systemd has created the unit, exit 5 is now taken as stopped, where it was an error before; the unit would still end at its RuntimeMaxSec. Neither version stops it, so this is not a regression. |
The chain record printed the mode of a managedfile write in decimal, such as mode=420. The mode is now a behavior.FileMode, whose record is octal, such as mode=0644, and the step accepts four octal digits. A refused step read "sysctl create: sysctl write: [err] sysctl write: ...". The step command printed its error with the mark of the terminal, and privileged.Main named the behavior and the step, which the client names too. The step command now prints the bare error, and Main adds no prefix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chronyc makes its client socket in /run/chrony, which is chrony's and
0700. In the transient unit, /run was read-only and the bounding set was
empty, so chronyc fell back to UDP, and chronyd refused the command with
"501 Not authorised". The call declares Writes("/run/chrony/*") and
CAP_DAC_OVERRIDE. A systemd-run test with the unit's properties on
ubuntu-1 gave 501 without both, and 200 OK with both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Standards review: approved (head c72b4cc). Checked: 9367cd9 and c72b4cc on 764f368 (which I approved), a fast-forward, rebased on main, each with its trailer. |
|
Code review: clean at c72b4cc (two commits on 764f368, based on current main). behavior.FileMode records as %04o. The write step arg is [0-7]{4}, so a mode above 0o7777 is refused, and WriteStep still refuses the setuid, setgid and sticky bits before it takes Perm(). |
CAP_DAC_OVERRIDE let the unit of chronyc reload sources read each file
of root that InaccessiblePaths does not hide. chronyd takes commands on
its socket from its own user too, so the call now runs as _chrony with
no capability, and keeps Writes("/run/chrony/*") for its client socket.
A RootCall can run as a user of the host with .As(user): its unit gets
User=. validate refuses As("root"), a name that is not a user name, and
As on a call of macOS, where no unit of systemd changes the user.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Standards review: approved (head 69724bd). Checked: one commit on c72b4cc (which I approved), a fast-forward, rebased on main, with its trailer. |
|
Code review: clean at 69724bd (one commit on c72b4cc, based on current main). The chronyc call now has User=_chrony, no capability and ReadWritePaths=/run/chrony; the unit keeps NoNewPrivileges, the empty bounding set and the InaccessiblePaths for the secret files, so this is narrower than CAP_DAC_OVERRIDE. The user comes from the compiled declaration (it is in the hash), never from the request. validate refuses As("root"), a non-user name and As on a macOS call, with a row for each. go test -race -cover on internal/behavior, ntp and internal/privileged: pass, 100.0% each; behaviordsl 100.0%; ./cmd passes. GOOS=linux go vet and gofmt: clean. I did not run the lab. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Standards review: approved (head d22a99d). Checked: one commit on 69724bd (which I approved), a fast-forward, rebased on main, with its trailer. It changes only |
The Check it list of build-a-behavior had no go test ./internal/dslcheck/, so a new string in the DSL API passed the per-package checks and failed in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Standards review: approved (head bf3f1af). Checked: one commit on d22a99d (which I approved), a fast-forward, rebased on main, with its trailer. It adds one line to the "Check it" block of |
|
Code review: clean at bf3f1af. The delta from d22a99d is one line in the "Check it" block of internal/skills/resources/dev-skills/build-a-behavior/SKILL.md: |
The agent no longer uses sudo. It runs as the user
osapi(_osapion macOS), with no capability andNoNewPrivileges=yes. A root broker runs each piece of root work that a behavior declares.Specs: osapi-io/specs#756
Closes #1907
Closes #1962
What changes
The broker.
osapi-privileged.socket(/run/osapi/privileged.sock,root:osapi0660,Accept=yes) startsosapi-privileged@.service, which runsosapi agent privileged serve. It does these checks:SO_PEERCRED, orgetpeereidon macOS);/etc/osapi-privileged/enabled.It runs each call or step in a transient unit (
systemd-run,ProtectSystem=strict,ReadWritePathsfor the declared writes, the declared capabilities only) and records it in the journal. macOS gets launchd plists.Declared calls.
behavior.Sudois nowbehavior.Root. The broker matches the whole argument vector, argument by argument (RootCall.Matches), so sudoers globbing is gone.AnyArgsis gone, and validate refuses a call with no shape, with no exception forRootEquivalent. Work whose arguments no shape holds is a privileged step that builds the vector from typed input. This covers docker create and exec, user, group and password.Steps. A step input may have a
[]stringfield, and each value is checked. A step markedRead()is the only root work a read can run, and validate refuses a secret field in its output. The step refusals:fs.protected_*andfs.suid_dumpable, on top of its earlier list;Read steps:
user locked(a bool only);sshkey keys(the public key lines only);docker containersandimage images, because the agent is never in thedockergroup.Write guard. It walks each path from
/withopenat(O_NOFOLLOW|O_NONBLOCK), works on the descriptor (fchown,fchmod,Renameat,Unlinkat), and refuses setuid, setgid and sticky bits andnlink > 1. managedfile and sshkey no longer runstatorchown.Warnings. A read whose gohai collector gives a partial fact returns the fact, with a
warningsfield on each row. A read that runs a collector as the agent, and that no read step covers, adds the collector'sPrivilege().Withouttext.Install.
osapi agent service install --privileged <names>makes the users and groups, owns the config byosapi, makes/var/lib/osapi/pki(2750, grouposapi-admin), and writes the enabled list and the three units.osapi agent privileged enable|disable|listchanges the list.Preflight stops the start for
sudo -n -lthat works, a group that gives root, or a capability. It warns for a group that no enabled behavior declares, and for a broker that does not answer.Removed:
dsl behavior sudoers getanddsl behavior systemd get;agent.privilege_escalationconfig;internal/exec.osapi startis test only and refuses root.CI. As root, the integration suite now starts NATS and the controller, and installs the agent with
osapi agent service installunder its real units, with every behavior enabled. As a user, it still usesosapi start.Choices made by rule, for review
-. The probes catch;,|, newline and../. ARegexargument skips the probes. Only the image reference uses one, because a class cannot say "no..".osapi starton a dev machine still runs, with warnings./etcand/var. The last component is never followed.passwordstep of user and declares no step of its own. packages runs one package per call, with an exact shape.commandgen'svalidatesnow stops atdive, soomitempty,dive,requiredno longer marks a list flag as required.agent privileged enableanddisableareNoAudit, asagent service installis: they run on an agent host, which keeps no audit log.Checks
go test -coveron each changed package: 100.0%. The exceptions arecmd, generated packages andprocesson macOS.processis the same as on main, because its darwin file has realkillpaths.golangci-lint fmtandrunon the changed packages,go vetwithGOOS=linuxon the broker, agent and integration packages, andgo run . dsl behavior validate.just generate, thenbehavior-gen-check,go-fmt-check,md-fmt-check,docs-fmt-check,react-fmt-check,docs-buildandreact-build. Theinternal/apicontractgolden is recorded again (thewarningsfields).Not tested
integrationlabel. The fork guessed these points, and CI confirms or breaks them:runuseris on the runner;localhost;osapion the runner.just bumporjust intran, and nobody checked/var/lib/osapi/pkimode 2750 after a restart.agent privileged enableanddisableon a real host. The integration suite skips both (skipPrivilegedintest/integration/clicases_test.go). Only root writes the enabled list, and a change to the list during the suite changes what each other test can do. The unit tests ofinternal/cli/commands/agentprivilegedcover them against a list in a directory of their own. The lab hand checks run them as root, then restart the agent and run a write of the behavior. A CI test on a real host is test: privileged enable and disable on a real host #1949.🤖 Generated with Claude Code