Skip to content

Commit 1a6ed9b

Browse files
author
vsilent
committed
Merge upstream main\n\nResolve merge conflicts after pulling upstream main and preserve current Docker, sniff, and runtime fixes.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents cdaf42e + cb6c405 commit 1a6ed9b

176 files changed

Lines changed: 11134 additions & 8240 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/pre-commit

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
set -e
3+
4+
echo "🐕 Stackdog pre-commit: running cargo fmt..."
5+
cargo fmt --all -- --check || {
6+
echo "❌ cargo fmt failed. Run 'cargo fmt --all' to fix."
7+
exit 1
8+
}
9+
10+
echo "🐕 Stackdog pre-commit: running cargo clippy..."
11+
cargo clippy 2>&1
12+
CLIPPY_EXIT=$?
13+
if [ $CLIPPY_EXIT -ne 0 ]; then
14+
echo "❌ cargo clippy failed to compile. Fix errors before committing."
15+
exit 1
16+
fi
17+
18+
echo "✅ Pre-commit checks passed."

.github/workflows/codacy-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
# Checkout the repository to the GitHub Actions runner
2323
- name: Checkout code
24-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2525

2626
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
2727
- name: Run Codacy Analysis CLI
@@ -41,6 +41,6 @@ jobs:
4141

4242
# Upload the SARIF file generated in the previous step
4343
- name: Upload SARIF results file
44-
uses: github/codeql-action/upload-sarif@v1
44+
uses: github/codeql-action/upload-sarif@v3
4545
with:
4646
sarif_file: results.sarif

.github/workflows/docker.yml

Lines changed: 64 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -2,161 +2,100 @@ name: Docker CICD
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- testing
5+
branches: [main, dev]
86
pull_request:
9-
branches:
10-
- master
7+
branches: [main, dev]
118

129
jobs:
13-
cicd-linux-docker:
14-
name: Cargo and npm build
15-
#runs-on: ubuntu-latest
16-
runs-on: [self-hosted, linux]
10+
build:
11+
name: Build & Test
12+
runs-on: ubuntu-latest
1713
steps:
18-
- name: Checkout sources
19-
uses: actions/checkout@v2
14+
- uses: actions/checkout@v4
2015

21-
- name: Install stable toolchain
22-
uses: actions-rs/toolchain@v1
16+
- name: Install Rust toolchain
17+
uses: dtolnay/rust-toolchain@stable
2318
with:
24-
toolchain: stable
25-
profile: minimal
26-
override: true
2719
components: rustfmt, clippy
20+
targets: x86_64-unknown-linux-musl
2821

29-
- name: Cache cargo registry
30-
uses: actions/cache@v2.1.6
31-
with:
32-
path: ~/.cargo/registry
33-
key: docker-registry-${{ hashFiles('**/Cargo.lock') }}
34-
restore-keys: |
35-
docker-registry-
36-
docker-
37-
38-
- name: Cache cargo index
39-
uses: actions/cache@v2.1.6
40-
with:
41-
path: ~/.cargo/git
42-
key: docker-index-${{ hashFiles('**/Cargo.lock') }}
43-
restore-keys: |
44-
docker-index-
45-
docker-
22+
- name: Cache Rust dependencies
23+
uses: Swatinem/rust-cache@v2
24+
25+
- name: Install cross
26+
run: cargo install cross --git https://github.com/cross-rs/cross
4627

4728
- name: Generate Secret Key
48-
run: |
49-
head -c16 /dev/urandom > src/secret.key
29+
run: head -c16 /dev/urandom > src/secret.key
5030

51-
- name: Cache cargo build
52-
uses: actions/cache@v2.1.6
53-
with:
54-
path: target
55-
key: docker-build-${{ hashFiles('**/Cargo.lock') }}
56-
restore-keys: |
57-
docker-build-
58-
docker-
59-
60-
- name: Cargo check
61-
uses: actions-rs/cargo@v1
62-
with:
63-
command: check
31+
- name: Check
32+
run: cargo check
6433

65-
- name: Cargo test
66-
if: ${{ always() }}
67-
uses: actions-rs/cargo@v1
68-
with:
69-
command: test
34+
- name: Format check
35+
run: cargo fmt --all -- --check
7036

71-
- name: Rustfmt
72-
uses: actions-rs/toolchain@v1
73-
with:
74-
toolchain: stable
75-
profile: minimal
76-
override: true
77-
components: rustfmt
78-
command: fmt
79-
args: --all -- --check
80-
81-
- name: Rustfmt
82-
uses: actions-rs/toolchain@v1
83-
with:
84-
toolchain: stable
85-
profile: minimal
86-
override: true
87-
components: clippy
88-
command: clippy
89-
args: -- -D warnings
90-
91-
- name: Run cargo build
92-
uses: actions-rs/cargo@v1
93-
with:
94-
command: build
95-
args: --release
37+
- name: Clippy
38+
run: cargo clippy -- -D warnings
39+
40+
- name: Test
41+
run: cargo test
42+
43+
- name: Build static release
44+
env:
45+
CARGO_TARGET_DIR: target-cross
46+
run: cross build --release --target x86_64-unknown-linux-musl
9647

97-
- name: npm install, build, and test
48+
- name: Build frontend
9849
working-directory: ./web
9950
run: |
100-
npm install
51+
if [ -f package-lock.json ]; then
52+
npm ci
53+
else
54+
npm install
55+
fi
10156
npm run build
102-
# npm test
10357
104-
- name: Archive production artifacts
105-
uses: actions/upload-artifact@v2
106-
with:
107-
name: dist-without-markdown
108-
path: |
109-
web/dist
110-
!web/dist/**/*.md
111-
112-
# - name: Archive code coverage results
113-
# uses: actions/upload-artifact@v2
114-
# with:
115-
# name: code-coverage-report
116-
# path: output/test/code-coverage.html
117-
- name: Display structure of downloaded files
118-
run: ls -R web/dist
119-
120-
- name: Copy app files and zip
58+
- name: Package app
12159
run: |
12260
mkdir -p app/stackdog/dist
123-
cp target/release/stackdog app/stackdog
124-
cp -a web/dist/. app/stackdog
61+
cp target-cross/x86_64-unknown-linux-musl/release/stackdog app/stackdog/
62+
cp -a web/dist/. app/stackdog/
12563
cp docker/prod/Dockerfile app/Dockerfile
126-
cd app
127-
touch .env
128-
tar -czvf ../app.tar.gz .
129-
cd ..
64+
touch app/.env
65+
tar -czf app.tar.gz -C app .
13066
131-
- name: Upload app archive for Docker job
132-
uses: actions/upload-artifact@v2.2.2
67+
- name: Upload build artifact
68+
uses: actions/upload-artifact@v4
13369
with:
134-
name: artifact-linux-docker
70+
name: app-archive
13571
path: app.tar.gz
72+
retention-days: 1
13673

137-
cicd-docker:
138-
name: CICD Docker
139-
#runs-on: ubuntu-latest
140-
runs-on: [self-hosted, linux]
141-
needs: cicd-linux-docker
74+
docker:
75+
name: Docker Build & Push
76+
runs-on: ubuntu-latest
77+
needs: build
14278
steps:
143-
- name: Download app archive
144-
uses: actions/download-artifact@v2
79+
- name: Download build artifact
80+
uses: actions/download-artifact@v4
14581
with:
146-
name: artifact-linux-docker
82+
name: app-archive
14783

148-
- name: Extract app archive
149-
run: tar -zxvf app.tar.gz
84+
- name: Extract archive
85+
run: tar -xzf app.tar.gz
15086

151-
- name: Display structure of downloaded files
152-
run: ls -R
87+
- name: Set up Docker Buildx
88+
uses: docker/setup-buildx-action@v3
15389

154-
- name: Docker build and publish
155-
uses: docker/build-push-action@v1
90+
- name: Login to Docker Hub
91+
uses: docker/login-action@v3
15692
with:
15793
username: ${{ secrets.DOCKER_USERNAME }}
15894
password: ${{ secrets.DOCKER_PASSWORD }}
159-
repository: trydirect/stackdog
160-
add_git_labels: true
161-
tag_with_ref: true
162-
#no-cache: true
95+
96+
- name: Build and push
97+
uses: docker/build-push-action@v6
98+
with:
99+
context: .
100+
push: true
101+
tags: trydirect/stackdog:latest

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ jobs:
1818
strategy:
1919
matrix:
2020
include:
21-
- target: x86_64-unknown-linux-gnu
21+
- target: x86_64-unknown-linux-musl
2222
artifact: stackdog-linux-x86_64
23-
- target: aarch64-unknown-linux-gnu
23+
- target: aarch64-unknown-linux-musl
2424
artifact: stackdog-linux-aarch64
2525

2626
steps:
@@ -36,12 +36,14 @@ jobs:
3636
run: cargo install cross --git https://github.com/cross-rs/cross
3737

3838
- name: Build release binary
39+
env:
40+
CARGO_TARGET_DIR: target-cross
3941
run: cross build --release --target ${{ matrix.target }}
4042

4143
- name: Package
4244
run: |
4345
mkdir -p dist
44-
cp target/${{ matrix.target }}/release/stackdog dist/stackdog
46+
cp target-cross/${{ matrix.target }}/release/stackdog dist/stackdog
4547
cd dist
4648
tar czf ${{ matrix.artifact }}.tar.gz stackdog
4749
sha256sum ${{ matrix.artifact }}.tar.gz > ${{ matrix.artifact }}.tar.gz.sha256

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ Cargo.lock
3333
# End of https://www.gitignore.io/api/rust,code
3434

3535
.idea
36+
*.db
3637
docs/tasks/
38+
web/node_modules/
39+
web/dist/

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- **CLI startup robustness**`.env` loading is now non-fatal.
13+
- `stackdog --help` and other commands no longer panic when `.env` is missing or contains malformed lines.
14+
- Stackdog now logs a warning and continues with existing environment variables.
15+
16+
- **Installer release resolution**`install.sh` now handles missing `/releases/latest` responses gracefully.
17+
- Falls back to the most recent release entry when no stable "latest" release is available.
18+
- Improves error messaging and updates install examples to use the `main` branch script URL.
19+
1020
### Added
1121

1222
#### Log Sniffing & Analysis (`stackdog sniff`)

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "stackdog"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Vasili Pascal <info@try.direct>"]
55
edition = "2021"
66
description = "Security platform for Docker containers and Linux servers"
@@ -48,13 +48,14 @@ r2d2 = "0.8"
4848
bollard = "0.16"
4949

5050
# HTTP client (for LLM API)
51-
reqwest = { version = "0.12", features = ["json", "blocking"] }
51+
reqwest = { version = "0.12", default-features = false, features = ["json", "blocking", "rustls-tls"] }
5252

5353
# Compression
5454
zstd = "0.13"
5555

5656
# Stream utilities
5757
futures-util = "0.3"
58+
lettre = { version = "0.11", default-features = false, features = ["tokio1", "tokio1-rustls-tls", "builder", "smtp-transport"] }
5859

5960
# eBPF (Linux only)
6061
[target.'cfg(target_os = "linux")'.dependencies]
@@ -78,6 +79,8 @@ ebpf = []
7879
# Testing
7980
tokio-test = "0.4"
8081
tempfile = "3"
82+
actix-test = "0.1"
83+
awc = "3"
8184

8285
# Benchmarking
8386
criterion = { version = "0.5", features = ["html_reports"] }

0 commit comments

Comments
 (0)