Skip to content

Enhance logging features and update dependencies for stackdog - #35

Merged
vsilent merged 142 commits into
devfrom
main
Nov 16, 2026
Merged

vsilent merged 142 commits into
devfrom
main

Conversation

@vsilent

@vsilent vsilent commented Nov 16, 2026

Copy link
Copy Markdown

No description provided.

vsilent and others added 30 commits March 31, 2026 09:52
* Testing (#9)

* upload artifacts

* upload artifacts

* syntax fix

* try another approach

* list files



* Update README.md

* Add editorconfig. Append gitignore fot emacs

* editorconfig

* Update README.md

* Update actix requirement from 0.10 to 0.11 (#18)

Updates the requirements on [actix](https://github.com/actix/actix) to permit the latest version.
- [Release notes](https://github.com/actix/actix/releases)
- [Commits](actix/actix@actix-v0.11.0-beta.3...v0.11.1)





* Update actix-cors requirement from 0.3.0 to 0.5.4 (#19)

Updates the requirements on [actix-cors](https://github.com/actix/actix-extras) to permit the latest version.
- [Release notes](https://github.com/actix/actix-extras/releases)
- [Commits](actix/actix-extras@cors-v0.3.0...cors-v0.5.4)





* Update bcrypt requirement from 0.8.2 to 0.9.0 (#17)

Updates the requirements on [bcrypt](https://github.com/Keats/rust-bcrypt) to permit the latest version.
- [Release notes](https://github.com/Keats/rust-bcrypt/releases)
- [Commits](Keats/rust-bcrypt@v0.8.2...v0.9.0)





* Update env_logger requirement from 0.7.1 to 0.8.3 (#16)

Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/master/CHANGELOG.md)
- [Commits](rust-cli/env_logger@v0.7.1...v0.8.3)





* Update bigdecimal requirement from 0.0.14 to 0.2.0 (#15)

Updates the requirements on [bigdecimal](https://github.com/akubera/bigdecimal-rs) to permit the latest version.
- [Release notes](https://github.com/akubera/bigdecimal-rs/releases)
- [Commits](akubera/bigdecimal-rs@v0.0.14...v0.2.0)





* Update actix-service requirement from 1.0.6 to 2.0.0 (#23)

Updates the requirements on [actix-service](https://github.com/actix/actix-net) to permit the latest version.
- [Release notes](https://github.com/actix/actix-net/releases)
- [Commits](actix/actix-net@service-v1.0.6...rt-v2.0.0)





* Bump codacy/codacy-analysis-cli-action from 2.0.1 to 3.0.1 (#24)

Bumps [codacy/codacy-analysis-cli-action](https://github.com/codacy/codacy-analysis-cli-action) from 2.0.1 to 3.0.1.
- [Release notes](https://github.com/codacy/codacy-analysis-cli-action/releases)
- [Commits](codacy/codacy-analysis-cli-action@2.0.1...84fbefe)





* Bump codacy/codacy-analysis-cli-action from 3.0.1 to 3.0.2 (#25)

Bumps [codacy/codacy-analysis-cli-action](https://github.com/codacy/codacy-analysis-cli-action) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/codacy/codacy-analysis-cli-action/releases)
- [Commits](codacy/codacy-analysis-cli-action@3.0.1...3.0.2)





* Bump actions/cache from 2.1.4 to 2.1.5 (#26)

Bumps [actions/cache](https://github.com/actions/cache) from 2.1.4 to 2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.4...v2.1.5)





* Bump codacy/codacy-analysis-cli-action from 3.0.2 to 3.0.3 (#28)

Bumps [codacy/codacy-analysis-cli-action](https://github.com/codacy/codacy-analysis-cli-action) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/codacy/codacy-analysis-cli-action/releases)
- [Commits](codacy/codacy-analysis-cli-action@3.0.2...3.0.3)





* Update actix requirement from 0.11 to 0.12 (#31)

Updates the requirements on [actix](https://github.com/actix/actix) to permit the latest version.
- [Release notes](https://github.com/actix/actix/releases)
- [Commits](actix/actix@v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: actix
  dependency-type: direct:production
...





* Bump actions/cache from 2.1.5 to 2.1.6 (#29)

Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.5...v2.1.6)





* Update bcrypt requirement from 0.9.0 to 0.10.0 (#32)

Updates the requirements on [bcrypt](https://github.com/Keats/rust-bcrypt) to permit the latest version.
- [Release notes](https://github.com/Keats/rust-bcrypt/releases)
- [Commits](Keats/rust-bcrypt@v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: bcrypt
  dependency-type: direct:production
...





* Bump codacy/codacy-analysis-cli-action from 3.0.3 to 4.0.0 (#35)

Bumps [codacy/codacy-analysis-cli-action](https://github.com/codacy/codacy-analysis-cli-action) from 3.0.3 to 4.0.0.
- [Release notes](https://github.com/codacy/codacy-analysis-cli-action/releases)
- [Commits](codacy/codacy-analysis-cli-action@3.0.3...4.0.0)

---
updated-dependencies:
- dependency-name: codacy/codacy-analysis-cli-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...





* Update env_logger requirement from 0.8.3 to 0.9.0 (#34)

Updates the requirements on [env_logger](https://github.com/env-logger-rs/env_logger) to permit the latest version.
- [Release notes](https://github.com/env-logger-rs/env_logger/releases)
- [Changelog](https://github.com/env-logger-rs/env_logger/blob/main/CHANGELOG.md)
- [Commits](rust-cli/env_logger@v0.8.3...v0.9.0)

---
updated-dependencies:
- dependency-name: env_logger
  dependency-type: direct:production
...





* Update bigdecimal requirement from 0.2.0 to 0.3.0 (#37)

Updates the requirements on [bigdecimal](https://github.com/akubera/bigdecimal-rs) to permit the latest version.
- [Release notes](https://github.com/akubera/bigdecimal-rs/releases)
- [Commits](akubera/bigdecimal-rs@v0.2.0...v0.3.0)

---
updated-dependencies:
- dependency-name: bigdecimal
  dependency-type: direct:production
...





* Update actix-tls requirement from 2.0.0 to 3.0.0 (vsilent#39)

Updates the requirements on [actix-tls](https://github.com/actix/actix-net) to permit the latest version.
- [Release notes](https://github.com/actix/actix-net/releases)
- [Commits](actix/actix-net@rt-v2.0.0...tls-v3.0.0)

---
updated-dependencies:
- dependency-name: actix-tls
  dependency-type: direct:production
...





* Remove unused imports, list docker containers added

* actix-web upgrade

* shell commands

* shell commands

* rustscan, openssl binaries added

* rustscan, openssl binaries added

* phase 1 files

* Broken, integrating bollard for container security check

* Update README with new logo and project details

Added a new logo image and updated the project description.

* Revise README with new images and title case

Updated image and title formatting in README.

* diesel replaced with r2d2 and rusqlite

* ebpf files

* refactoring, ebpf / containers

* feat(cli): add clap subcommands (serve/sniff) + sniff config

- Add clap 4 for CLI argument parsing
- Refactor main.rs: dispatch to serve (default) or sniff subcommand
- Create src/cli.rs with Cli/Command enums
- Create src/sniff/config.rs with SniffConfig (env + CLI args)
- Add new deps: clap, async-trait, reqwest, zstd
- Update .env.sample with sniff + AI provider config vars
- 12 unit tests (7 CLI parsing + 5 config loading)



* feat(sniff): log source discovery + database persistence

- Create src/sniff/discovery.rs: LogSource, LogSourceType, discovery
  functions for system logs, Docker containers, and custom paths
- Create src/database/repositories/log_sources.rs: CRUD for log_sources
  and log_summaries tables (follows existing alerts repository pattern)
- Add log_sources and log_summaries tables to init_database()
- Export docker module from lib.rs for reuse by sniff discovery
- 14 unit tests (8 discovery + 6 repository)



* feat(sniff): log reader trait + File/Docker/Journald implementations

- Create src/sniff/reader.rs with LogReader async trait and LogEntry struct
- FileLogReader: byte offset tracking, incremental reads, log rotation detection
- DockerLogReader: bollard-based container log streaming with timestamp filtering
- JournaldReader: journalctl subprocess (Linux-gated with #[cfg(target_os = "linux")])
- Add futures-util dependency for Docker log stream consumption
- 10 unit tests covering read, incremental, truncation, empty lines, metadata



* feat(sniff): AI log analysis with OpenAI and pattern backends

- Create src/sniff/analyzer.rs with LogAnalyzer trait
- OpenAiAnalyzer: single client for OpenAI/Ollama/vLLM/any compatible API
  sends batched logs to /chat/completions, parses structured JSON response
- PatternAnalyzer: fallback local analyzer using regex-free pattern matching
  detects error spikes, counts errors/warnings without external AI
- LogSummary and LogAnomaly types with serialization support
- JSON response parsing with graceful handling of partial LLM output
- 16 unit tests (prompt building, JSON parsing, pattern analysis, serialization)



* feat(sniff): consume mode — zstd compression, dedup, log purge

- Create src/sniff/consumer.rs with LogConsumer
- FNV hashing deduplication with configurable capacity (100k entries)
- zstd compression (level 3) with timestamped archive files
- File purge via truncation (preserves fd for syslog daemons)
- Docker log purge via /var/lib/docker/containers/ JSON log truncation
- Full consume pipeline: deduplicate → compress → purge → report stats
- ConsumeResult tracks entries_archived, duplicates_skipped, bytes_freed
- 13 unit tests (hashing, dedup, compression, purge, full pipeline)



* feat(sniff): reporter + orchestrator loop

- Reporter: converts LogSummary/LogAnomaly into Alerts using existing
  AlertManager infrastructure (route_by_severity, NotificationChannel)
- SniffOrchestrator: full discover → read → analyze → report → consume
  pipeline with continuous and one-shot modes
- Wire up run_sniff() in main.rs to use SniffOrchestrator
- Add events, rules, alerting, models modules to binary crate
- 7 new tests (reporter: 5, orchestrator: 3)



* feat(sniff): REST API for log sources and summaries

- GET /api/logs/sources — list discovered log sources
- POST /api/logs/sources — manually add a custom log source
- GET /api/logs/sources/{path} — get a single source
- DELETE /api/logs/sources/{path} — remove a source
- GET /api/logs/summaries — list AI summaries (optional source_id filter)
- Register routes in configure_all_routes
- 7 tests covering all endpoints



* docs: update CHANGELOG and README for sniff feature

- CHANGELOG: document all sniff additions (discovery, readers, AI
  analysis, consumer, reporter, orchestrator, REST API, deps)
- README: add log sniffing to key features, architecture diagram,
  project structure, CLI usage examples, REST API examples,
  and completed tasks list



* chore: remove task files from repo and gitignore



* feat: add curl-based binary installation

- install.sh: POSIX shell installer — detects Linux x86_64/aarch64,
  downloads from GitHub Releases, verifies SHA256, installs to
  /usr/local/bin
- release.yml: GitHub Actions workflow — builds Linux binaries on tag
  push using cross, creates release with tarballs + checksums
- README: add curl install one-liner to Quick Start

Usage:
  curl -fsSL https://raw.githubusercontent.com/vsilent/stackdog/dev/install.sh | sudo bash



* docs: fix ML module status — stub infrastructure, not in progress



* feat(cli): add --ai-model and --ai-api-url flags to sniff command

- Add --ai-model flag to specify AI model (e.g. qwen2.5-coder:latest)
- Add --ai-api-url flag to specify API endpoint URL
- Recognize "ollama" as AI provider alias (maps to OpenAI-compatible client)
- CLI args override env vars for model and API URL
- Log AI model and API URL at startup for transparency



* feat(sniff): add debug logging and robust LLM JSON extraction

- Add debug/trace logging across entire sniff pipeline:
  discovery, reader, analyzer, orchestrator, reporter
- Respect user RUST_LOG env var (no longer hardcoded to info)
- Improve LLM response JSON extraction to handle:
  markdown code fences, preamble text, trailing text
- Include raw LLM response in trace logs for debugging parse failures
- Show first 200 chars of failed JSON in error messages
- Add 5 tests for extract_json edge cases

Usage: RUST_LOG=debug stackdog sniff --once ...



* feat(alerting): implement real Slack webhook notifications

- Add --slack-webhook CLI flag to sniff command
- Read STACKDOG_SLACK_WEBHOOK_URL env var (CLI overrides env)
- Implement actual HTTP POST to Slack incoming webhook API
- Build proper JSON payloads with serde_json (color-coded by severity)
- Add reqwest blocking feature for synchronous notification delivery
- Wire NotificationConfig through SniffConfig → Orchestrator → Reporter
- Add STACKDOG_WEBHOOK_URL env var support
- Update .env.sample with notification channel examples
- Add 3 tests for Slack webhook config (CLI, env, override priority)

Usage:
  stackdog sniff --once --slack-webhook https://hooks.slack.com/services/T/B/xxx
  # or via env:
  export STACKDOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T/B/xxx



* Update docker.yml

---------

Co-authored-by: vsilent <jabberroid@gmail.com>
Co-authored-by: Evgeny Duzhakov <diaevd@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
install: fallback when latest release is missing
Updates the requirements on [candle-core](https://github.com/huggingface/candle) to permit the latest version.
- [Changelog](https://github.com/huggingface/candle/blob/main/CHANGELOG.md)
- [Commits](https://github.com/huggingface/candle/commits/0.10.0)

---
updated-dependencies:
- dependency-name: candle-core
  dependency-version: 0.10.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [rusqlite](https://github.com/rusqlite/rusqlite) to permit the latest version.
- [Release notes](https://github.com/rusqlite/rusqlite/releases)
- [Changelog](https://github.com/rusqlite/rusqlite/blob/master/Changelog.md)
- [Commits](rusqlite/rusqlite@v0.32.0...v0.39.0)

---
updated-dependencies:
- dependency-name: rusqlite
  dependency-version: 0.39.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… main and preserve current Docker, sniff, and runtime fixes.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* ebpf files

* refactoring, ebpf / containers

* feat(cli): add clap subcommands (serve/sniff) + sniff config

- Add clap 4 for CLI argument parsing
- Refactor main.rs: dispatch to serve (default) or sniff subcommand
- Create src/cli.rs with Cli/Command enums
- Create src/sniff/config.rs with SniffConfig (env + CLI args)
- Add new deps: clap, async-trait, reqwest, zstd
- Update .env.sample with sniff + AI provider config vars
- 12 unit tests (7 CLI parsing + 5 config loading)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): log source discovery + database persistence

- Create src/sniff/discovery.rs: LogSource, LogSourceType, discovery
  functions for system logs, Docker containers, and custom paths
- Create src/database/repositories/log_sources.rs: CRUD for log_sources
  and log_summaries tables (follows existing alerts repository pattern)
- Add log_sources and log_summaries tables to init_database()
- Export docker module from lib.rs for reuse by sniff discovery
- 14 unit tests (8 discovery + 6 repository)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): log reader trait + File/Docker/Journald implementations

- Create src/sniff/reader.rs with LogReader async trait and LogEntry struct
- FileLogReader: byte offset tracking, incremental reads, log rotation detection
- DockerLogReader: bollard-based container log streaming with timestamp filtering
- JournaldReader: journalctl subprocess (Linux-gated with #[cfg(target_os = "linux")])
- Add futures-util dependency for Docker log stream consumption
- 10 unit tests covering read, incremental, truncation, empty lines, metadata

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): AI log analysis with OpenAI and pattern backends

- Create src/sniff/analyzer.rs with LogAnalyzer trait
- OpenAiAnalyzer: single client for OpenAI/Ollama/vLLM/any compatible API
  sends batched logs to /chat/completions, parses structured JSON response
- PatternAnalyzer: fallback local analyzer using regex-free pattern matching
  detects error spikes, counts errors/warnings without external AI
- LogSummary and LogAnomaly types with serialization support
- JSON response parsing with graceful handling of partial LLM output
- 16 unit tests (prompt building, JSON parsing, pattern analysis, serialization)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): consume mode — zstd compression, dedup, log purge

- Create src/sniff/consumer.rs with LogConsumer
- FNV hashing deduplication with configurable capacity (100k entries)
- zstd compression (level 3) with timestamped archive files
- File purge via truncation (preserves fd for syslog daemons)
- Docker log purge via /var/lib/docker/containers/ JSON log truncation
- Full consume pipeline: deduplicate → compress → purge → report stats
- ConsumeResult tracks entries_archived, duplicates_skipped, bytes_freed
- 13 unit tests (hashing, dedup, compression, purge, full pipeline)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): reporter + orchestrator loop

- Reporter: converts LogSummary/LogAnomaly into Alerts using existing
  AlertManager infrastructure (route_by_severity, NotificationChannel)
- SniffOrchestrator: full discover → read → analyze → report → consume
  pipeline with continuous and one-shot modes
- Wire up run_sniff() in main.rs to use SniffOrchestrator
- Add events, rules, alerting, models modules to binary crate
- 7 new tests (reporter: 5, orchestrator: 3)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): REST API for log sources and summaries

- GET /api/logs/sources — list discovered log sources
- POST /api/logs/sources — manually add a custom log source
- GET /api/logs/sources/{path} — get a single source
- DELETE /api/logs/sources/{path} — remove a source
- GET /api/logs/summaries — list AI summaries (optional source_id filter)
- Register routes in configure_all_routes
- 7 tests covering all endpoints

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: update CHANGELOG and README for sniff feature

- CHANGELOG: document all sniff additions (discovery, readers, AI
  analysis, consumer, reporter, orchestrator, REST API, deps)
- README: add log sniffing to key features, architecture diagram,
  project structure, CLI usage examples, REST API examples,
  and completed tasks list

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: remove task files from repo and gitignore

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat: add curl-based binary installation

- install.sh: POSIX shell installer — detects Linux x86_64/aarch64,
  downloads from GitHub Releases, verifies SHA256, installs to
  /usr/local/bin
- release.yml: GitHub Actions workflow — builds Linux binaries on tag
  push using cross, creates release with tarballs + checksums
- README: add curl install one-liner to Quick Start

Usage:
  curl -fsSL https://raw.githubusercontent.com/vsilent/stackdog/dev/install.sh | sudo bash

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: fix ML module status — stub infrastructure, not in progress

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(cli): add --ai-model and --ai-api-url flags to sniff command

- Add --ai-model flag to specify AI model (e.g. qwen2.5-coder:latest)
- Add --ai-api-url flag to specify API endpoint URL
- Recognize "ollama" as AI provider alias (maps to OpenAI-compatible client)
- CLI args override env vars for model and API URL
- Log AI model and API URL at startup for transparency

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(sniff): add debug logging and robust LLM JSON extraction

- Add debug/trace logging across entire sniff pipeline:
  discovery, reader, analyzer, orchestrator, reporter
- Respect user RUST_LOG env var (no longer hardcoded to info)
- Improve LLM response JSON extraction to handle:
  markdown code fences, preamble text, trailing text
- Include raw LLM response in trace logs for debugging parse failures
- Show first 200 chars of failed JSON in error messages
- Add 5 tests for extract_json edge cases

Usage: RUST_LOG=debug stackdog sniff --once ...

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(alerting): implement real Slack webhook notifications

- Add --slack-webhook CLI flag to sniff command
- Read STACKDOG_SLACK_WEBHOOK_URL env var (CLI overrides env)
- Implement actual HTTP POST to Slack incoming webhook API
- Build proper JSON payloads with serde_json (color-coded by severity)
- Add reqwest blocking feature for synchronous notification delivery
- Wire NotificationConfig through SniffConfig → Orchestrator → Reporter
- Add STACKDOG_WEBHOOK_URL env var support
- Update .env.sample with notification channel examples
- Add 3 tests for Slack webhook config (CLI, env, override priority)

Usage:
  stackdog sniff --once --slack-webhook https://hooks.slack.com/services/T/B/xxx
  # or via env:
  export STACKDOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T/B/xxx

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Update docker.yml

* ci: upgrade deprecated GitHub Actions to v4

- actions/cache v2 → v4
- actions/upload-artifact v2 → v4
- actions/download-artifact v2 → v4
- actions/checkout v2 → v4
- docker/build-push-action v1 → v6 (+ docker/login-action v3)
- github/codeql-action/upload-sarif v1 → v3

Fixes: deprecated action versions causing workflow failures

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: modernize Docker CICD workflow

- Replace deprecated actions-rs/* with dtolnay/rust-toolchain + cargo commands
- Fix broken rustfmt/clippy steps (were using wrong action parameters)
- Use Swatinem/rust-cache for simpler, faster dependency caching
- Use ubuntu-latest runners instead of self-hosted
- Add Docker Buildx for improved image builds
- Trigger on PRs to main and dev (pushes :latest on every build)
- Use npm ci for deterministic frontend installs
- Add artifact retention-days: 1 to save storage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* build: switch to musl targets and rustls for portable binaries

- reqwest: use rustls-tls instead of native-tls (no OpenSSL dependency)
- release.yml: build x86_64/aarch64-unknown-linux-musl (static binaries)
- Dockerfile: update debian:buster-slim → bookworm-slim, drop libpq-dev

Statically linked binaries work on any Linux distro including Alpine.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: add pre-commit hook and apply cargo fmt

Add .githooks/pre-commit that runs:
- cargo fmt --all --check (strict, blocks commit)
- cargo clippy (shows warnings, blocks on compile errors)

Enable with: git config core.hooksPath .githooks

Also applies cargo fmt --all to fix existing formatting across codebase.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: resolve all clippy warnings

- Remove unused imports across 17 files
- Prefix unused variables/fields with underscore
- Implement Default trait instead of inherent default() methods (dedup, threat_scorer)
- Implement FromStr trait instead of inherent from_str() methods (AiProvider, LogSourceType)
- Replace Iterator::last() with next_back() on DoubleEndedIterator
- Derive Default for EbpfLoader instead of manual impl
- Remove useless .into() conversion in database connection
- Wrap too-many-arguments functions with param structs (SniffArgs, CreateLogSummaryParams)
- Replace filter_map(Some(...)) with map(...) in build_readers
- Replace manual find loop with Iterator::find
- Collapse nested if-let in signature_matcher
- Gate program_to_tracepoint with cfg for Linux+ebpf only
- Move api module to library crate, fix binary to import from library
- Fix pre-existing test_get_alerts_empty to init database
- Use std::io::Error::other() instead of Error::new(Other, e)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: use _pid consistently in get_process_comm

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: resolve clippy errors in Linux-only firewall modules

- Remove unused imports in nftables.rs, quarantine.rs
- Replace inherent to_string() with Display trait for NfTable
- Remove needless borrows in .args() calls (iptables.rs, nftables.rs)
- Prefix unused variables with underscore (response.rs)
- Add error() getter to ResponseLog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: remove redundant to_string() in format! args

NfTable implements Display, so format! uses it directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: convert NfTable to string before passing to args()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: bump VERSION.md to 0.2.0

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: resolve warnings in tests and examples

- Remove unused imports (AlertSeverity, AlertType, anyhow::Result, SyscallEvent, SyscallType)
- Prefix unused variables with underscore
- Fix EbpfLoader::default() test (returns value, not Result)
- Fix KernelVersionTooLow fields to use String not integer literals
- Remove unnecessary mut on enricher variables

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: restore mutable enricher in enrichment tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: align test mutability and silence unused ptrace events var

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(tests): clean remaining all-target warnings and invalid literal

- remove useless UID >= 0 assertion (u32)
- replace invalid u16 port overflow test with type-safety test
- remove redundant serde_json import
- fix cfg-sensitive unused vars in enrichment tests
- clean monitor test vars in syscall monitor unit tests
- remove unused TestRule in rules engine tests
- use from_ref instead of cloned slice in sniff discovery test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: restore used enrichment vars and silence ptrace unused vars

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: handle non-linux unused vars in enrichment tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: fix ebpf loader creation assertion for linux builds

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: use valid 64-char hex container ID in enrichment test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* ci: fallback to npm install when web lockfile is missing

Use npm ci only when web/package-lock.json exists to avoid EUSAGE in CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: add webpack config with TS entrypoint for dashboard build

Fix CI frontend build fallback to default ./src entry by defining explicit
entry ./src/index.tsx and html template.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: fix dashboard import paths and TypeScript build errors

- Correct component imports from ../../services|types to ../services|types
- Fix react-bootstrap Alert alias in ContainerList
- Add explicit typed mappings for alert/container badge variants
- Type websocket stats callback payload
- Import fireEvent in ThreatMap tests
- Improve WebSocket test mock shape to satisfy TS
- Expose ApiService.api for existing tests

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* log: show API URL instead of dashboard bind address

- Replace misleading "Web Dashboard" startup line
- Show user-facing API URL and map 0.0.0.0 -> 127.0.0.1 for display

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: default API/WS endpoints to APP_PORT or 5555

- Inject APP_PORT and REACT_APP_API_PORT into webpack env
- API service default: http://localhost:${port}/api (port from env, fallback 5555)
- WS service default: ws://localhost:${port}/ws (port from env, fallback 5555)

Fixes frontend trying to connect to hardcoded port 5000.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: normalize container API payloads to prevent runtime crashes

Handle both snake_case and camelCase fields for containers API responses,
with safe defaults for missing nested fields (securityStatus/networkActivity).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: fix threat statistics endpoint path

Use /threats/statistics to match backend routes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: guard ThreatMap against missing stats buckets

Handle absent byType/bySeverity in API responses to prevent runtime
Object.entries(undefined) crashes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: restore CSS injection and degrade gracefully without WS endpoint

- Use style-loader + css-loader for .css files (fix dashboard styling)
- Add css/style loader deps to web package
- WebSocket service now falls back to REST-only mode when /ws is unavailable
  to avoid noisy reconnect/error spam in dev

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: add left sidebar navigation to dashboard layout

- Introduce Sidebar component with Overview/Threats/Alerts/Containers links
- Update App layout to include sidebar + main dashboard content
- Add section anchors in Dashboard for sidebar navigation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* web: move logo to sidebar and add top actions bar

- Move logo into sidebar at 39x39 (30% larger than 30x30)\n- Remove "Stackdog Security Dashboard" header text\n- Add top bar with right-aligned actions menu button (...)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* install: fallback when latest release is missing

- Handle GitHub /releases/latest 404 gracefully\n- Fallback to most recent release entry\n- Improve install usage examples to main branch URL

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix: avoid panic on malformed .env

- Make .env loading non-fatal in main\n- Print warning and continue with existing environment\n- Ensures stackdog --help works even with malformed .env

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: update README and changelog for installer/env fixes

- README: switch install script examples to main and v0.2.1\n- CHANGELOG: document non-fatal .env loading and installer fallback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Limit sniff analyzer prompts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add live mail abuse guard

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* iptables & nftables

* multiple updates, eBPF, container API quality is improved

* tests, ip_ban engine implemented, frontend dashboard improvements

* logs, containers in ui, ports, ws

* context.to_string()

* clippy fix

* clippy fix

* clippy fix

* ip_ban::engine::tests

* GLIBC_2.39 not found fix, using musl

* docker files

* multi stage build

* The problem was cross build reusing the default target directory, which already contained host-built build-script binaries. Now  musl build uses its own isolated target di

* mount docker.sock to stackdog container

* Audit, analyze syslog, new detectors, sniff command enriched

* Audit, analyze syslog, new detectors, sniff command enriched

---------

Co-authored-by: vsilent <jabberroid@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Updated repository links from 'vsilent' to 'trydirect' in installation and development instructions.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Removed PostgreSQL and Adminer services, updated Stackdog service configuration.
…2.24+, tracing-subscriber to 0.3.23, and replaces unmaintained dotenv with dotenvy 0.15.7; src/main.rs was updated to load env files through dotenvy
Removed PostgreSQL and Adminer services, updated Stackdog service configuration.
Updates the requirements on [netlink-packet-route](https://github.com/rust-netlink/netlink-packet-route) to permit the latest version.
- [Release notes](https://github.com/rust-netlink/netlink-packet-route/releases)
- [Changelog](https://github.com/rust-netlink/netlink-packet-route/blob/main/CHANGELOG)
- [Commits](rust-netlink/netlink-packet-route@v0.17.0...v0.29.0)

---
updated-dependencies:
- dependency-name: netlink-packet-route
  dependency-version: 0.29.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Updates the requirements on [aya-obj](https://github.com/aya-rs/aya) to permit the latest version.
- [Release notes](https://github.com/aya-rs/aya/releases)
- [Changelog](https://github.com/aya-rs/aya/blob/main/RELEASE.md)
- [Commits](aya-rs/aya@aya-obj-v0.1.0...aya-obj-v0.2.1)

---
updated-dependencies:
- dependency-name: aya-obj
  dependency-version: 0.2.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
robotizeit and others added 28 commits November 9, 2026 13:56
…unts

SSHole (CVE-2026-123158) is an OpenSSH authentication bypass on musl
with PAM disabled, Alpine's default server included: a 257-1024 byte
password makes the hash attempt fail, the failure reads as the same '*'
the account stores, and the login succeeds. Fixed in OpenSSH 10.6p2.

- vuln.sshole flags openssh-server builds older than 10.6p2 in the apk
  package database, on the host and in running containers: apk is the
  musl half of the vulnerable configuration. The PAM flavor and glibc
  distributions are not affected and are not reported. Alert only: a
  version names no attacker.
- ssh.password-login alerts on password logins to key-only accounts
  (root, alpine by default; STACKDOG_SSHOLE_KEYONLY_USERS extends the
  list) and feeds the ban engine: Alpine's own incident guidance is to
  hunt exactly these lines. One offense per line, repeats numbered so
  the registry counts them.
- STACKDOG_SSHOLE_ENABLED=false turns both off; the version check reads
  package databases through the same host-root mount as the PHP checks.

Docs: README subsection, CHANGELOG, .env.sample, and an
/am-i-affected style page at /sshole-check with an in-browser version
check (ssh -V plus the platform conditions), wired into sitemap and
footer.

Tests: 468+8+108 pass, clippy -D warnings and fmt clean, website build
15/15.
One password login to a key-only account is already a foothold: waiting
for the five-offense threshold hands the intruder time to switch the
monitoring off. OffenseInput gains an immediate flag, and
ssh.password-login sets it, so the first line bans the address. The gate
still runs first: allowlisted and protected addresses are never touched.

The exposure alerts now say what defends the box until the upgrade, so
the Slack message is actionable on arrival: vuln.sshole names the
first-line ban on password logins to key-only accounts, vuln.php2shell
names the out-of-memory bans, the webshell scan and session.upload_
progress.enabled = 0.

Tests: an end-to-end attack simulation on captured fixtures (Alpine
3.20's openssh 9.7_p1-r6 apk database and a real sshd login line from a
lab container) walks exposure finding, log findings and the ban to an
active block; a new test proves one line bans and the allowlist still
holds. 469+8+108 pass, clippy -D warnings and fmt clean, website 15/15.
The two SSHole ban tests unwrapped apply_ip_ban, which panics on a Linux
runner without root: the nftables backend fails with 'Operation not
permitted' before the block is recorded. Mirror the existing pattern in
test_apply_ip_ban_blocks_and_emits_alert_after_repeated_anomalies: on
Linux without root, accept that error and skip the block assertions; the
detection assertions still run everywhere. macOS keeps asserting the
ban end to end.
feat: detect SSHole exposure, ban password logins to key-only accounts, and say what defends the box until the upgrade
ci: post published releases to Discord via webhook
Two new alert channels, routed exactly like Slack (Critical, High,
Medium):

- Discord (STACKDOG_DISCORD_WEBHOOK_URL): plain content messages under
  the webhook's own name and avatar, truncated to Discord's 2000
  character limit on a UTF-8 boundary.
- Telegram (STACKDOG_TELEGRAM_BOT_TOKEN + STACKDOG_TELEGRAM_CHAT_ID):
  plain text through the Bot API sendMessage, truncated to the 4096
  character limit. No parse_mode, so alert content can never break the
  request by looking like markup. Both values are required; a partial
  config does not enable the channel.

Telegram is alerts only: action notifications (bans, quarantines) are
deliberately routed away from it, and the channel list documents that.

Revives tests/alerting/, which tests/integration.rs never included: four
files of tests never compiled or ran. Added mod alerting;, fixed the one
compile error (async send without await), and cleaned the warnings the
dead code had accumulated.

Tests: 470+8+155 pass (was 469+8+108; +3 Discord, +3 Telegram integration
tests, +1 unit test for the partial Telegram config, +44 revived).
clippy -D warnings and fmt clean.
- repository pointed at vsilent/stackdog; the repo lives at
  trydirect/stackdog. Adds homepage and documentation (stackdog.app).
- exclude web/, website/ and ebpf/ from the package: the workspace root
  is the repo root, and the published artifact is the server binary, not
  two frontend trees and a sibling crate.
Configuration resolution, nearest first: real environment variables,
then ./.env in the working directory, then ~/.config/stackdog/.env
($XDG_CONFIG_HOME/stackdog/.env when set). dotenvy never overrides an
already-set variable, so the nearest file wins. A missing file is no
longer a warning: every setting has a default.

stackdog init writes the starter config to the config directory and
never overwrites an existing file, since it holds credentials. The
template is the repo's .env.sample, embedded in the binary so it works
for cargo install and brew, where no sample file sits next to the
binary.

Verified by hand against a throwaway HOME: init creates the file, a
second run reports it exists and leaves it alone. 469+8+108 tests pass,
clippy -D warnings and fmt clean.
feat: add Discord and Telegram notification channels
chore: fix crates.io metadata and trim the package
# Conflicts:
#	CHANGELOG.md

Co-authored-by: vsilent <42473+vsilent@users.noreply.github.com>
feat: read config from ~/.config/stackdog and add stackdog init
Two shapes in main.rs the runner's rustfmt formats differently: the
HOME fallback closure stays broken across lines, and the closing
println fits on one line. Verified with cargo fmt --check exit codes
rather than output tails this time.
Two shapes in main.rs the runner's rustfmt formats differently: the
HOME fallback closure stays broken across lines, and the closing
println fits on one line. Verified with cargo fmt --check exit codes
rather than output tails this time.
style: match the format check's rustfmt output
style: match the format check's rustfmt output
vuln.cve-watch closes the gap the two CVE-specific detectors leave: a
CVE published tonight is checked on the next refresh without a Stackdog
release. Every package on the host and in running containers is matched
against OSV, and results are cross-referenced with CISA's KEV catalog.

Feed work, all verified against the live APIs while building:
- OSV matches Debian and Ubuntu versions server-side (the full deb
  version, epoch included); Alpine versions must be sent without the
  -rN package revision, which is what their data carries. querybatch
  does one request per refresh instead of one per package.
- CISA's canonical KEV URL rejects datacenter clients (403), so the
  cisagov/kev-data mirror is tried first. KEV entries are Critical;
  everything else carries the advisory's own severity label.
- Answers are cached in SQLite for 24h (surviving restarts), and a
  match is alerted once per owner, package and CVE.

The blocking HTTP runs on a blocking thread via a process-wide monitor:
reqwest::blocking panics when its runtime is dropped inside an async
context, which is how the sniff loop calls this. KEV is fetched only
when something matched.

Findings are alert-only (vuln.cve-watch joins the never-ban list): a
version names no attacker. Alerts say to check the vendor's advisory —
distributions backport fixes, and config-dependent CVEs do not survive
being flattened into a version range. 50 findings per pass, KEV first.

Tests: 477+8+155 pass (7 new: apk revision stripping, os-release to
ecosystem mapping, CVE-alias preference, KEV severity, batch alignment,
inventory under a root, reported-never-again), plus an opt-in live test
against the real OSV API. clippy -D warnings and fmt clean.
feat: match the package inventory against public CVE feeds
On a fresh box stackdog firewall list died with a backtrace: both
backends shelled out to list rules for a table/chain that does not exist
yet and bailed on the error. Nothing being banned is an empty list, not
a failure. Caught while scripting a lab demo on a clean container; the
production box never showed it because its rules already existed.
The macro expands to #[must_use] fns returning Result; rustc 1.99's
clippy flags the duplication. Scoped allow on the two traits.
/monitoring-stack-security-events: the dev.to article as the canonical
copy — the three events (PHP2Shell, SSHole, CVE watch) and the layers
they taught the stack, install commands with copy buttons, the split-
screen demo GIF (real captured output: webshell dropped, requests from a
known scanner address, five offenses, firewall DROP rule) and the
production firewall screenshot, honest limits, cross-links to the
checks and the fail2ban comparison.

Sitemap entry added; demo gif and terminal screenshot in public/. The
visible navigation link is added separately.
docs(website): add the monitoring-stack article with the live demo
Comment on lines +107 to +134
name: Dashboard Image Build & Push
runs-on: ubuntu-latest
# Independent of the Rust build: the dashboard is its own image, and there
# is no reason to wait on a cross-compile to publish it.
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# No build args: the image is generic and reads its API address from the
# environment at container start.
- name: Build and push dashboard
uses: docker/build-push-action@v6
with:
context: .
file: docker/ui/Dockerfile
push: ${{ github.event_name == 'push' }}
tags: |
trydirect/stackdog-ui:latest
trydirect/stackdog-ui:${{ github.sha }}
@vsilent
vsilent merged commit b8f79b0 into dev Nov 16, 2026
12 checks passed
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.

5 participants