Files
lg-smtv-mcp/flake.nix
T
kiskaadee 0bf2923edb
Core Architecture & Invariant CI / validate (pull_request) Successful in 16s
chore(deploy): harden systemd unit sandboxing and add automated verify test
- flake.nix: add pkgs.systemd to testTools (nativeCheckInputs and devShell
  packages) so systemd-analyze is hermetically available in both local dev
  and isolated Nix sandbox CI (Defect 1 / CR-03)
- deploy/lg-smtv-mcp.service: add StartLimitIntervalSec=60s and StartLimitBurst=5
  in [Unit] to prevent unbounded restart loops (CR-02); add safe sandboxing
  baseline in [Service] (NoNewPrivileges, PrivateTmp, UMask=0077, ProtectSystem=full,
  kernel/bus isolation directives, CapabilityBoundingSet=) dropping offline exposure
  score from 9.0 UNSAFE to 4.9 OK (CR-02, Issue #17)
- tests/test_deploy.py: add unit tests verifying template placeholders, directive
  presence, systemd-analyze verify exit code, and security exposure score reduction
  under 5.0 (CR-03)
- README.md: document adopted hardening baseline, score reduction (9.0 -> 4.9),
  and technical compatibility constraints that ruled out ProtectHome, ProtectSystem=strict,
  and PrivateNetwork (AC1, AC4)
2026-11-17 03:07:49 -05:00

69 lines
1.5 KiB
Nix

{
description = "LG Smart TV (webOS) MCP server and testing environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
ps = pkgs.python3Packages;
runtimeDeps = [
ps.websockets
ps.mcp
ps.pydantic
ps.asyncssh
ps.uvicorn
];
testDeps = [
ps.httpx
ps.pytest
ps.pytest-asyncio
];
testTools = [
pkgs.systemd
];
pythonEnv = pkgs.python3.withPackages (_: runtimeDeps ++ testDeps);
in
{
packages.${system}.default = ps.buildPythonApplication {
pname = "lg-smtv-mcp";
version = "0.1.0";
src = ./.;
pyproject = true;
build-system = [ ps.setuptools ];
dependencies = runtimeDeps;
nativeCheckInputs = [
ps.pytestCheckHook
pkgs.ruff
pkgs.pyright
] ++ testDeps ++ testTools;
preCheck = ''
ruff check .
ruff format --check .
pyright
'';
};
devShells.${system}.default = pkgs.mkShell {
packages = [
pythonEnv
pkgs.pyright
pkgs.ruff
] ++ testTools;
shellHook = ''
export PYTHONPATH="$PWD/src:${PYTHONPATH:-}"
if [ -d .git ] && [ -d .githooks ]; then
git config core.hooksPath .githooks
fi
'';
};
};
}