Skip to content

[FEATURE] Security Phase 2 - PyTorch 2.6, Docker hardening, env migration - #443

Merged
POWERFULMOVES merged 12 commits into
PMOVES.AI-Edition-Hardenedfrom
feat/hardened-security-phase2
Jan 3, 2026
Merged

POWERFULMOVES merged 12 commits into
PMOVES.AI-Edition-Hardenedfrom
feat/hardened-security-phase2

Conversation

@POWERFULMOVES

Copy link
Copy Markdown
Owner

Summary

Rebased PR with 13 commits from `feat/hardened-security-phase2` not yet in hardened.

Changes

Security Hardening

Environment Migration (6-Tier Architecture)

Infrastructure Fixes

Documentation

Testing

```bash
docker compose -p pmoves config --quiet
curl -sf http://localhost:8080/healthz # Agent Zero
curl -sf http://localhost:8091/healthz # Archon
```

Related

POWERFULMOVES and others added 12 commits January 3, 2026 11:52
Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Phase 3 of env consolidation: LLM tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate tensorzero-ui to <<: *env-tier-llm
- Create env.tier-llm.example with all LLM provider API keys

CRITICAL: LLM tier is the ONLY tier with access to external API keys.
All other services call TensorZero internally, not providers directly.

Services in LLM tier:
- tensorzero-gateway: Already using <<: *env-tier-llm
- tensorzero-ui: Migrated from legacy env_file
- tensorzero-clickhouse: Uses inline env (no API keys needed)
- pmoves-ollama: Uses inline env (no API keys needed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Completes the 6-tier environment consolidation by migrating:

**Agent Tier (10 services):**
- mesh-agent, deepresearch, supaserch, consciousness-service
- archon-agent-work-orders, botz-gateway, publisher-discord
- messaging-gateway, jellyfin-bridge, chat-relay

**API Tier Additions (4 services):**
- postgrest-cli, hi-rag-gateway, hi-rag-gateway-gpu, hi-rag-gateway-v2-gpu

**Worker Tier (6 services) - included in this commit:**
- render-webhook, comfy-watcher, pdf-ingest, langextract
- notebook-sync, session-context-worker

**Media Tier (10 services) - included in this commit:**
- ultimate-tts-studio, flute-gateway, ffmpeg-whisper
- media-video, media-audio, channel-monitor
- invidious, invidious-companion, grayjay-plugin-host, grayjay-server

Security improvement: 30 services now use tier-based env_file anchors
instead of legacy x-env-legacy pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
…e pins, required password) (#355)

* docs: address PR review comments for env tier consolidation

- Add GPU Orchestrator and E2B Runner to services-catalog.md
- Add gpu-orchestrator to env.tier-api.example service list
- Create learnings file documenting 6-tier env architecture
- Add env.tier-*.example files for worker, media, agent tiers

Addresses nitpick comments from PRs #349-354.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(gpu): ensure GPU access for all CUDA-enabled services

- gpu-orchestrator: Add GPU deploy section + NVIDIA_VISIBLE_DEVICES
- ultimate-tts-studio: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-v2-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- media-audio: Change base image to nvidia/cuda:12.4.1-runtime-ubuntu22.04
  (was python:3.11-slim which caused silent CPU fallback)

This fixes silent CPU fallbacks where PyTorch CUDA packages were installed
but the CUDA runtime was not available in the container.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): production hardening - health checks and image pinning

Critical security and reliability fixes:

1. **POSTGRES_PASSWORD now required** - Changed from insecure default
   `:-pmoves` to required syntax `${VAR:?error}`. Compose will fail if
   POSTGRES_PASSWORD is not set (lines 59, 78, 937).

2. **Pinned 8 :latest images to specific versions:**
   - postgrest/postgrest:latest → v12.2.3
   - minio/minio:latest → RELEASE.2024-12-18T13-15-44Z
   - ollama/ollama:latest → 0.5.4
   - tensorzero/gateway:latest → 2024.12.18
   - tensorzero/ui:latest → 2024.12.18
   - invidious:latest → 2024.12.09
   - invidious-companion:latest → 2024.12.20
   - grayjay:latest → 2024.11.01

3. **Added health checks to 37 services** (52 total, up from 15):
   - Data tier: qdrant, meilisearch, minio
   - API tier: hi-rag-*, retrieval-eval, presign, render-webhook
   - Worker tier: extract-worker, pdf-ingest, langextract, notebook-sync,
     ffmpeg-whisper, media-video, media-audio, pmoves-yt, channel-monitor
   - Agent tier: agent-zero, mesh-agent, deepresearch, supaserch
   - TensorZero: gateway, ui, ollama
   - Others: publisher-discord, messaging-gateway, jellyfin-bridge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(health): address PR review critical issues

Fixes critical issues identified by PR review:

MinIO:
- Change health check from `mc ready local` to curl-based
  (minio/minio image doesn't include mc binary)

NATS:
- Add `-m 8222` flag to enable HTTP monitoring port
  (health check was targeting port that wasn't enabled)

Health checks:
- comfy-watcher: verify module imports instead of just `import sys`
- mesh-agent: verify main module and NATS client availability

Missing start_period:
- postgres: add 15s start_period
- chat-relay: add 30s start_period
- n8n-agent: add 30s start_period
- invidious-postgres: add 15s start_period

All 52 health checks now have start_period defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Increase Dockerfile hardening from 33/36 (91.7%) to 35/36 (97.2%):

- notebook-sync: Add USER pmoves (user creation already existed)
- vibevoice-realtime: Add full hardening with UID/GID 65532

Accepted exception: agent-zero uses root for initialization then
drops to pmoves via 'su' for the service process. This pattern is
required by upstream Agent Zero's prepare.py and /ins/copy_A0.sh.

Pattern reference: flute-gateway/Dockerfile

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Normalize Supabase Kong hostnames to lowercase (DNS convention)
- Remove duplicate ARCHON_SUPABASE_BASE_URL env var definition
- Fix notebook-sync Dockerfile: remove USER directive so entrypoint
  can run chown/su as root before dropping privileges
- Improve deepresearch _get_or_create_counter: use module-level cache
  to avoid private prometheus_client API dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Archon health check: Add Kong gateway hostname support for internal
  Docker networking (supabase_kong_pmoves.ai:8000)
- UI dashboard: Add /dashboard redirect page to /dashboard/services
- Grafana: Fix env var placeholders and job name mismatches in queries
- Docs: Add placeholder for Jellyfin service documentation

The Archon health check now properly handles both:
- Supabase CLI endpoint (host.docker.internal:65421)
- Internal Kong gateway (supabase_kong_pmoves.ai:8000)

This resolves the 404 errors in Archon health checks when using
internal Docker DNS names instead of host.docker.internal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add pmoves/data/agent-zero/ to gitignore. This directory contains
runtime settings (settings.json) that persist via Docker volume mount.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use registry lookup pattern instead of try/except for counter
registration. Prevents 'Duplicated timeseries' error when container
restarts with existing registry state.

Before: try/except around Counter() creation
After: REGISTRY._names_to_collectors.get() for existing lookup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add warning log to Supabase health check exception handler
- Improve persona fetch error logging with status code and truncated body
- Add metrics tracking for non-200 persona fetch responses

Closes #322

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Merged after rebase to resolve Jellyfin README conflict
- Add volume mount ./data/agent-zero/tmp:/a0/tmp for settings.json
  Root cause: PMOVES-Agent-Zero/python/helpers/settings.py:162 stores
  settings at /a0/tmp/settings.json but path was not mounted

- Normalize Archon SUPABASE_URL to lowercase supabase_kong_pmoves.ai
  Root cause: Docker DNS is case-sensitive on some configurations

- Fix archon-agent-work-orders health check: /healthz → /health
  Root cause: Service exposes /health, not /healthz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@POWERFULMOVES
POWERFULMOVES merged commit 572c073 into PMOVES.AI-Edition-Hardened Jan 3, 2026
2 of 3 checks passed
POWERFULMOVES added a commit that referenced this pull request Jan 18, 2026
…tion (#443)

* refactor(env): Phase 2 - Migrate API tier to env-tier-api anchor (#350)

Phase 2 of env consolidation: API tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate postgrest, presign, retrieval-eval to <<: *env-tier-api
- Create env.tier-api.example with secure defaults

API tier services receive data tier URLs and internal credentials only,
no external API keys (OPENAI_API_KEY, etc.)

Services migrated:
- postgrest: PostgREST database gateway
- presign: MinIO URL presigner
- retrieval-eval: Hi-RAG evaluation service

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(env): Phase 3 - Migrate LLM tier to env-tier-llm anchor (#351)

Phase 3 of env consolidation: LLM tier migration

Changes:
- Fix tier anchor syntax (block-style env_file with required: false)
- Migrate tensorzero-ui to <<: *env-tier-llm
- Create env.tier-llm.example with all LLM provider API keys

CRITICAL: LLM tier is the ONLY tier with access to external API keys.
All other services call TensorZero internally, not providers directly.

Services in LLM tier:
- tensorzero-gateway: Already using <<: *env-tier-llm
- tensorzero-ui: Migrated from legacy env_file
- tensorzero-clickhouse: Uses inline env (no API keys needed)
- pmoves-ollama: Uses inline env (no API keys needed)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(env): Phase 6 - Migrate agent tier + API additions (#354)

Completes the 6-tier environment consolidation by migrating:

**Agent Tier (10 services):**
- mesh-agent, deepresearch, supaserch, consciousness-service
- archon-agent-work-orders, botz-gateway, publisher-discord
- messaging-gateway, jellyfin-bridge, chat-relay

**API Tier Additions (4 services):**
- postgrest-cli, hi-rag-gateway, hi-rag-gateway-gpu, hi-rag-gateway-v2-gpu

**Worker Tier (6 services) - included in this commit:**
- render-webhook, comfy-watcher, pdf-ingest, langextract
- notebook-sync, session-context-worker

**Media Tier (10 services) - included in this commit:**
- ultimate-tts-studio, flute-gateway, ffmpeg-whisper
- media-video, media-audio, channel-monitor
- invidious, invidious-companion, grayjay-plugin-host, grayjay-server

Security improvement: 30 services now use tier-based env_file anchors
instead of legacy x-env-legacy pattern.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): GPU access + production hardening (health checks, image pins, required password) (#355)

* docs: address PR review comments for env tier consolidation

- Add GPU Orchestrator and E2B Runner to services-catalog.md
- Add gpu-orchestrator to env.tier-api.example service list
- Create learnings file documenting 6-tier env architecture
- Add env.tier-*.example files for worker, media, agent tiers

Addresses nitpick comments from PRs #349-354.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(gpu): ensure GPU access for all CUDA-enabled services

- gpu-orchestrator: Add GPU deploy section + NVIDIA_VISIBLE_DEVICES
- ultimate-tts-studio: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- hi-rag-gateway-v2-gpu: Add NVIDIA_VISIBLE_DEVICES env var
- media-audio: Change base image to nvidia/cuda:12.4.1-runtime-ubuntu22.04
  (was python:3.11-slim which caused silent CPU fallback)

This fixes silent CPU fallbacks where PyTorch CUDA packages were installed
but the CUDA runtime was not available in the container.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(security): production hardening - health checks and image pinning

Critical security and reliability fixes:

1. **POSTGRES_PASSWORD now required** - Changed from insecure default
   `:-pmoves` to required syntax `${VAR:?error}`. Compose will fail if
   POSTGRES_PASSWORD is not set (lines 59, 78, 937).

2. **Pinned 8 :latest images to specific versions:**
   - postgrest/postgrest:latest → v12.2.3
   - minio/minio:latest → RELEASE.2024-12-18T13-15-44Z
   - ollama/ollama:latest → 0.5.4
   - tensorzero/gateway:latest → 2024.12.18
   - tensorzero/ui:latest → 2024.12.18
   - invidious:latest → 2024.12.09
   - invidious-companion:latest → 2024.12.20
   - grayjay:latest → 2024.11.01

3. **Added health checks to 37 services** (52 total, up from 15):
   - Data tier: qdrant, meilisearch, minio
   - API tier: hi-rag-*, retrieval-eval, presign, render-webhook
   - Worker tier: extract-worker, pdf-ingest, langextract, notebook-sync,
     ffmpeg-whisper, media-video, media-audio, pmoves-yt, channel-monitor
   - Agent tier: agent-zero, mesh-agent, deepresearch, supaserch
   - TensorZero: gateway, ui, ollama
   - Others: publisher-discord, messaging-gateway, jellyfin-bridge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(health): address PR review critical issues

Fixes critical issues identified by PR review:

MinIO:
- Change health check from `mc ready local` to curl-based
  (minio/minio image doesn't include mc binary)

NATS:
- Add `-m 8222` flag to enable HTTP monitoring port
  (health check was targeting port that wasn't enabled)

Health checks:
- comfy-watcher: verify module imports instead of just `import sys`
- mesh-agent: verify main module and NATS client availability

Missing start_period:
- postgres: add 15s start_period
- chat-relay: add 30s start_period
- n8n-agent: add 30s start_period
- invidious-postgres: add 15s start_period

All 52 health checks now have start_period defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* security(dockerfile): Harden notebook-sync and vibevoice-realtime

Increase Dockerfile hardening from 33/36 (91.7%) to 35/36 (97.2%):

- notebook-sync: Add USER pmoves (user creation already existed)
- vibevoice-realtime: Add full hardening with UID/GID 65532

Accepted exception: agent-zero uses root for initialization then
drops to pmoves via 'su' for the service process. This pattern is
required by upstream Agent Zero's prepare.py and /ins/copy_A0.sh.

Pattern reference: flute-gateway/Dockerfile

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(infra): Address PR #345 CodeRabbit review comments

- Normalize Supabase Kong hostnames to lowercase (DNS convention)
- Remove duplicate ARCHON_SUPABASE_BASE_URL env var definition
- Fix notebook-sync Dockerfile: remove USER directive so entrypoint
  can run chown/su as root before dropping privileges
- Improve deepresearch _get_or_create_counter: use module-level cache
  to avoid private prometheus_client API dependency

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(infra): Archon Supabase connectivity and UI dashboard fixes

Changes:
- Archon health check: Add Kong gateway hostname support for internal
  Docker networking (supabase_kong_pmoves.ai:8000)
- UI dashboard: Add /dashboard redirect page to /dashboard/services
- Grafana: Fix env var placeholders and job name mismatches in queries
- Docs: Add placeholder for Jellyfin service documentation

The Archon health check now properly handles both:
- Supabase CLI endpoint (host.docker.internal:65421)
- Internal Kong gateway (supabase_kong_pmoves.ai:8000)

This resolves the 404 errors in Archon health checks when using
internal Docker DNS names instead of host.docker.internal.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* chore(gitignore): Exclude agent-zero runtime data directory

Add pmoves/data/agent-zero/ to gitignore. This directory contains
runtime settings (settings.json) that persist via Docker volume mount.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(deepresearch): Prometheus counter double-registration

Use registry lookup pattern instead of try/except for counter
registration. Prevents 'Duplicated timeseries' error when container
restarts with existing registry state.

Before: try/except around Counter() creation
After: REGISTRY._names_to_collectors.get() for existing lookup

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(flute-gateway): add logging to silent exception handlers (#323)

- Add warning log to Supabase health check exception handler
- Improve persona fetch error logging with status code and truncated body
- Add metrics tracking for non-200 persona fetch responses

Closes #322

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* docs: add comprehensive service documentation (#338)

Merged after rebase to resolve Jellyfin README conflict

* fix(compose): Agent Zero settings persistence and Archon hostname

- Add volume mount ./data/agent-zero/tmp:/a0/tmp for settings.json
  Root cause: PMOVES-Agent-Zero/python/helpers/settings.py:162 stores
  settings at /a0/tmp/settings.json but path was not mounted

- Normalize Archon SUPABASE_URL to lowercase supabase_kong_pmoves.ai
  Root cause: Docker DNS is case-sensitive on some configurations

- Fix archon-agent-work-orders health check: /healthz → /health
  Root cause: Service exposes /health, not /healthz

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES pushed a commit that referenced this pull request Feb 12, 2026
- Update error modal to show default 'docker compose up --build -d' command
- Add better organized note structure with bullet points
- Include profile-specific fallback example for existing users
- Update README Quick Start to show default command first
- Maintain backward compatibility guidance for profile users
@POWERFULMOVES
POWERFULMOVES deleted the feat/hardened-security-phase2 branch March 7, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant