fix(gen-audit-rules): emit the unit-dir watch once per user, not per repo - #221
Merged
Merged
Conversation
…repo
The ~/.config/systemd/user/ watch is a property of the agent USER, but the
generator emitted it inside the per-registry-line loop. With several repos
consolidated under one agent user -- a topology the registry explicitly
permits -- the identical rule is generated once per repo and auditd rejects
the duplicates ("Rule exists", error in audit.rules) on every load,
including every boot. A recurring load error on the audit layer is noise
that trains the operator to ignore the one channel that must stay credible.
Emit repo-scoped watches in the per-line loop and user-scoped watches in a
second pass over unique users. Found live on the first consolidated-registry
load (recode-agent hosting both reCode and reDeploy).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gen-audit-rules.shemits the~/.config/systemd/user/watch inside theper-registry-line loop, but that watch is a property of the agent user, not the
repo. When several repos are consolidated under one agent user — a topology the
registry format explicitly permits — the identical rule is generated once per repo,
and
augenrules --loadrejects the duplicate:This recurs on every load, including every boot. The watching itself is
unaffected (the first copy loads), but a permanent load error on the audit layer is
noise that trains the operator to ignore audit failures.
Fix
Repo-scoped watches stay in the per-line loop; user-scoped watches move to a second
pass over
sort -uunique users.Verification
With a registry of two repos under one user: 12
-wrules,sort | uniq -dempty.Found and reproduced live on BusyBee's first consolidated-registry load
(recode-agent hosting both reCode and reDeploy).
🤖 Generated with Claude Code