feat(control-api): TTL / auto-expiry for dynamically-added denies - #302
Merged
Conversation
Any control-API add verb now accepts an optional trailing `ttl=<seconds>`
token; the deny is removed automatically when it expires, so a transient
signal (e.g. a Falco detection relayed by aegis-responder) can no longer
wedge a path or IP permanently.
- src/ttl_registry.{hpp,cpp}: kernel-free parse/partition/persistence
helpers for a timed-deny registry (/var/lib/aegisbpf/deny_ttl.db).
- src/daemon.cpp: parse ttl in the control callback, maintain the registry
after a successful op, and run a reaper thread (5s granularity) that
re-issues the CLI del command for expired entries. A mutex serializes
registry read-modify-write between the socket thread and the reaper.
Wall-clock expiry survives restart; re-add extends, re-add-without-ttl
makes permanent, del/clear drop the timer.
- aegis-responder: per-rule `ttl_seconds` forwarded as the `ttl=` token
(decide/sendControl), with Go tests for passthrough + wire format.
- tests/test_ttl_registry.cpp: 11-case GTest suite (parse, partition,
upsert/remove, db round-trip with spaces, reap).
- docs/CONTROL_API.md, responder README/config/DaemonSet, CHANGELOG.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ErenAri
force-pushed
the
feat/control-api-ttl
branch
from
August 11, 2026 12:42
5d28e4f to
7f026be
Compare
Merged
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 & why
Closes the standing safety gap in automated response: a deny installed over the control API (
POST /block/add,/network/deny/*) had no way to expire, so a transient signal — e.g. a Falco detection relayed byaegis-responder— could wedge a path or IP permanently until an operator cleared it. This was the responder's own #1 roadmap item.How
Any add verb now accepts an optional trailing
ttl=<seconds>token:src/ttl_registry.{hpp,cpp}— kernel-free parse/partition/persistence for a timed-deny registry at/var/lib/aegisbpf/deny_ttl.db(<expiry-epoch> <verb> <arg>). Because a path may contain spaces, only the final token is treated as attl=marker; malformed markers (ttl=,ttl=abc,ttl=0) are left as part of the path (deny stays permanent).src/daemon.cpp— the control callback parses the ttl, maintains the registry after the enforcement op succeeds, and a dedicated reaper thread (5 s granularity, started with the control API, joined on shutdown) re-issues the same CLIdelcommand for expired entries. A mutex serializes registry read-modify-write between the socket thread and the reaper. Expiry is wall-clock so it survives a daemon restart; a backwards clock step only delays reaping.POST /block/del//block/cleardrop the timer.aegis-responder— per-rulettl_seconds(config) forwarded as thettl=token viadecide/sendControl.Tests
tests/test_ttl_registry.cpp— 11-case GTest (parse incl. paths-with-spaces + malformed rejection, partition, upsert/remove-by-verb, db round-trip, reap invokes del + persists survivors).TestDecide_PassesTTL,TestSendControl_AppendsTTL(+ existing suite updated for the new signatures).go vet+go test -raceclean.aegisbpf+aegisbpf_testbuild clean; TTL + SocketApi suites 16/16; new files clang-format clean.Docs
docs/CONTROL_API.md(new "Auto-expiry (TTL)" section), responder README/config.example.json/DaemonSet, CHANGELOG.🤖 Generated with Claude Code