Skip to content

fix(agent): FIM baseline advanced for unreported change deltas - #31

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-management-92e1
Draft

fix(agent): FIM baseline advanced for unreported change deltas#31
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-management-92e1

Conversation

@cursor

@cursor cursor Bot commented Sep 4, 2026

Copy link
Copy Markdown

Bug and impact

Full-scope FIM permanently lost change events whenever a scan produced more deltas than fim_max_changes (default 500), or when the ~1.5MiB report marshal trimmed file_changes further. Overflowed adds/modifies/deletes were merged into the on-disk baseline anyway, so later scans treated them as already acknowledged and never emitted them.

Trigger: mass package update, bulk delete, or large config rollout on a host with FIM full scope enabled → first scan reports ≤500 changes (or ≤200 after size trim) and silently drops the rest forever.

Root cause

collectFIMChanges truncated the reported slice in fimDiffBaseline, then advanced the baseline with the full cur map and every visited deletion. The transport size cap in module_host_security.go could drop even more entries after that save.

Fix

  • Advance baseline only for unchanged / first-visit seeds and paths present in the reported change list.
  • Stage merge inputs so a later transport trim can re-commit with the final acknowledged set.
  • Regression tests for maxChanges overflow and transport re-commit.

Validation

  • go test -count=1 -run 'TestCollectFIM|TestFIM|TestFim' ./cmd/agent/
  • go build ./cmd/agent ./cmd/server

Note

PR #30 (alert_history retention/resolve) is still open and unrelated: #30

Open in Web View Automation 

When fim_max_changes (or the 1.5MiB transport trim) dropped change
events, collectFIMChanges still merged the full scan into the baseline,
so overflowed adds/modifies/deletes were never emitted on later scans.
Only acknowledge reported paths (and unchanged/first-visit seeds); allow
a re-commit after transport truncation.

Co-authored-by: Ethan <sreyun@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant