Add silence attribute to changes body promises (CFE-159)#22
Open
nickanderson wants to merge 2 commits into
Open
Add silence attribute to changes body promises (CFE-159)#22nickanderson wants to merge 2 commits into
nickanderson wants to merge 2 commits into
Conversation
| { | ||
| Log(LOG_LEVEL_VERBOSE, "Preceding promise '%s'", pp->comment); | ||
| Log(LOG_LEVEL_INFO, "Hash '%s' for '%s' changed!", HashNameFromId(type), filename); | ||
| if (pp->comment) |
| Log(LOG_LEVEL_INFO, "Hash '%s' for '%s' changed!", HashNameFromId(type), filename); | ||
| if (pp->comment) | ||
| { | ||
| Log(LOG_LEVEL_VERBOSE, "Preceding promise '%s'", pp->comment); |
| } | ||
| else | ||
| { | ||
| SetPromiseOutcomeClasses(ctx, PROMISE_RESULT_CHANGE, &(attr->classes)); |
| } | ||
| else | ||
| { | ||
| SetPromiseOutcomeClasses(ctx, PROMISE_RESULT_CHANGE, &(attr->classes)); |
| } | ||
| else | ||
| { | ||
| SetPromiseOutcomeClasses(ctx, PROMISE_RESULT_CHANGE, &(attr->classes)); |
| if (!IsChangeSilenced(attr, FILE_CHANGE_SILENCE_DEVICE)) | ||
| { | ||
| Log(LOG_LEVEL_NOTICE, "Device for '%s' changed %ju -> %ju", | ||
| file, (uintmax_t) cmpsb.st_dev, (uintmax_t) sb->st_dev); |
| } | ||
| else | ||
| { | ||
| SetPromiseOutcomeClasses(ctx, PROMISE_RESULT_CHANGE, &(attr->classes)); |
| if (!IsChangeSilenced(attr, FILE_CHANGE_SILENCE_INODE)) | ||
| { | ||
| Log(LOG_LEVEL_NOTICE, "inode for '%s' changed %ju -> %ju", | ||
| file, (uintmax_t) cmpsb.st_ino, (uintmax_t) sb->st_ino); |
| } | ||
| else | ||
| { | ||
| SetPromiseOutcomeClasses(ctx, PROMISE_RESULT_CHANGE, &(attr->classes)); |
nickanderson
force-pushed
the
CFE-159-silent-changes
branch
from
July 21, 2026 21:06
8c57dab to
5350cb7
Compare
The `silence` attribute on `body changes` takes a list of change categories (content, add, remove, owner, group, perms, device, mtime, inode, or all) whose alert output is suppressed. A silenced category no longer emits its INFO/NOTICE alert or the RecordChange syslog line, but the persistent audit log (file_changes.log), the checksum_alerts class, and the promise outcome classes (if_changed/if_repaired) are all still recorded. Errors are never silenced. Ticket: CFE-159 Changelog: Added the `silence` attribute to `body changes`, which suppresses alert output for selected file-change categories while still recording the change classes and the persistent audit log. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nickanderson
force-pushed
the
CFE-159-silent-changes
branch
from
July 21, 2026 21:12
5350cb7 to
a233ef4
Compare
CodeQL's cpp/missing-argument-null-check flagged several parameters that are dereferenced without an explicit null-check in functions touched by this branch. Add assert() guards documenting the non-null contract, the same convention neighbouring functions already use (e.g. VerifyDelete's existing assert(attr != NULL)). - libpromises/attributes.c: GetContextConstraints() - pp - cf-agent/verify_files_utils.c: SourceSearchAndCopy() - attr - cf-agent/verify_files_utils.c: VerifyDelete() - sb - cf-agent/verify_files_utils.c: VerifyFileAttributes() - dstat Ticket: CFE-159 Changelog: None Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Review PR — targets this fork's
masterfor a clean look at the change. The real PR will be opened againstcfengine/coreupstream.What
Adds a
silenceattribute tobody changes: a list of change categories whose alert output is suppressed, while classes and the persistent audit log are preserved.Categories:
content,add,remove,owner,group,perms,device,mtime,inode,all.INFO/NOTICEalert and theRecordChangesyslog line for the listed categories.file_changes.log), thechecksum_alertsclass, theif_changed/if_repairedoutcome classes, and the promise's repaired result.LOG_LEVEL_ERR) are never silenced.Implementation
libpromises/cf3.defs.h—FileChangeSilencebitmask enum +silencefield.libpromises/mod_files.c—silenceconstraint (string list).libpromises/attributes.c— table-driven parse of the category list.cf-agent/files_changes.c,cf-agent/verify_files_utils.c— gate the alert/RecordChange on silence while always writing the audit log and preserving classes/outcome.Validation (rebased on
upstream/master7fa5494ca)tests/static-check/run_checks.sh): gcc + clang-Werror -Wall -Wextrabuilds + exhaustive cppcheck — clean, no findings.make check): pass.tests/acceptance/10_files/02_maintain/changes_silent.cfpasses;10_filessubsystem green (one unrelated libxml2-version-sensitive XML-edit test aside);10_filesunsafe/immutable 24/24.🤖 Generated with Claude Code