Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
a9851a4
Testing (#9)
vsilent Mar 10, 2021
9d21449
Update README.md
vsilent Mar 10, 2021
4f22fac
Add editorconfig. Append gitignore fot emacs
diaevd Mar 12, 2021
ee745f2
editorconfig
diaevd Mar 12, 2021
f5f08cf
conflict resolved
Mar 23, 2021
4b35e9b
Update README.md
vsilent Mar 23, 2021
6e4ec6e
Update actix requirement from 0.10 to 0.11 (#18)
dependabot[bot] Mar 29, 2021
271da4d
Update actix-cors requirement from 0.3.0 to 0.5.4 (#19)
dependabot[bot] Mar 29, 2021
6b3d5a5
Update bcrypt requirement from 0.8.2 to 0.9.0 (#17)
dependabot[bot] Mar 29, 2021
5546dda
Update env_logger requirement from 0.7.1 to 0.8.3 (#16)
dependabot[bot] Mar 29, 2021
0bb944c
Update bigdecimal requirement from 0.0.14 to 0.2.0 (#15)
dependabot[bot] Mar 29, 2021
a26aa27
Update actix-service requirement from 1.0.6 to 2.0.0 (#23)
dependabot[bot] May 10, 2021
f8ad5e8
Bump codacy/codacy-analysis-cli-action from 2.0.1 to 3.0.1 (#24)
dependabot[bot] May 10, 2021
8c9fef1
Bump codacy/codacy-analysis-cli-action from 3.0.1 to 3.0.2 (#25)
dependabot[bot] May 17, 2021
25bae7f
Bump actions/cache from 2.1.4 to 2.1.5 (#26)
dependabot[bot] May 17, 2021
51f0797
Bump codacy/codacy-analysis-cli-action from 3.0.2 to 3.0.3 (#28)
dependabot[bot] Jun 16, 2021
290a8e0
Update actix requirement from 0.11 to 0.12 (#31)
dependabot[bot] Jun 16, 2021
339d5f7
Bump actions/cache from 2.1.5 to 2.1.6 (#29)
dependabot[bot] Jun 16, 2021
38871bf
Update bcrypt requirement from 0.9.0 to 0.10.0 (#32)
dependabot[bot] Jun 21, 2021
d67b5ed
Bump codacy/codacy-analysis-cli-action from 3.0.3 to 4.0.0 (#35)
dependabot[bot] Jul 26, 2021
d82371b
Update env_logger requirement from 0.8.3 to 0.9.0 (#34)
dependabot[bot] Jul 26, 2021
663d7b5
Update bigdecimal requirement from 0.2.0 to 0.3.0 (#37)
dependabot[bot] Aug 30, 2021
7c25842
Update actix-tls requirement from 2.0.0 to 3.0.0 (#39)
dependabot[bot] Dec 27, 2021
3e78c5e
Remove unused imports, list docker containers added
Feb 7, 2022
6820bd2
actix-web upgrade
Feb 9, 2022
2cdc782
shell commands
Jul 23, 2024
97b6a76
shell commands
Jul 23, 2024
2209637
rustscan, openssl binaries added
Jul 23, 2024
de2ec55
rustscan, openssl binaries added
Jul 23, 2024
728fe46
phase 1 files
Mar 14, 2026
dceae83
Broken, integrating bollard for container security check
Mar 16, 2026
bc49338
Update README with new logo and project details
vsilent Mar 16, 2026
f789f43
Revise README with new images and title case
vsilent Mar 17, 2026
f987859
diesel replaced with r2d2 and rusqlite
Mar 17, 2026
f750dce
Merge branch 'main' of https://github.com/vsilent/stackdog
Mar 17, 2026
e72c96b
ebpf files
Mar 17, 2026
8759564
refactoring, ebpf / containers
Mar 19, 2026
2f6db16
feat(cli): add clap subcommands (serve/sniff) + sniff config
Mar 30, 2026
27f3d6f
feat(sniff): log source discovery + database persistence
Mar 30, 2026
c9164c5
feat(sniff): log reader trait + File/Docker/Journald implementations
Mar 30, 2026
dc09c3e
feat(sniff): AI log analysis with OpenAI and pattern backends
Mar 30, 2026
b358eac
feat(sniff): consume mode — zstd compression, dedup, log purge
Mar 30, 2026
1658cc6
feat(sniff): reporter + orchestrator loop
Mar 30, 2026
2f38be3
feat(sniff): REST API for log sources and summaries
Mar 30, 2026
5f4b05c
docs: update CHANGELOG and README for sniff feature
Mar 30, 2026
ac3e579
Merge feature/sniff-logs: log discovery, AI analysis, archival
Mar 30, 2026
49b37aa
chore: remove task files from repo and gitignore
Mar 30, 2026
c8e5c90
feat: add curl-based binary installation
Mar 30, 2026
83cf1d2
docs: fix ML module status — stub infrastructure, not in progress
Mar 30, 2026
b2ffc0a
feat(cli): add --ai-model and --ai-api-url flags to sniff command
Mar 31, 2026
01942f8
feat(sniff): add debug logging and robust LLM JSON extraction
Mar 31, 2026
9504301
feat(alerting): implement real Slack webhook notifications
Mar 31, 2026
72d7515
Update docker.yml
vsilent Mar 31, 2026
cdaf42e
Dev (#90) (#91)
vsilent Mar 31, 2026
d364801
ci: upgrade deprecated GitHub Actions to v4
Mar 31, 2026
c4d222e
Merge pull request #1 from vsilent/dev
vsilent Mar 31, 2026
7112a0b
ci: modernize Docker CICD workflow
Mar 31, 2026
3973c53
build: switch to musl targets and rustls for portable binaries
Mar 31, 2026
4601763
chore: add pre-commit hook and apply cargo fmt
Mar 31, 2026
fa74035
fix: resolve all clippy warnings
Mar 31, 2026
cc4a9b2
fix: use _pid consistently in get_process_comm
Mar 31, 2026
db9e5c0
fix: resolve clippy errors in Linux-only firewall modules
Mar 31, 2026
a22ab6d
fix: remove redundant to_string() in format! args
Mar 31, 2026
431089b
fix: convert NfTable to string before passing to args()
Mar 31, 2026
ebf9310
chore: bump VERSION.md to 0.2.0
Mar 31, 2026
1cf2162
fix: resolve warnings in tests and examples
Mar 31, 2026
56dcd95
fix: restore mutable enricher in enrichment tests
Mar 31, 2026
7824052
fix: align test mutability and silence unused ptrace events var
Mar 31, 2026
77ed42a
fix(tests): clean remaining all-target warnings and invalid literal
Mar 31, 2026
f1ed8e7
fix: restore used enrichment vars and silence ptrace unused vars
Mar 31, 2026
f919cc9
fix: handle non-linux unused vars in enrichment tests
Mar 31, 2026
c8a2b84
test: fix ebpf loader creation assertion for linux builds
Mar 31, 2026
ad49047
test: use valid 64-char hex container ID in enrichment test
Mar 31, 2026
bc6967c
ci: fallback to npm install when web lockfile is missing
Mar 31, 2026
a9757d4
web: add webpack config with TS entrypoint for dashboard build
Mar 31, 2026
8d37e7b
web: fix dashboard import paths and TypeScript build errors
Mar 31, 2026
2cf69c4
log: show API URL instead of dashboard bind address
Mar 31, 2026
4229627
web: default API/WS endpoints to APP_PORT or 5555
Mar 31, 2026
f3b23e9
web: normalize container API payloads to prevent runtime crashes
Mar 31, 2026
3e6cae5
web: fix threat statistics endpoint path
Mar 31, 2026
a0508b0
web: guard ThreatMap against missing stats buckets
Mar 31, 2026
9366741
web: restore CSS injection and degrade gracefully without WS endpoint
Mar 31, 2026
99c85b1
web: add left sidebar navigation to dashboard layout
Mar 31, 2026
a6aac14
web: move logo to sidebar and add top actions bar
Mar 31, 2026
8bf0648
Merge pull request #2 from vsilent/dev
vsilent Mar 31, 2026
2f152b7
install: fallback when latest release is missing
Mar 31, 2026
d3500d4
Merge pull request #3 from vsilent/dev
vsilent Mar 31, 2026
4255698
fix: avoid panic on malformed .env
Mar 31, 2026
3ceb0a6
docs: update README and changelog for installer/env fixes
Mar 31, 2026
c216882
Limit sniff analyzer prompts
Apr 2, 2026
09a6bfc
Update candle-core requirement from 0.3 to 0.10 (#101)
dependabot[bot] Apr 2, 2026
10d00d8
Update rusqlite requirement from 0.32 to 0.39 (#99)
dependabot[bot] Apr 2, 2026
e17e57b
Merge pull request #4 from trydirect/dev
vsilent Apr 2, 2026
1101c5a
Add live mail abuse guard
Apr 3, 2026
83434cf
iptables & nftables
Apr 3, 2026
ca0944f
multiple updates, eBPF, container API quality is improved
Apr 3, 2026
c845579
tests, ip_ban engine implemented, frontend dashboard improvements
Apr 4, 2026
1c30685
logs, containers in ui, ports, ws
Apr 4, 2026
400a99f
context.to_string()
Apr 4, 2026
5ee1267
clippy fix
Apr 4, 2026
49d4488
clippy fix
Apr 4, 2026
d790554
clippy fix
Apr 4, 2026
c316f94
ip_ban::engine::tests
Apr 5, 2026
7e4c2ab
GLIBC_2.39 not found fix, using musl
Apr 6, 2026
5956f4d
docker files
Apr 6, 2026
e2c9a46
multi stage build
Apr 6, 2026
8437ada
The problem was cross build reusing the default target directory, wh…
Apr 6, 2026
b724897
mount docker.sock to stackdog container
Apr 6, 2026
cb6c405
Merge pull request #6 from vsilent/dev
vsilent Apr 6, 2026
1a6ed9b
Merge upstream main\n\nResolve merge conflicts after pulling upstream…
Apr 6, 2026
79ce963
Audit, analyze syslog, new detectors, sniff command enriched
Apr 7, 2026
3438805
Audit, analyze syslog, new detectors, sniff command enriched
Apr 7, 2026
b18befd
Merge pull request #7 from vsilent/feature/detectors
vsilent Apr 7, 2026
360a9c9
Feature/detectors (#103)
vsilent Apr 7, 2026
191be34
github action tests fix
Apr 7, 2026
5b14f69
Merge pull request #8 from vsilent/feature/detectors
vsilent Apr 7, 2026
1ca1909
Update README.md
vsilent Apr 8, 2026
0f9ca4c
Change repository references to 'trydirect'
vsilent Apr 8, 2026
1e0d022
Fix installer release repository
Apr 8, 2026
dfdd5a8
Merge branch 'main' of https://github.com/trydirect/stackdog
Apr 8, 2026
5b4a555
merge with trydirect/stackdog
Apr 8, 2026
1fbd568
notify on ban and quarantine
Apr 8, 2026
bfaf6f8
Refactor docker-compose to simplify services
vsilent Apr 9, 2026
f3a54b7
Resolved the cargo audit failures. Cargo.toml now pins reqwest to 0.1…
Apr 9, 2026
8eb54a0
Refactor docker-compose to simplify services (#106)
vsilent Apr 9, 2026
3f6f36d
Fix formatting and update contact information in README
vsilent Apr 9, 2026
466cb1b
Merge branch 'vsilent:main' into main
vsilent Apr 10, 2026
7a8ecd8
Update netlink-packet-route requirement from 0.17 to 0.29 (#94)
dependabot[bot] Apr 18, 2026
8445963
Update aya-obj requirement from 0.1 to 0.2 (#98)
dependabot[bot] Apr 18, 2026
3835a54
sniff on serve, can be disabled with STACKDOG_SERVE_SNIFF_ENABLED=false
Apr 18, 2026
062bf3b
Merge branch 'main' of https://github.com/vsilent/stackdog
Apr 18, 2026
f1ce8a8
Merge branch 'vsilent:main' into main
vsilent Apr 18, 2026
f4a69ed
notification filtering by severity
Apr 19, 2026
995a585
Merge branch 'main' of https://github.com/trydirect/stackdog
Apr 19, 2026
93b9284
build: embed git short hash in version string
Apr 19, 2026
1e4d0b2
ci: push image to vsilent/stackdog:latest with git hash baked in
Apr 19, 2026
8a6840a
stackdog website
robotizeit Jun 4, 2026
6b38f2d
merge fix
robotizeit Jun 4, 2026
fa300ea
fix docker image name
robotizeit Jun 5, 2026
c1a10df
webarchive probe detector
robotizeit Jun 25, 2026
1c24195
cargi fmt --all, clippy
robotizeit Jun 26, 2026
086643d
minimum severity reporter fix
robotizeit Jun 26, 2026
ef6f30f
ML-powered behavioral anomaly detector that learns normal log pattern…
robotizeit Jun 27, 2026
d139162
Fix install.sh pointing at wrong repo (vsilent → trydirect)
robotizeit Jul 16, 2026
4568910
Merge pull request #9 from trydirect/fix/install-repo
vsilent Jul 16, 2026
5c70444
style: fix rustfmt formatting in ml detector and bump version to 0.2.3
robotizeit Jul 21, 2026
ab871ee
/var/log/syslog gets read once from its saved offset, not 1.13 GB / 6…
robotizeit Aug 24, 2026
42c7aa5
Merge branch 'main' of github.com:trydirect/stackdog
robotizeit Aug 24, 2026
b688302
clippy error fix
robotizeit Aug 26, 2026
d78f43e
clippy error fix
robotizeit Aug 26, 2026
1ceb564
fix: deduplicate posture alerts and add trusted containers filter
robotizeit Aug 28, 2026
dbb986a
fmt
robotizeit Aug 28, 2026
1d4d6c2
fix: extract real IP from X-Forwarded-For for proxied attacks
robotizeit Aug 28, 2026
20b1444
chore: add truncated JSON repair tests, clean up test env vars
robotizeit Aug 28, 2026
be5fac5
chore: bump version to v0.2.4
robotizeit Aug 28, 2026
2b7d630
fix: dedup alerts by description only, not source+sample
robotizeit Aug 28, 2026
0030608
fix: ban IPs from AI-detected attacks, scan entries as fallback
robotizeit Aug 29, 2026
d054a08
Stackdog icon in slack
robotizeit Aug 31, 2026
919475a
feat: add tools module and ban-ip CLI command
robotizeit Aug 31, 2026
8be8299
feat: AI tool-use loop, suggested_action, ai_tools_enabled config
robotizeit Aug 31, 2026
ab9ef65
fix: remove dead IpBanEngine reference in ban_ip tool
robotizeit Aug 31, 2026
14bc5ee
cargo fmt --all applied
robotizeit Aug 31, 2026
8f8ddee
fix: stop AI token burn — skip boring logs, cooldown, no double fallback
robotizeit Aug 31, 2026
63cc2a4
style: rustfmt
robotizeit Aug 31, 2026
eb015af
new DEFAULT_ALERT_DEDUP_WINDOW_SECS set to 6 hours
robotizeit Sep 6, 2026
57876d1
StackDog CLI Version update. Release info
robotizeit Sep 6, 2026
3620e9e
add iptables/nftables to binary, exclude self continaer, ban IP fix
robotizeit Sep 9, 2026
6ad17b8
Use docker compose labels for self container identity
robotizeit Sep 9, 2026
5d579c4
fix: send tool_call_id back to the AI, add IP ban API
robotizeit Sep 9, 2026
051f2dc
fix: name containers by their name, not their hostname
robotizeit Sep 10, 2026
94121d9
Merge pull request #10 from trydirect/fix/self-ingestion-dedup-toolcalls
vsilent Sep 10, 2026
fcfdc26
fix: one release alert per address, not per offense row
robotizeit Sep 10, 2026
a19f82e
feat: STACKDOG_IP_BAN_ALLOWLIST, addresses that are never banned
robotizeit Sep 10, 2026
a755f60
fix: one offense row per (ip, source_type), with a real counter
robotizeit Sep 10, 2026
a7b3488
fix: report the offense tally to the AI, not the row count
robotizeit Sep 10, 2026
4d6b252
fix: stop banning browser versions, and say why a ban happened
robotizeit Sep 10, 2026
c7033c4
feat: link every notification to the alert in the dashboard
robotizeit Sep 10, 2026
5c8220e
chore: give docker-compose.app.yml the settings it was missing
robotizeit Sep 10, 2026
1da52f1
ci: publish trydirect/stackdog-ui, configured at run time
robotizeit Sep 10, 2026
f4d1a84
fix: stop banning bystanders
robotizeit Sep 10, 2026
7589691
docs: add an upgrading note to the README
robotizeit Sep 10, 2026
64ce416
fix: stop banning infrastructure, and make a wrong ban reversible
robotizeit Oct 26, 2026
221b442
chore: bump version to v0.2.5
robotizeit Oct 26, 2026
c615360
fix: repair the iptables rule check for the linux build
robotizeit Oct 26, 2026
bb72a5a
fix: hold AI bans to confirmed attacks, attribute alerts to a host
robotizeit Oct 27, 2026
5e1c064
chore: bump version to v0.2.6
robotizeit Oct 27, 2026
0a6abff
feat: detect PHP webshells and ban the clients driving them
robotizeit Oct 31, 2026
5186bbd
docs(website): add a PHP webshell detection page
robotizeit Oct 31, 2026
c6caac4
fix(php-shell): ban only on requests that cannot come from visitors
robotizeit Oct 31, 2026
74ca8ec
Merge pull request #11 from trydirect/feature/php-shell-detection
vsilent Oct 31, 2026
3139ff7
fix(detectors): match webshell probes in the request URL only
robotizeit Oct 31, 2026
38272b8
docs(website): add a PHP shell quick start page
robotizeit Oct 31, 2026
39a225a
chore: move the site domain to stackdog.app
robotizeit Oct 31, 2026
188da61
chore: bump version to v0.2.7
robotizeit Oct 31, 2026
bb0cae3
Merge pull request #12 from trydirect/fix/webshell-probe-quickstart-d…
vsilent Oct 31, 2026
4fb451f
feat: flag PHP builds exposed to PHP2Shell and alert on PHP worker cr…
robotizeit Oct 31, 2026
87308cb
chore: bump version to v0.2.8
robotizeit Oct 31, 2026
1ade237
Merge pull request #13 from trydirect/feature/php2shell-check
vsilent Oct 31, 2026
4450c89
feat: ban clients attempting PHP2Shell
robotizeit Oct 31, 2026
bd08830
chore: bump version to v0.2.9
robotizeit Oct 31, 2026
a5ab4cb
Merge pull request #14 from trydirect/feature/php2shell-attempt-ban
vsilent Oct 31, 2026
39fa82b
fix(website): serve sitemap.xml and robots.txt from Next.js
robotizeit Oct 31, 2026
1c915de
Merge pull request #15 from trydirect/fix/website-sitemap
vsilent Oct 31, 2026
232a612
feat(website): add PHP2Shell version check and fail2ban alternative p…
robotizeit Nov 1, 2026
9043482
Merge pull request #16 from trydirect/fix/website-sitemap
vsilent Nov 1, 2026
5c84a53
fix(web): keep pagination inside the card and make the logo visible
robotizeit Nov 2, 2026
396e197
Merge pull request #18 from trydirect/fix/ui-pagination-logo
vsilent Nov 2, 2026
23f953c
style(layout): polish responsive shell and sidebar navigation
VladimirSivac Nov 2, 2026
df3a231
style(alerts): improve responsive table actions and pagination
VladimirSivac Nov 2, 2026
1dc7b9a
style(overview): unify metrics cards and threat visualizations
VladimirSivac Nov 2, 2026
42b91bd
style(containers): polish status cards and security details dialogs
VladimirSivac Nov 2, 2026
cd90e6c
feat(ui): add sidebar collapse, scroll-spy navigation, and card align…
VladimirSivac Nov 2, 2026
c0de0a5
Merge pull request #19 from trydirect/fix/ui-polish
vsilent Nov 3, 2026
192023a
docs(website): add a security article for AI-built startups
robotizeit Nov 5, 2026
73a5cf1
Merge pull request #20 from trydirect/feat/website-ai-startup-security
vsilent Nov 5, 2026
f76990b
feat: detect SSHole exposure and ban password logins to key-only acco…
robotizeit Nov 9, 2026
a2d07df
feat: ban SSHole logins on the first line and name the interim defense
robotizeit Nov 9, 2026
35f3b05
fix(tests): tolerate the root-only firewall write on Linux CI
robotizeit Nov 9, 2026
677368f
Merge pull request #21 from trydirect/feat/sshole-detection
vsilent Nov 9, 2026
e272f2e
chore: bump version to v0.3.0
robotizeit Nov 9, 2026
ed962c9
Merge pull request #22 from trydirect/chore/bump-v0.3.0
vsilent Nov 9, 2026
e251fb0
ci: post published releases to Discord via webhook
robotizeit Nov 11, 2026
f3d2516
Merge pull request #23 from trydirect/chore/bump-v0.3.0
vsilent Nov 11, 2026
38729ab
feat: add Discord and Telegram notification channels
robotizeit Nov 12, 2026
10a85b3
chore: fix crates.io metadata and trim the package
robotizeit Nov 12, 2026
53a8b23
feat: read config from ~/.config/stackdog and add stackdog init
robotizeit Nov 13, 2026
64b4c5d
Merge pull request #24 from trydirect/feat/notification-channels
vsilent Nov 13, 2026
d5ca879
Merge pull request #25 from trydirect/feat/registry-publish
vsilent Nov 13, 2026
8a68660
Merge remote-tracking branch 'origin/main' into feat/xdg-config
Copilot Nov 13, 2026
71d887b
Merge pull request #26 from trydirect/feat/xdg-config
vsilent Nov 13, 2026
727cd3b
style: match the format check's rustfmt output
robotizeit Nov 13, 2026
d33d1f8
style: match the format check's rustfmt output
robotizeit Nov 13, 2026
558d1df
Merge pull request #27 from trydirect/fix/format-xdg-config
vsilent Nov 13, 2026
b9e4382
Merge pull request #28 from trydirect/feat/xdg-config
vsilent Nov 13, 2026
c451b4d
feat: match the package inventory against public CVE feeds
robotizeit Nov 13, 2026
9f887da
Merge pull request #29 from trydirect/feat/cve-watch
vsilent Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
140 changes: 138 additions & 2 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,2 +1,138 @@
APP_HOST=localhost
APP_PORT=5000
# Stackdog configuration.
# Copy to .env in the working directory, or to ~/.config/stackdog/.env
# (`stackdog init` writes this file there). Real environment variables and
# the nearer file win; everything here is optional and defaults are safe.

#APP_HOST=localhost
# in container
APP_HOST=0.0.0.0

APP_PORT=5000
DATABASE_URL=stackdog.db
RUST_BACKTRACE=full

# Log Sniff Configuration
#STACKDOG_LOG_SOURCES=/var/log/syslog,/var/log/auth.log,/var/log/nginx/access.log
#STACKDOG_SNIFF_INTERVAL=30
#STACKDOG_SNIFF_OUTPUT_DIR=./stackdog-logs/
#STACKDOG_SERVE_SNIFF_ENABLED=true

# AI Provider Configuration
# Supports OpenAI, Ollama (http://localhost:11434/v1), or any OpenAI-compatible API
# `stackdog serve` defaults to the local pattern analyzer unless you override this.
#STACKDOG_AI_PROVIDER=openai
#STACKDOG_AI_API_URL=http://localhost:11434/v1
#STACKDOG_AI_API_KEY=
#STACKDOG_AI_MODEL=llama3

# How long the same finding stays suppressed before it alerts again (seconds).
# Default 21600 (6h). Standing misconfigurations are re-detected every pass, so
# a short window means the same alert all day.
#STACKDOG_ALERT_DEDUP_WINDOW_SECS=21600

# Dashboard base URL. When set, every notification carries a link straight to
# the alert (<url>/#alerts/{id}). Point it at the UI container, not the API.
#STACKDOG_UI_URL=https://stackdog.example.com

# Notification Channels
# Slack: create an incoming webhook at https://api.slack.com/messaging/webhooks
#STACKDOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T.../B.../xxxxx
# Slack sender identity. Only honored by legacy custom-integration webhooks or a
# bot token with chat:write.customize; Slack-app webhooks use the app's own name
# and icon, which you set under Basic Information > Display Information.
#STACKDOG_SLACK_USERNAME=Stackdog
# Defaults to https://stackdog.app/stackdog-mark.png, falling back to the
# GitHub raw copy if that host does not answer. Setting this skips the probe.
#STACKDOG_SLACK_ICON_URL=https://stackdog.app/stackdog-mark.png
# Discord: create an incoming webhook in your channel settings
# (Edit Channel > Integrations > Webhooks). Alerts arrive as plain messages
# under the webhook's own name and avatar; Discord allows 2000 characters,
# longer alerts are truncated to fit.
#STACKDOG_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/.../...
# Telegram: create a bot with @BotFather, invite it to a channel or group, and
# set both values. Alerts only — action notifications (bans, quarantines) are
# not sent to Telegram. Telegram allows 4096 characters per message; longer
# alerts are truncated to fit.
#STACKDOG_TELEGRAM_BOT_TOKEN=123456789:AAF...
#STACKDOG_TELEGRAM_CHAT_ID=-1001234567890
# Generic webhook endpoint for alert notifications
#STACKDOG_WEBHOOK_URL=https://example.com/webhook
#STACKDOG_SMTP_HOST=smtp.example.com
#STACKDOG_SMTP_PORT=587
#STACKDOG_SMTP_USER=alerts@example.com
#STACKDOG_SMTP_PASSWORD=secret
#STACKDOG_EMAIL_RECIPIENTS=soc@example.com,oncall@example.com
# Identity shown as "Instance" in notifications — say which host sent the
# alert. Falls back to the machine hostname when unset; set this explicitly
# for stable names in a fleet.
#STACKDOG_NOTIFICATION_LABEL=prod-eu-1
#STACKDOG_NOTIFICATION_MIN_SEVERITY=critical
#
# Action notification toggles
#STACKDOG_NOTIFY_IP_BAN_ACTIONS=true

# Never ban these, whatever the logs say. Comma-separated, bare addresses or
# CIDR notation. Put load balancers, health checkers and VPN gateways here:
# banning them takes the service down with them. Empty by default.
#STACKDOG_IP_BAN_ALLOWLIST=167.233.9.19,10.0.0.0/8
# Ceiling on blocks per minute. A burst is far more often a misread log than a
# crowd of attackers; the ceiling caps the damage. 0 disables it.
#STACKDOG_IP_BAN_MAX_PER_MINUTE=10
# Whether findings written by the AI analyzer may trigger a ban. Detector-backed
# findings are unaffected. Set to false to ban only on deterministic detectors.
#STACKDOG_IP_BAN_FROM_AI_FINDINGS=true
# Never ban addresses of this host or its containers (interface addresses, docker
# network subnets). A DROP rule for one of those severs the service from itself.
# Off only to block a local address deliberately.
#STACKDOG_IP_BAN_PROTECT_LOCAL_IPS=true
#STACKDOG_NOTIFY_QUARANTINE_ACTIONS=true

# Mail abuse guard. The traffic heuristic alone matches ordinary HTTP/JSON
# chatter between microservices, so quarantine (a network disconnect) requires
# observed SMTP egress (ports 25/465/587 in the conntrack table) on top of it.
# A match without SMTP evidence is an alert. Set to false to quarantine on the
# traffic heuristic alone.
#STACKDOG_MAIL_GUARD_REQUIRE_SMTP=true

# PHP shell detection. Scans PHP files in web roots for webshell code and
# watches access logs for requests to them. A flagged file is an alert; a
# request that drives a shell (POST to PHP under an uploads/ URL, parameters
# sent to a flagged file) feeds the IP ban like any other detector finding.
# false turns off both the scan and the access-log detector.
#STACKDOG_PHPSHELL_ENABLED=true
# Host web roots to scan. Containers are found on their own (see below).
#STACKDOG_PHPSHELL_PATHS=/var/www
# Container name/image fragments that mark a PHP workload. Any container with
# something mounted at /var/www, /srv, /app or /usr/share/nginx/html is scanned
# as well, whatever its name.
#STACKDOG_PHPSHELL_CONTAINERS=php,wordpress,drupal,joomla,laravel,magento,apache,httpd
# Where the host filesystem is mounted when Stackdog runs in a container
# (- /:/host:ro). Needed to read host paths and container docroots.
#STACKDOG_HOST_ROOT=/host
#STACKDOG_PHPSHELL_SKIP_DIRS=vendor,node_modules,.git
#STACKDOG_PHPSHELL_MAX_FILE_BYTES=2097152
# Extra signatures, JSON: [{"id","description","pattern","weight":"strong|medium|weak"}]
#STACKDOG_PHPSHELL_SIGNATURES=/etc/stackdog/php-shell-signatures.json
# PHP2Shell (CVE-2026-109618, CVE-2026-109619): alert on PHP builds older than
# the fixed releases, on the host and in running containers. Alert only.
#STACKDOG_PHP_VERSION_CHECK_ENABLED=true
# SSHole (CVE-2026-123158): flag OpenSSH builds older than 10.6p2 on musl
# systems (Alpine's default sshd is the vulnerable configuration), and ban
# password logins to key-only accounts. That login line is what a successful
# SSHole attack leaves behind.
#STACKDOG_SSHOLE_ENABLED=true
# Accounts that should never accept a password login. Defaults to root,alpine.
#STACKDOG_SSHOLE_KEYONLY_USERS=root,alpine
# CVE watch: match every package on the host and in containers against the
# public feeds (OSV + CISA's KEV catalog) and alert once per package and CVE.
# Refreshed at least daily, which is what catches newly published CVEs.
#STACKDOG_CVE_WATCH_ENABLED=true

# ---------------------------------------------------------------------------
# Dashboard container (docker-compose.yml / docker-compose.app.yml)
# ---------------------------------------------------------------------------
# Host:port a browser uses to reach the API. Read by the dashboard container at
# start-up, so a restart is enough — no rebuild.
#STACKDOG_API_HOST=192.0.2.10:5000
# Port the dashboard is published on.
#STACKDOG_UI_PORT=3000
18 changes: 18 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
set -e

echo "🐕 Stackdog pre-commit: running cargo fmt..."
cargo fmt --all -- --check || {
echo "❌ cargo fmt failed. Run 'cargo fmt --all' to fix."
exit 1
}

echo "🐕 Stackdog pre-commit: running cargo clippy..."
cargo clippy 2>&1
CLIPPY_EXIT=$?
if [ $CLIPPY_EXIT -ne 0 ]; then
echo "❌ cargo clippy failed to compile. Fix errors before committing."
exit 1
fi

echo "✅ Pre-commit checks passed."
113 changes: 113 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Stackdog Security — Copilot Instructions

## What This Project Is

Stackdog is a Rust-based security platform for Docker containers and Linux servers. It collects events via eBPF syscall monitoring, runs them through a rule/signature engine and optional ML anomaly detection, manages firewall responses (nftables/iptables + container quarantine), and exposes a REST + WebSocket API consumed by a React/TypeScript dashboard.

## Workspace Structure

This is a Cargo workspace with two crates:
- `.` — Main crate (`stackdog`): HTTP server, all security logic
- `ebpf/` — Separate crate (`stackdog-ebpf`): eBPF programs compiled for the kernel (uses `aya-ebpf`)

## Build, Test, and Lint Commands

```bash
# Build
cargo build
cargo build --release

# Tests
cargo test --lib # Unit tests only (in-source)
cargo test --all # All tests including integration
cargo test --lib -- events:: # Run tests for a specific module
cargo test --lib -- rules::scorer # Run a single test by name prefix

# Code quality
cargo fmt --all
cargo clippy --all
cargo audit # Dependency vulnerability scan

# Benchmarks
cargo bench

# Frontend (in web/)
npm test
npm run lint
npm run build
```

## Environment Setup

Requires a `.env` file (copy `.env.sample`). Key variables:
```
APP_HOST=0.0.0.0
APP_PORT=5000
DATABASE_URL=stackdog.db
RUST_BACKTRACE=full
```

System dependencies (Linux): `libsqlite3-dev libssl-dev clang llvm pkg-config`

## Architecture

```
Collectors (Linux only) Rule Engine Response
eBPF syscall events → Signatures → nftables/iptables
Docker daemon events → Threat scoring → Container quarantine
Network events → ML anomaly det. → Alerting

REST + WebSocket API
React/TypeScript UI
```

**Key src/ modules:**

| Module | Purpose |
|---|---|
| `events/` | Core event types: `SyscallEvent`, `SecurityEvent`, `NetworkEvent`, `ContainerEvent` |
| `rules/` | Rule engine, signature database, threat scorer |
| `alerting/` | `AlertManager`, notification channels (Slack/email/webhook) |
| `collectors/` | eBPF loader, Docker daemon events, network collector (Linux only) |
| `firewall/` | nftables management, iptables fallback, `QuarantineManager` (Linux only) |
| `ml/` | Candle-based anomaly detection (optional `ml` feature) |
| `correlator/` | Event correlation engine |
| `baselines/` | Baseline learning for anomaly detection |
| `database/` | SQLite connection pool (`r2d2` + raw `rusqlite`), repositories |
| `api/` | actix-web REST endpoints + WebSocket |
| `response/` | Automated response action pipeline |

## Key Conventions

### Platform-Gating
Linux-only modules (`collectors`, `firewall`) and deps (aya, netlink) are gated:
```rust
#[cfg(target_os = "linux")]
pub mod firewall;
```
The `ebpf` and `ml` features are opt-in and must be enabled explicitly:
```bash
cargo build --features ebpf
cargo build --features ml
```

### Error Handling
- Use `anyhow::{Result, Context}` for application/binary code
- Use `thiserror` for library error types
- Never use `.unwrap()` in production code; use `?` with `.context("...")`

### Database
The project uses raw `rusqlite` with `r2d2` connection pooling. `DbPool` is `r2d2::Pool<SqliteConnectionManager>`. Tables are created with `CREATE TABLE IF NOT EXISTS` in `database::connection::init_database`. Repositories are in `src/database/repositories/` and receive a `&DbPool`.

### API Routes
Each API sub-module exports a `configure_routes(cfg: &mut web::ServiceConfig)` function. All routes are composed in `api::configure_all_routes`, which is the single call site in `main.rs`.

### Test Location
- **Unit tests**: `#[cfg(test)] mod tests { ... }` inside source files
- **Integration tests**: `tests/` directory at workspace root

### eBPF Programs
The `ebpf/` crate is compiled separately for the Linux kernel. User-space loading is handled by `src/collectors/ebpf/` using the `aya` library. Kernel-side programs use `aya-ebpf`.

### Async Runtime
The main binary uses `#[actix_rt::main]`. Library code uses `tokio`. Avoid mixing runtimes.
6 changes: 3 additions & 3 deletions .github/workflows/codacy-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ jobs:
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
- name: Run Codacy Analysis CLI
uses: codacy/codacy-analysis-cli-action@2.0.1
uses: codacy/codacy-analysis-cli-action@4.0.0
with:
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
# You can also omit the token and run the tools that support default configurations
Expand All @@ -41,6 +41,6 @@ jobs:

# Upload the SARIF file generated in the previous step
- name: Upload SARIF results file
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
42 changes: 42 additions & 0 deletions .github/workflows/discord-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Discord Release

on:
release:
types: [published]
workflow_dispatch:
inputs:
release_name:
description: Release title to post
required: true
release_body:
description: Release notes body to post
required: true
release_html_url:
description: Release URL to link in Discord
required: false

permissions:
contents: read

jobs:
notify-discord:
name: Post release to Discord
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: GitHub Releases to Discord
uses: SethCohen/github-releases-to-discord@v1
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
release_name: ${{ inputs.release_name }}
release_body: ${{ inputs.release_body }}
release_html_url: ${{ inputs.release_html_url }}
color: "2105893"
username: "Stackdog Releases"
content: ""
footer_title: "Changelog"
footer_timestamp: true
reduce_headings: true
remove_github_reference_links: true
Loading
Loading