Item 3: an agent cannot approve its own proposals: the before-tool hook refuses sisi approve in any wrapping; a decision needs the typed word read from the controlling terminal; refused attempts are recorded with the session. done / next: items 4 and 9 (backlog and pending-approval statuses, main-repo origin)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4418136d01
commit
11554b759a
7 files changed
+405
-28
No files matched your search
+36
-12
@@ -28,18 +28,41 @@ limited, and the rest waits for you:
|
||||
own trusted project, a risk pattern that lowers a profile, any replaced or disabled rule, and rule text or a
|
||||
library entry from a learning confined to one project. Protected rules (`canon/protected.json`) cannot be changed
|
||||
by a cycle or by `sisi overlay` at all, and if that file cannot be read, no rule can be changed.
|
||||
- Replaying a command check runs it, so a replay happens only in a repository on the trust list, only if the
|
||||
command exists at both commits, and only if the earlier commit is an ancestor of the later one.
|
||||
- A cycle file is untrusted input, and `sisi cycle check` never executes anything from it. `sisi cycle apply`
|
||||
replays a command check only in a repository on the trust list, only between two commits taken from the learning's
|
||||
own record (its unit's start and closing commits, or the ones stored with the finding; never from the file), only
|
||||
if the command names a path that differs between the two trees, and only inside an exported copy of each
|
||||
commit's tree: no `.git` directory (the command cannot read history), an environment of `PATH`, `HOME` (an empty
|
||||
directory) and `LANG` only (none of the caller's credentials or tokens), a time limit, and the copy deleted
|
||||
afterwards. A learning with no recorded commits cannot be validated: its command check waits for you as
|
||||
`unvalidated`. What this does not do: the replayed command still runs as you, with your file permissions, and
|
||||
sisi does not sandbox it; which is why a command that was not seen to fail and then pass waits for you.
|
||||
|
||||
`sisi approve` lists every waiting change in full (the exact command, the pattern and profile, the rule text as a
|
||||
diff) and decides it with `--yes` or `--no`. What this does guarantee: a decision from a process with no terminal
|
||||
(an agent, a script, a pipe) is refused, unless your config has `learning.agent_relayed_approval` set (off by
|
||||
default), and then the record says `relayed by an agent`; every decision is written to `approvals.jsonl` with the
|
||||
time, the session if known, and whether it came from a terminal. What it does not guarantee: sisi cannot tell a
|
||||
person at a terminal from a program that allocates one, and anyone who can write your personal data folder can
|
||||
edit the config, the pending list or the ledger directly. The protection is that an agent is told to show you the
|
||||
change and to give you the command to type yourself, and that the cycle cannot apply anything consequential on its
|
||||
own; it is not a defence against code that already runs with your permissions.
|
||||
diff). Deciding one takes two layers:
|
||||
|
||||
- The before-tool hook refuses any shell command an agent runs whose text invokes `sisi approve` with an argument,
|
||||
however it is wrapped (`script`, `sh -c`, `env`, `expect`, a path to the launcher, `python -m sisi`, quotes and
|
||||
backslashes inside the words), for main threads and workers alike, and tells the agent that approval is yours
|
||||
alone and to show you the command to run yourself. The plain listing (`sisi approve` with no arguments) is
|
||||
allowed. The hook fails open on an error, so it is a guard, not a wall: a command built from pieces, from a
|
||||
variable or from an encoded string is not recognised by its text.
|
||||
- `sisi approve ID --yes|--no` itself prints the whole action and a short random word on the controlling terminal
|
||||
device (`/dev/tty`, never standard input) and decides only when that word is typed back there. A process with no
|
||||
controlling terminal is refused; so is one whose terminal returns the wrong word or nothing. This is the typed
|
||||
word, and it is what `script -qec "sisi approve ID --yes" /dev/null </dev/null` runs into: the pseudo-terminal it
|
||||
allocates has nobody typing at it.
|
||||
|
||||
Every refused attempt, by the hook or by the command, is written to `approvals.jsonl` with the session id; every
|
||||
decision is written there with the time, the session if known, and whether a terminal was used. Your config may set
|
||||
`learning.agent_relayed_approval` (off by default): then a decision from a process with no terminal is accepted and
|
||||
the record says `relayed by an agent`. What this does not stop: an agent that can read and write a terminal it
|
||||
allocated itself (`expect`, a pty library) sees the word and can type it, and the hook's text check does not see
|
||||
every way of writing a command. Neither layer proves who is at the keyboard, and anyone who can write your personal
|
||||
data folder can edit the config, the pending list or the ledger directly. The protection is that an agent is told to
|
||||
show you the change and give you the command to type yourself, that the hook and the typed word make doing it for you
|
||||
hard and leave a record, and that the cycle cannot apply anything consequential on its own; it is not a defence
|
||||
against code that already runs with your permissions.
|
||||
|
||||
The same limit applies to who recorded something. A learning recorded from a subagent is held as a candidate until
|
||||
the parent adopts it by id. "Recorded by a subagent" is read from what the hooks recorded in the session record, not
|
||||
@@ -71,7 +94,8 @@ that could be exploited. Include the version (`sisi --version`), what you did, a
|
||||
The trust list guarantees only that an untrusted project's contract does not run; it does not
|
||||
make a trusted contract safe. Protected rules guarantee that a cycle or overlay cannot change
|
||||
them; they do not stop someone who can write the product folder. Owner approval guarantees
|
||||
that a consequential change waits and that a decision without a terminal is refused unless
|
||||
relayed approval is allowed in config; it does not prove who was at the terminal. The
|
||||
that a consequential change waits and that a decision needs the word typed at a controlling terminal (and is
|
||||
refused for an agent's shell command by the before-tool hook) unless relayed approval is allowed in config; it
|
||||
does not stop a program that allocates its own terminal and reads it, and does not prove who was at the keyboard. The
|
||||
delivery ledger guarantees that only rows sisi's own commands wrote, as written, are
|
||||
delivered; it does not prove the content of a row is true.
|
||||
Reference in new issue
Block a user