docs: describe how the preStop exec cache and network event dedup affect the runtime rules

Aperta Adatta ai principianti
#1,093 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
documentation

Direzione di ricerca

Leggi le note esistenti sulla deduplicazione e sulla configurazione in docs/, poi verifica il comportamento indicato in pkg/rulemanager/cel/libraries/containerprofile/exec.go e pkg/dedupcache/keys.go. Aggiungi documentazione che descriva il trigger preStop, la finestra di cinque minuti, le funzioni CEL interessate, le chiavi degli eventi e i relativi TTL, e cosa viene saltato per gli eventi deduplicati. Il lavoro è completato quando gli autori di regole possono trovare nella documentazione entrambi i comportamenti e i relativi effetti a runtime.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

Two behaviours of the rule engine aren't documented, and both change which events the runtime rules see. They're intended, but someone writing or tuning rules has no way to know about them except by reading the code.

  1. preStop exec cache. isExecInPodSpec (pkg/rulemanager/cel/libraries/containerprofile/exec.go) marks a container's preStop hook as triggered when an executed path appears in its lifecycle.preStop.exec.command. While it's marked, which lasts DefaultPreStopCacheTTL (5 minutes), was_executed treats every exec in that container as expected. With a common hook like ["/bin/sh", "-c", "sleep 5"], this window starts whenever /bin/sh runs, not only when the pod terminates. That's worth stating next to the rules that use ap.was_executed / cp.was_executed.
  2. Network event dedup. ComputeNetworkKey(mntns, pid, dstAddr, dstPort, proto) (pkg/dedupcache/keys.go) has no packet direction, and network events dedup for 5s. So within that window, a second event with the same process, remote address, port and protocol is dropped before the rule manager, profile learning and malware scan see it.

Proposal

Add a short section, for example in docs/ next to the existing dedup and configuration notes, that explains:

  • the preStop exec window: what triggers it, how long it lasts, and which CEL functions it affects;
  • the dedup keys and TTLs per event type, and what a deduplicated event skips.

I'm happy to write the doc PR if that sounds useful, and to adjust it to how you'd like these described.

Lingua principale
Go
Stelle
39
Fork
42
Merge medio
1g 18h
PR unite (30g)
40

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kubescape/node-agent

Tutte le issue di kubescape/node-agent

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.