Repository navigation
feat(security): log every command in webapp via a Falco custom rule - #26
Merged
Merged
Conversation
The default ruleset logs the shell *spawn* ("Terminal shell in container"), not
the commands typed after a kubectl exec — which is the whole reason Falco is
here. Add a custom rule that logs every process in the webapp namespace, so
`id`, `cat`, `ls`, ... each produce an alert.
- falco.tf: customRules "Command run in webapp container"
(spawned_process and container and k8s.ns.name = webapp).
- docs/falco.md: document the two rules, the per-command test flow (no TTY
needed), and the shipper re-roll needed after a Falco restart.
Verified live: exec into webapp -> each command fires the rule -> alerts ship
to floci CloudWatch /k8s/falco.
Co-Authored-By: Claude Opus 4.8 <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.
What
Adds a Falco
customRulesentry so every command run in the webapp namespace is logged — not just the shell spawn.Follow-up to #25. The default
Terminal shell in containerrule fires when a shell opens, but the individual commands typed after akubectl exec(id,cat /etc/shadow,ls) produce no default alert. That's the exact visibility Falco was added for, so this bakes in a rule to capture it.Changes
terraform/cluster/falco.tf—customRules→Command run in webapp container:docs/falco.md— documents the two rules, the per-command test flow (no TTY needed now), and the shipper re-roll after a Falco restart.Verified live (end to end)
kubectl exec -n webapp POD -- sh -c 'id; cat /etc/hostname; ls /'→ Falco fires one alert per command./k8s/falco:helm templaterenders the rule into thefalco-rulesConfigMap;terraform validateclean; localsecurity-gates.sh→ all four gates PASS.Note
The rule is noisy by design (every exec in webapp). Fine for the lab/demo; for real use, scope it or exclude known process names.
🤖 Generated with Claude Code