Skip to content

feat(security): harden auth, validate .env, restrict DICOM access#5

Merged
Ambientwork merged 2 commits intomainfrom
feat/security
Mar 23, 2026
Merged

feat(security): harden auth, validate .env, restrict DICOM access#5
Ambientwork merged 2 commits intomainfrom
feat/security

Conversation

@Ambientwork
Copy link
Copy Markdown
Owner

What changed

Security hardening across docker-compose, Orthanc config, OHIF config, and setup script:

  • Credentials: Removed hardcoded password from docker-compose.yml — now read from .env with ?-syntax (fails fast if missing)
  • Port binding: All ports (HTTP 8042, DICOM 4242, Viewer 3000) bound to 127.0.0.1 — no external network exposure
  • Image pinning: Orthanc image pinned to 24.12.2 instead of :latest
  • DICOM restrictions: CheckCalledAet: true, DicomAlwaysAllowFind/Get/Move: false — only authenticated/registered modalities can query
  • Setup validation: .env validated for required vars, password strength (≥16 chars), port range (1024–65535), port uniqueness, weak password blocklist
  • Injection fix: Replaced eval with printf -v in setup.sh prompt function
  • OHIF: Enabled cross-origin warnings
  • Audit: Enabled LogExportedResources for DICOM export audit trail
  • Config mounts: orthanc.json and ohif-config.js mounted as read-only volumes

How to test

  1. cp .env.example .env — should fail docker compose up with "ORTHANC_PASSWORD must be set"
  2. ./scripts/setup.sh -n — generates valid .env with 24-char password, validates it
  3. Edit .env with password < 16 chars → setup.sh should reject it
  4. docker compose up -d — verify Orthanc responds on 127.0.0.1:8042 only
  5. Verify curl http://localhost:8042/system returns 401 (auth required)

Ambientwork and others added 2 commits March 23, 2026 14:10
…calhost

- Remove hardcoded credentials from docker-compose.yml, use .env variables
  with required-var syntax (ORTHANC_PASSWORD:?...)
- Pin Orthanc image to 24.12.2 instead of :latest (supply chain safety)
- Bind all ports (HTTP, DICOM, Viewer) to 127.0.0.1 (no external exposure)
- Add .env validation in setup.sh: required vars, password strength (>=16 chars),
  port range (1024-65535), port uniqueness, weak password blocklist
- Replace eval with printf -v in setup.sh prompt() (injection prevention)
- Enable CheckCalledAet in orthanc.json (only matching AE title accepted)
- Enable cross-origin warnings in OHIF config
- Mount orthanc.json and ohif-config.js as read-only volumes
- Healthcheck reads credentials from env vars instead of hardcoded values

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Restrict DicomAlwaysAllowFind/Get/Move/FindWorklist to false (require auth)
- Keep DicomAlwaysAllowEcho and DicomAlwaysAllowStore for scanner compatibility
- Enable LogExportedResources for audit trail
- Add encrypted backup support flag to backup.sh

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Ambientwork Ambientwork merged commit 85f452d into main Mar 23, 2026
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