Skip to content

Commit 28382d7

Browse files
Add reproducible release path and cut v0.2.0 (#17)
* chore: add reproducible release path and cut v0.2.0 Add Dockerfile (multi-stage, distroless runtime) and GitHub Actions release-image.yml workflow to build and push container images on version tags. This closes the gap where v0.1.0's deployed binary predated its GitHub release by fifteen hours and did not correspond to any published artifact. Also: - Bump version from 0.1.0 to 0.2.0 across workspace - Add CHANGELOG.md documenting all changes since v0.1.0 - Update README.md version reference Docker build verified: - Binary version: rustunifimcp 0.2.0 - GLIBC requirement: 2.38 (LXC 981 has 2.41) CI verified: - cargo fmt --all -- --check: passed - cargo clippy --all-targets --locked -- -D warnings: passed - cargo build --workspace --locked: passed - cargo test --workspace --locked: 144 passed, 0 failed, 1 ignored Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * ci(security): make the Dockerfile's trivy claim true The new Dockerfile carries a comment, copied from rustsdcmcp, saying the missing HEALTHCHECK is "suppressed explicitly in .trivyignore.yaml (AVD-DS-0026) rather than silently, so the decision is reviewable". Neither the file nor any trivy scan existed in this repo. The comment claimed more rigour than was there — the same failure mode as the stale mecmcp version comments in the previous commit: an explanation true where it was written and false where it was pasted. Rather than weaken the comment, make it true. This repo now produces a container image for the first time, and every sibling scans its tree, so an unscanned one is a real gap rather than a documentation nit. Three pieces, because two of them are not enough: - `.trivyignore.yaml` — the AVD-DS-0026 statement, reworded for this repo. - `trivy.yaml` — `ignorefile: .trivyignore.yaml`. **This is load-bearing.** Trivy auto-discovers a plain `.trivyignore` but NOT `.trivyignore.yaml`; without this pointer the ignore file is silently inert and the scan still fails. Adding only the ignore file was tried first and did not work. - a `trivy` job in security.yml, matching rustsdcmcp's pinned action SHAs and trivy v0.70.0. Verified locally with trivy 0.70.0, the same version CI pins: before ignore wiring 1 failure DS-0026 (LOW) after exit 0, clean vulnerabilities 0 secrets 0 And checked the suppression is narrow rather than blanket: planting `USER root` in the Dockerfile is still caught as DS-0002 (HIGH) with the ignore active, then restored. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 4c96f63 commit 28382d7

9 files changed

Lines changed: 204 additions & 5 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release container image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v7
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v4
21+
22+
- name: Log in to GitHub Container Registry
23+
uses: docker/login-action@v4
24+
with:
25+
registry: ghcr.io
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Extract version from tag
30+
id: version
31+
run: |
32+
VERSION=${GITHUB_REF#refs/tags/v}
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "Building version: $VERSION"
35+
36+
- name: Build and push Docker image
37+
uses: docker/build-push-action@v7
38+
with:
39+
context: .
40+
push: true
41+
tags: |
42+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
43+
ghcr.io/${{ github.repository }}:latest
44+
labels: |
45+
org.opencontainers.image.title=rustunifimcp
46+
org.opencontainers.image.description=UniFi Network MCP server
47+
org.opencontainers.image.version=${{ steps.version.outputs.version }}
48+
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
49+
org.opencontainers.image.revision=${{ github.sha }}
50+
cache-from: type=gha
51+
cache-to: type=gha,mode=max
52+
platforms: linux/amd64

‎.github/workflows/security.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,14 @@ jobs:
7171

7272
- name: cargo-deny (bans + sources)
7373
run: cargo deny check bans sources
74+
75+
trivy:
76+
name: Trivy filesystem scan
77+
runs-on: ubuntu-24.04
78+
timeout-minutes: 10
79+
steps:
80+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
81+
- uses: aquasecurity/setup-trivy@81e514348e19b6112ce2a7e3ecbafe19c1e1f567 # v0.3.1
82+
with:
83+
version: v0.70.0
84+
- run: trivy fs --scanners vuln,misconfig,secret --exit-code 1 .

‎.trivyignore.yaml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
misconfigurations:
2+
- id: AVD-DS-0026
3+
paths:
4+
- "Dockerfile"
5+
statement: >-
6+
No HEALTHCHECK, deliberately. The runtime is distroless: it has no shell
7+
and no utilities, so a HEALTHCHECK command has nothing to execute. The
8+
only available exec-form probe would be re-running the server binary,
9+
which proves the file is executable and nothing about service health,
10+
while spawning a second process inside a container whose entire point is
11+
that it contains one. Container orchestrators supervise the process
12+
through the runtime instead. Same position as rustsdcmcp and
13+
RustJunosMCP.

‎CHANGELOG.md‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.2.0] - 2026-09-01
11+
12+
This is a **minor version** because it adds the reproducible release path (Dockerfile
13+
and GitHub Actions workflow) that v0.1.0 lacked. The binary running on LXC 981 at
14+
v0.1.0's tag date was built and installed by hand, predating the GitHub release artifact
15+
by fifteen hours. v0.2.0 closes that gap.
16+
17+
### Added
18+
19+
- **Dockerfile** for reproducible multi-stage builds, producing a distroless runtime
20+
image with no shell, no package manager, and only the server binary and libc.
21+
Builder and runtime both pinned to Debian 13 (trixie) to ensure glibc compatibility
22+
with LXC 981.
23+
- **GitHub Actions `release-image.yml` workflow** to build and push container images
24+
to `ghcr.io/fastrevmd-lab/rustunifimcp` on version tags.
25+
- **CI workflow** with format, clippy, build, and test steps.
26+
- **Security workflow** with gitleaks, cargo-audit, and cargo-deny checks.
27+
- **Dependabot** configuration for cargo and github-actions ecosystems, with
28+
mecmcp-* and dtolnay/rust-toolchain ignores.
29+
- **`deny.toml`** for supply-chain checks.
30+
- **`CLAUDE.md`** documenting that LXC 981 `prod-unifimcp` must run with
31+
`--lab-mode` to expose write tools in the single-operator homelab deployment.
32+
- **gitleaks allowlist** (`.gitleaks.toml`) for the fixture-scrub gate's two
33+
synthetic credentials in `rustunifimcp-core/tests/fixture_scrub_gate.rs`.
34+
35+
### Changed
36+
37+
- Re-pinned the `mecmcp-*` crates from `v0.20.0` to `v0.23.0`. 0.23.0 binds a
38+
change set's preview digest into its approval digest, so an approval now
39+
vouches for the exact preview a reviewer saw.
40+
- **`Atomicity` is now re-exported from `mecmcp-changeset`** instead of being
41+
defined locally. A local duplicate would be a distinct type that shared code
42+
could not accept, defeating the point of declaring the guarantee.
43+
`UnifiTransaction::atomicity()` returns `Atomicity::live_writes()`.
44+
- Updated `rcgen` from 0.14.9 to 0.14.10.
45+
46+
### Fixed
47+
48+
- **Three changeset tests now guard on `fixtures_available()`** instead of
49+
calling `fixture()` directly. The tests pass on a developer machine but
50+
failed on a fresh clone because `rustunifimcp-core/tests/fixtures/*/` is
51+
gitignored. A missing fixture is now an un-run test, not a failing one.
52+
- **`a_top_level_api_key_is_rejected_at_load_time` is no longer ignored.**
53+
It covers a security invariant — an `api_key` at the inventory envelope level
54+
must not be silently accepted — and was the only test for it. Enabled because
55+
`CanonicalEnvelope` in mecmcp 0.23.0 now carries `#[serde(deny_unknown_fields)]`.
56+
57+
[unreleased]: https://github.com/fastrevmd-lab/rustunifimcp/compare/v0.2.0...HEAD
58+
[0.2.0]: https://github.com/fastrevmd-lab/rustunifimcp/releases/tag/v0.2.0

‎Cargo.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ members = [
66
resolver = "3"
77

88
[workspace.package]
9-
version = "0.1.0"
9+
version = "0.2.0"
1010
edition = "2024"
1111
rust-version = "1.88"
1212
license = "MIT"
1313
repository = "https://github.com/fastrevmd-lab/rustunifimcp"
1414
authors = ["fastrevmd-lab"]
1515

1616
[workspace.dependencies]
17-
rustunifimcp-core = { path = "rustunifimcp-core", version = "0.1.0" }
17+
rustunifimcp-core = { path = "rustunifimcp-core", version = "0.2.0" }
1818

1919
anyhow = "1"
2020
async-trait = "0.1"

‎Dockerfile‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# UniFi Network MCP server container image
2+
#
3+
# Multi-stage build producing a distroless image with no shell and no external
4+
# binaries. The runtime has no package manager, no shell, and no GNU userland —
5+
# only libc and the statically-linked server binary.
6+
#
7+
# Builder glibc generation must be ≤ runtime generation: Debian 13 (trixie) on
8+
# both sides satisfies this. Building on a newer base (Debian 14+) would link
9+
# against a newer glibc that the Debian 13 runtime does not carry.
10+
11+
# Builder stage: Debian 13 slim with Rust 1.98
12+
# Pinned to the amd64 digest resolved on 2026-08-25.
13+
FROM rust:1.98-slim-trixie@sha256:17d1ba895198f9934c6314ec5346a0d5115372f3243390c3d731e242f35c2f27 AS builder
14+
15+
WORKDIR /build
16+
17+
# Install build dependencies
18+
RUN apt-get update && \
19+
apt-get install -y --no-install-recommends \
20+
pkg-config \
21+
libssl-dev && \
22+
rm -rf /var/lib/apt/lists/*
23+
24+
# Copy workspace manifests first for better layer caching
25+
COPY Cargo.toml Cargo.lock ./
26+
COPY rustunifimcp/Cargo.toml rustunifimcp/
27+
COPY rustunifimcp-core/Cargo.toml rustunifimcp-core/
28+
29+
# Create stub main.rs files to cache dependencies
30+
RUN mkdir -p rustunifimcp/src rustunifimcp-core/src && \
31+
echo 'fn main() {}' > rustunifimcp/src/main.rs && \
32+
echo '' > rustunifimcp-core/src/lib.rs && \
33+
cargo build --release && \
34+
rm -rf rustunifimcp/src rustunifimcp-core/src
35+
36+
# Copy source and build the real binary
37+
COPY rustunifimcp/ rustunifimcp/
38+
COPY rustunifimcp-core/ rustunifimcp-core/
39+
RUN touch rustunifimcp/src/main.rs rustunifimcp-core/src/lib.rs && \
40+
cargo build --release --locked
41+
42+
# Runtime stage: Distroless Debian 13 with nonroot user
43+
# Pinned to the amd64 digest resolved on 2026-08-24.
44+
FROM gcr.io/distroless/cc-debian13@sha256:9b615fff20e1a4fad29c2b30562580b212c7dd5e2225236735cca0070ed11c78
45+
46+
# Run as nonroot user (UID 65532)
47+
USER 65532:65532
48+
49+
# No HEALTHCHECK: distroless has no shell and no utilities, so there is nothing
50+
# for a healthcheck command to run. Orchestrators supervise the process via the
51+
# container runtime. Suppressed explicitly in .trivyignore.yaml (AVD-DS-0026)
52+
# rather than silently, so the decision is reviewable.
53+
54+
# Copy the server binary
55+
COPY --from=builder /build/target/release/rustunifimcp /usr/local/bin/rustunifimcp
56+
57+
# Metadata
58+
LABEL org.opencontainers.image.title="rustunifimcp"
59+
LABEL org.opencontainers.image.description="UniFi Network MCP server"
60+
LABEL org.opencontainers.image.source="https://github.com/fastrevmd-lab/rustunifimcp"
61+
LABEL org.opencontainers.image.licenses="MIT"
62+
63+
ENTRYPOINT ["/usr/local/bin/rustunifimcp"]

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ configuration and nothing else, which makes it the real test of whether
3535

3636
**In production. The dependency on the legacy server is retired.**
3737

38-
`rustunifimcp` v0.1.0 serves the full surface — reads, workflows, operational
38+
`rustunifimcp` v0.2.0 serves the full surface — reads, workflows, operational
3939
actions, and change control — from LXC 981 over TLS, under two-person control.
4040
The `unifi-mcp-legacy` registration is gone; nothing routes to the Python
4141
server any more.

‎trivy.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Trivy reads this automatically when run from the repository root.
2+
ignorefile: .trivyignore.yaml

0 commit comments

Comments
 (0)