Skip to content

feat(sensor): add standalone secfoo sensor daemon, disk spooler, and service installers (#67) - #235

Open
SriRamkunamsetty wants to merge 1 commit into
secfoo-com:mainfrom
SriRamkunamsetty:feat/standalone-sensor-67
Open

SriRamkunamsetty wants to merge 1 commit into
secfoo-com:mainfrom
SriRamkunamsetty:feat/standalone-sensor-67

Conversation

@SriRamkunamsetty

Copy link
Copy Markdown
Contributor

Fixes #67

Summary

  • Implemented secfoo sensor run|status|install|uninstall (src/secfoo/sensor/daemon.py, src/secfoo/sensor/service.py, src/secfoo/cli.py).
  • Supports repeatable --listen transports (unix://, loopback-only tcp:// with optional SECFOO_SENSOR_KEY auth, and Windows npipe://), rejecting any routable TCP host or missing API key/server/project cleanly (load_sensor_config()).
  • Handles #73 handshake (hello, welcome, slow), bounded in-memory #53 coalescing (EventBuffer), ETag-cached /api/runtime/v1/watchlist atomic sync (SECFOO_WATCHLIST), periodic /heartbeat + dropped_total, and bounded FIFO gzipped disk spooling (--max-spool-mb, default 50 MiB) with exponential backoff retry.
  • Added explicit opt-in service generators/installers for systemd, launchd, and windows (sc.exe).

Verification

  • pytest -p no:langsmith -p no:hypothesis tests/test_sensor/test_sensor_daemon.py tests/test_runtime/test_runtime_api.py -q -> 40 passed, 1 skipped (POSIX unix:// listener skipped on Windows; Windows npipe://, TCP multi-probe auth, ETag 304, spool eviction/recovery, and end-to-end secfoo serve ingest within 1 flush interval all passed).
  • ruff check . & bandit -c .bandit -ll -r src/secfoo -q -> passed.
  • git merge-tree --write-tree HEAD upstream/main -> zero conflicts.

Copilot AI balanced review requested due to automatic review settings December 1, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

def _restrictive_chmod(path: Path, mode: int) -> None:
if os.name == "posix":
with contextlib.suppress(OSError):
os.chmod(path, mode)
family = socket.AF_INET6 if ":" in host else socket.AF_INET
srv = socket.socket(family, socket.SOCK_STREAM)
srv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
srv.bind((host, port))
break
buf += chunk
if len(buf) > MAX_LINE_BYTES * 8:
buf = b""
conn.close()

def _start_npipe_listener(self, raw_addr: str, pipe_name: str) -> ListenerHandle:
import ctypes
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.

Standalone runtime sensor (secfoo sensor) as sidecar or host daemon

3 participants