Repository navigation
Open
Description
deploy/linux/tendcf-install.sh (put_data,
tendcf/deploy/linux/tendcf-install.sh
Lines 142 to 162 in db1e73e
| } | |
| put_data() { # put_data FILE | |
| local src="$1" backup="" | |
| [ -f "$src" ] || die "no such data file: $src" | |
| if [ -f "$data" ]; then | |
| backup="$data.previous" | |
| cp -p "$data" "$backup" | |
| fi | |
| # Write beside the live file, then rename over it: the agent (cf-execd runs | |
| # it on a schedule) never reads a half-written host_specific.json, and the | |
| # loader and the policy's cross-check cannot see two different halves. | |
| local tmp="$data.new" | |
| if ! install -m 0600 -o root -g root "$src" "$tmp"; then | |
| rm -f "$tmp" | |
| die "could not write $tmp" | |
| fi | |
| mv -f "$tmp" "$data" | |
| if ! "$cf_promises" -f "$entry" >/dev/null; then | |
| if [ -n "$backup" ]; then mv -f "$backup" "$data"; else rm -f "$data"; fi | |
| die "cf-promises rejected $src; previous data restored" |
cf-promises and checks only its exit status.
- A syntactically valid projection that the policy refuses (
tendcf_cmdb_refused) passescf-promises. The script prints "data installed" and leaves a host on which every run refuses. That fails closed, but nobody is told and nothing rolls back. - The new data is live before validation, so an agent run in that window acts on unvalidated data.
Wanted: validate the staged candidate before publication, and detect a policy refusal explicitly (for example cf-promises --show-classes for tendcf_cmdb_refused), with rollback to the backup and a regression test for both.
Related: #53 (the same path skips the projector).
From the round-2/3 reviews of #42 (frontier review C1; adversary r2 I2, r3 I3.2).
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels
Activity