Files
jason.woltje 068d868a99 lead: commit rocko's untracked evidence (4471 files: queue-124 queue-129 queue-171 queue-178 queue-280 queue-31 queue-84 queue-85 queue-94)
Unclaimed files left in the canonical checkout. Inventory: canonical-cleanup-inventory.md (commit-as-evidence groups). detect-secrets scan clean on 2026-11-02: hits are sha256 pins, git object ids, test sentinels already in tracked tests and unit-file lines.
2026-11-02 15:05:15 -06:00

22 lines
1.4 KiB
Python

# Linux inotify observes opens, not just content validation. Only an owned temp fixture is watched.
import ctypes, os, struct, subprocess, tempfile
from pathlib import Path
repo=Path('/mnt/storage/src/mosaic-stack-rocko-178')
libc=ctypes.CDLL(None,use_errno=True)
fd=libc.inotify_init1(os.O_NONBLOCK|os.O_CLOEXEC)
assert fd>=0,'inotify unavailable'
try:
with tempfile.TemporaryDirectory(prefix='proof-render-watch-',dir=os.environ['TMPDIR']) as d:
file=Path(d)/'proof.fixture';file.write_text('fixture-invalid-proof-bytes');file.chmod(0o600)
# IN_ACCESS | IN_OPEN: metadata stat/realpath never opens or reads the watched file.
wd=libc.inotify_add_watch(fd,os.fsencode(file),0x1|0x20)
assert wd>=0,'watch failed'
r=subprocess.run(['bash',str(repo/'scripts/webui-service.sh'),'render','--public-host','console.example','--auth-header','x-user','--allow-user','jason','--proof-header','x-console-proof','--proof-file',str(file)],env={**os.environ,'HOME':d,'XDG_CONFIG_HOME':str(Path(d)/'config')},capture_output=True,text=True,timeout=10)
assert r.returncode==0,'render failed'
try:events=os.read(fd,65536)
except BlockingIOError:events=b''
assert not events,'render opened or read the fixture proof file'
assert 'fixture-invalid-proof-bytes' not in r.stdout+r.stderr,'render disclosed fixture contents'
print('PASS: render carries both flags without opening or reading the watched fixture')
finally:os.close(fd)