7 Commits
Author SHA1 Message Date
Guillaume Meyer (The Opinionated Man)andGitHub eaf07b41f3 ci: add macOS to the test matrix (#152) 2026-08-18 12:19:25 -07:00
Guillaume Meyer (The Opinionated Man)andGitHub d4dd4735e9 fix: Windows setup_ctrlregen.ps1 torch install (probe published indices, keep CUDA torch) (#124)
Three independent failure modes from #117:

- $ErrorActionPreference 'Stop' + 2>$null on a native command aborts the
  script on torch's harmless stderr warnings (e.g. "Failed to initialize
  NumPy" when torch is installed before numpy). Run the probes through a
  new Invoke-NativeQuiet helper that lowers EAP to 'Continue' for the
  block and restores it afterwards.
- The wheel index tag was derived from the driver's CUDA version, e.g.
  cu131 for a 13.1 driver, which does not exist (HTTP 403) and silently
  fell back to the default index, i.e. the CPU build on Windows. Probe
  the published indices and pick the highest one <= driver that answers
  HTTP 200; cu126 is still forced below compute capability 7.5.
- Installing torch alone let requirements-ctrlregen.txt resolve torchvision
  from PyPI, and torchvision pins an exact torch, so pip replaced the +cu
  build with a +cpu one while the script still exited 0. Install torch AND
  torchvision together from the chosen index, and verify after the
  requirements install that torch.cuda.is_available() is true - if a GPU
  was detected but torch ends up CPU-only, warn loudly and exit non-zero.

Also add a CI step (windows-latest, pwsh) that parses the setup .ps1
scripts and asserts the post-install CUDA verification survives.

Fixes #117
2026-08-17 16:48:26 -07:00
Guillaume Meyer (The Opinionated Man)andGitHub 723627716c chore: add Ruff linting and formatting with CI enforcement (#103)
Introduce Ruff (pinned at 0.16.3) as the project linter + formatter and
enforce it in CI:

- requirements-dev.txt: pin ruff==0.16.3 (exact pins, no drift)
- ruff.toml: line-length 100, target py312; rule set E/F/W/I/UP/B/SIM/RUF/PLW/S
  with deliberate ignores (E501 for content strings, S603 for safe_arg
  subprocess calls, S101 asserts in tests) and per-file test ignores
- Makefile: add lint / format / lint-fix targets
- .github/workflows/ci.yml: add lint job (ruff check + format --check)
- .gitignore: whitelist ruff.toml

Also fix every finding the new gate surfaced so CI is green:
- 109+ auto-fixes from ruff --fix (import sorting, simplifications,
  unused vars, re.I aliases, etc.)
- explicit check=False on all subprocess.run calls (PLW1510)
- harden sitemap XML parsing: reject DTD/entity declarations (S314)
- replace hardcoded /tmp paths in tests with tmp_path (S108)
- narrow/annotate intentional bare excepts (S110/S112), bind loop vars
  in closures (B023), raise ... from None (B904), strict= for zip (B905)
- ruff format applied across service/ and tests/

Verified: ruff check + ruff format --check pass; 287 tests pass, 1 skip.
2026-08-16 17:32:40 -07:00
Guillaume Meyer (The Opinionated Man)andGitHub 55d4bdc9fc feat: split skill from service, add HTTP API and Docker distribution (#60)
* feat: split skill from service, add HTTP API and Docker distribution

The agent skill (skills/remove-ai-marks/) is now a code-free remote client:
all implementation moved to service/scripts/ and runs behind a stdlib HTTP
service (server.py) with /health, /capabilities, /inspect, /clean and a
dynamically generated OpenAPI 3.0.3 spec at /openapi.json.

- Move scripts/ and the backend Dockerfiles under service/
- server.py: JSON/base64 HTTP entrypoint with size caps, binary guard,
  atomic writes, loopback default, optional bearer auth
- Core Dockerfile (exiftool/qpdf/c2patool preinstalled) and a GHCR publish
  workflow for the core/markllm/markdiffusion images
- compose.yaml (wr-* services, harness/heavy profiles) + compose-check.sh
  to validate the running stack (exit code only)
- Fix markllm image build (tokenizers 0.22.2, CPU-only torch) and ctrlregen
  build (python:3.11 base for the 2023-era research pins)
- Fix markllm/markdiffusion harness images missing common.py at runtime

* docs: add .env.example and service configuration guide

* fix: disable chain-of-thought for openai-compatible Layer B rewrites

deepseek-v4-flash is a reasoning model: a one-line paraphrase burned 9,894
reasoning tokens (~100s) and hit the default timeout. Send
reasoning_effort=none by default for the openai-compatible backend
(--reasoning-effort / WATERMARKS_REWRITE_REASONING_EFFORT; 'off' omits the
parameter), cutting the same rewrite to ~1s / 12 tokens. Tested end-to-end
against api.deepseek.com.

* fix: sanitize client-supplied filename in HTTP service

CodeQL 'uncontrolled data in path expression' (server.py): a name like
'../../x' flowed into Path(tmpdir) / name, letting an upload escape the
request temp dir on write. Sanitize name to its basename in _decode_input
(_safe_name) and refuse any joined path whose parent is not the tmpdir at
the write sites (_tmp_path). Tests cover traversal names.

* chore: gitignore .env (contains local rewrite credentials)

* chore: deny-by-default gitignore and dockerignore; document compose env config

.gitignore and service/.dockerignore now exclude everything by default and
explicitly allow only what is publishable/needed: tracked source, docs,
tests, .github, and (for images) the service/scripts/ tree that every
Dockerfile COPYs. Root .dockerignore documents that all builds use service/
as context. README Configuration section now covers .env setup for docker
compose, host-side export for CLI runs, and the full variable table.
2026-08-14 15:42:48 -07:00
Guillaume Meyer (The Opinionated Man)andGitHub b4676e9e54 fix: finish Windows support (preexec_fn, symlink tests, Windows CI) (#23)
* fix: make subprocess and symlink tests Windows-compatible

- Gate preexec_fn (POSIX-only) so optional tools can run on Windows
- Skip symlink tests when the platform denies the privilege
- Add a Windows CI leg and a Windows CLI smoke run

* fix: use UTF-8 stdio and fail Windows smoke on first error

- Reconfigure stdin/stdout/stderr to UTF-8 so Windows redirected streams
  stop raising UnicodeEncodeError on invisible Unicode characters
- Chain the Windows smoke commands so a failing script fails the step
2026-08-13 07:16:13 -07:00
Guillaume Meyer (The Opinionated Man) fa81cbc23a fix: harden writes, HTTP client, CI supply chain, and resource caps
Security hardening from deep assessment:

- Writes: atomic temp+rename via safe_write_bytes/text (no symlink
  following, no partial in-place loss); backup_path for --in-place;
  umask-default modes; symlink destinations refused.
- rewrite_text: refuse redirects (no Authorization/key re-send to
  unvalidated hosts), default-deny loopback allowlist with explicit
  --allow-remote / WATERMARKS_REWRITE_ALLOW_REMOTE opt-in, http(s)-only
  schemes, --api-key argv flag removed (env-only).
- CI: SHA-pin actions (checkout v7.0.1, setup-python v7.0.0, codeql),
  permissions: contents: read, pinned requirements-dev.txt, pip-audit
  step; new CodeQL workflow.
- Scorer deps: bump Pillow 10.4.0 -> 12.3.0 (24 known CVEs); pip pinned
  in Dockerfile and setup_synthid.sh; Docker runs as unprivileged user.
- Resource caps: MAX_INPUT_BYTES 1GiB -> 256MiB, 64MiB stdin cap,
  zip budget 512MiB -> 128MiB, RLIMIT_AS/FSIZE on child processes.
- Tests: 18 new security regression tests (60 total, all passing).
2026-08-12 21:13:53 -07:00
guillaume 5f0997de88 chore: mirror tmon GitHub protection setup
Add CODEOWNERS and a CI job named test so the Protect main ruleset
can require code-owner review and a green status check.
2026-08-11 10:18:46 -07:00