openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Security Audit Report (HEAVY SECURITY ISSUES) — May 2026

Open olliekirbyz548-ui opened this issue 6 months ago • 5 comments

🔐 OpenHuman Security Audit — May 2026 Triage summary: No RCE, no exposed secrets, no broken crypto.
The report surfaces 3 HIGH‑priority operational / supply‑chain items and a handful of medium/low hygiene improvements.
Estimated total fix time: ~1 day. Severity breakdown Severity 🔴 HIGH 🟡 MEDIUM 🔵 LOW ℹ️ INFO 🔴 H‑1: Pipe‑to‑shell installer lacks signature verification Impact: The recommended install command pipes directly to bash. If the GitHub raw‑content CDN were compromised (or a MITM on a non‑HTTPS network occurs), arbitrary code executes immediately with the user’s privileges — before any binary digest check can run.

current — no integrity check on the installer itself

curl -fsSL https://raw.githubusercontent.com/.../install.sh | bash Fix: Ship a detached GPG signature alongside the installer and document the verification step.

  • Generate a signing key for the release workflow.
  • Sign install.sh and install.ps1 during release.
  • Update README.md and the website to show the verified path: curl -fsSLO https://raw.githubusercontent.com/tinyhumansai/.../install.sh curl -fsSLO https://raw.githubusercontent.com/tinyhumansai/.../install.sh.asc gpg --verify install.sh.asc install.sh bash install.sh
  • Promote the platform‑native packages (Homebrew, .deb, Arch, MSI) as the primary install path — they already provide stronger integrity guarantees. CWE‑494 | MITRE ATT&CK T1195.002 — Download of Code Without Integrity Check 🔴 H‑2: pull_request_target in contributor‑rewards workflow Impact: .github/workflows/contributor‑rewards.yml uses the pull_request_target trigger, which runs in the base repository’s context with access to repo secrets. A fork PR author who understands the reward‑label mechanism could craft metadata that influences workflow behaviour. The workflow is partially mitigated by its limited permission set: permissions: contents: read # ✅ issues: write # ⚠️ allows commenting pull-requests: read # ✅ Because contents is read‑only and issues: write only allows posting comments, the blast radius is small — but pull_request_target remains a high‑risk trigger class that needs explicit justification. Fix:
  • Add a comment block at the top of the file explaining why pull_request_target is required here (the trigger needs to react to labels on PRs from forks).
  • Add an explicit input sanitization step before using context.payload.pull_request.user.login or target.htmlUrl in the script body:
  • // Sanitize: treat all PR metadata as untrusted display-only data
  • const safeLogin = String(target.login).replace(/[^\w-]/g, '').slice(0, 39); CWE‑1287 | GitHub Security Lab — “Keeping your GitHub Actions and workflows secure” 🔴 H‑3: CI pushes release commits directly to main Impact: The release‑production.yml workflow uses a GitHub App token (XGITHUB_APP_PRIVATE_KEY) to push version‑bump commits and annotated tags directly to main. This bypasses branch‑protection rules. If the App private key were leaked through a log, a compromised action, or a misconfigured runner, an attacker could push arbitrary commits to the default branch. Fix: This is a reasoned architectural choice; the fix is about operational hardening rather than removing the pattern.
  • Rotate XGITHUB_APP_PRIVATE_KEY on a fixed schedule (quarterly).
  • Add a second‑pair‑of‑eyes review step before the push:

New job before the push step

review-approval: runs-on: ubuntu-latest environment: Release-Approval # requires manual approver steps: - run: echo "Release approved"

  • Consider moving to a PR‑based release flow where CI opens a PR that a human merges, rather than pushing directly. This is the longer‑term gold standard. CWE‑250 | Execution with Unnecessary Privileges 🟡 M‑1: No CORS warning when core binds to 0.0.0.0 Impact: The Docker Compose file sets OPENHUMAN_CORE_HOST=0.0.0.0 but does not set OPENHUMAN_CORE_ALLOWED_ORIGINS. If a deployer forgets to configure CORS, the JSON‑RPC server may accept cross‑origin requests from arbitrary origins. Fix:
  • Add a startup‑time warning in src/openhuman/http_host/ when core_host != 127.0.0.1 and allowed_origins is empty.
  • Add a comment in docker-compose.yml next to the port mapping: ports:
    • "7788:7788"

⚠️ You must also set OPENHUMAN_CORE_ALLOWED_ORIGINS in .env to your

frontend origin(s) when deploying outside localhost. See .env.example.

CWE‑942 | Permissive Cross‑domain Policy 🟡 M‑2: redux-logger and debug in production dependencies Impact: redux‑logger logs every Redux action + state change. debug exposes namespaced console output. Both are in app/package.json dependencies (not devDependencies). In a Tauri production build, they could log JWTs, API responses, or user chat messages to the console. Fix:

  • Move redux-logger and debug to devDependencies and guard them: // Redux store config const middleware = [ ...(import.meta.env.DEV ? [require('redux-logger').default] : []), ];
  • Verify that Vite’s production build (tree‑shaking + dead‑code elimination) already strips them. If so, just move them to devDependencies for correctness. CWE‑532 | Insertion of Sensitive Information into Log File 🟡 M‑3: Installer silently degrades when python3 is unavailable Impact: scripts/install.sh requires python3 to parse latest.json. When it’s missing, the script falls back to the GitHub Releases API with a different parsing path that has less coverage (no platform‑specific asset resolution logic, weaker SHA256 handling). This is exactly the code path exercised on minimal Docker/cloud images. Fix:
  • Add python3 or jq to the prerequisite check at the top of the script.
  • If neither is available, fail early with a clear message instead of silently degrading: if ! command -v python3 >/dev/null 2>&1 && ! command -v jq >/dev/null 2>&1; then log_err "Either python3 or jq is required to parse release metadata." exit 1 fi CWE‑1104 | Use of Unmaintained / Missing Component 🟡 M‑4: .env.example exposes internal architecture detail Impact: The 300‑line .env.example documents Sentry project names, internal RPC port architecture, integration service names (Composio, Seltz, SearXNG, Matrix), Telegram bot usernames, and wallet chain defaults. This is a high‑signal reconnaissance target for attackers. Fix:
  • Move implementation‑detail comments (Sentry project names, internal port architecture, specific integration backend names) to docs/configuration.md.
  • Keep .env.example focused on user‑facing configurable values only.
  • Add a header disclaimer: “This file documents available configuration. Do not commit secrets. For architecture details, see docs/configuration.md.” CWE‑200 | Exposure of Sensitive Information 🟡 M‑5: Postinstall/prepare lifecycle hooks in root package.json Impact: "postinstall": "husky" and "prepare": "husky" run automatically on every pnpm install. If the husky package is compromised (registry attack, typosquatting, maintainer takeover), attackers gain code execution on every dev machine and CI runner. Mitigation in place: pnpm-lock.yaml pins the exact version + integrity hash, which prevents most registry‑level attacks. Fix:
  • Consider running CI installs with pnpm install --ignore-scripts and then running pnpm exec husky separately for hook setup.
  • Document the rationale in CONTRIBUTING.md so contributors understand the risk surface. CWE‑506 | Embedded Malicious Code 🔵 Low‑severity items

Finding

L1 Husky hooks are not cryptographically verified L2 openssl dgst in CI used for caching only — not a crypto issue L3 E2E workflow downloads npm deps during build ✅ What’s really good Area Verdict Crypto argon2id, aes‑256‑gcm, chacha20‑poly1305, x25519, noble‑curves — modern across Rust + TS Docker read_only: true, no‑new‑privileges, cap_drop: ALL, non‑root user, gosu drop, HEALTHCHECK — best‑in‑class CI/CD Pretest gating, automatic cleanup on failure, late :latest promotion, asset validation — production‑grade Secrets GitHub App tokens, Sentry DSNs in vars, OS‑level keychain — layered approach Disclosure SECURITY.md with safe harbour, defined scope, and expected SLA 📋 Checklist for the team High priority (blocking — fix this sprint)

  • H‑1: Ship GPG signature for install scripts + update docs
  • H‑2: Add comment justifying pull_request_target + sanitize PR metadata
  • H‑3: Rotate XGITHUB_APP_PRIVATE_KEY + add manual approval gate Medium priority (this month)
  • M‑1: Startup warning when CORS is unconfigured on non‑loopback binds
  • M‑2: Move redux‑logger + debug to devDependencies
  • M‑3: Fail early in installer when no JSON parser available
  • M‑4: Trim .env.example to user‑facing values only
  • M‑5: Document --ignore‑scripts option for CI Low priority (backlog)
  • L1: Document husky hook integrity expectations
  • L2: No action — caching only
  • L3: No action — acceptable build risk Report generated by automated security audit. No secrets were accessed or exfiltrated during the scan. All analysis was performed against publicly available repository metadata and source files via the GitHub API.

olliekirbyz548-ui avatar May 24 '26 18:05 olliekirbyz548-ui

Split the audit into child issues for tracking. Starting with the 3 HIGH plus 2 quick MEDIUM items; remaining MED + LOW items will be filed in a follow-up wave.

Audit ID Severity Sub-issue
H-1 🔴 #2620 — Add GPG signature verification to install scripts
H-2 🔴 #2621 — Harden pull_request_target in contributor-rewards workflow
H-3 🔴 #2622 — Add manual approval gate to release-production push-to-main
M-2 🟡 #2623 — Move redux-logger and debug to devDependencies
M-3 🟡 #2624 — Installer: fail early when neither python3 nor jq is available

Pending (next wave): M-1 (core 0.0.0.0 + CORS warn), M-4 (.env.example trim), M-5 (husky --ignore-scripts doc), L-1 (husky hook integrity docs).

L-2 and L-3 are no-action per the audit itself.

oxoxDev avatar May 25 '26 10:05 oxoxDev

Update on audit M-2 (#2623 → #2625):

After investigation, the original M-2 finding partially overstated. Closed #2623 and refiled the scoped change as #2625.

  • redux-logger is already guarded by IS_DEV in app/src/store/index.ts:175-178 — moving to devDeps is correctness cleanup. Tracked in #2625.
  • debug is load-bearing in production code (CoreStateProvider, ChatRuntimeProvider, voice/mascot features, tauriCommands/common.ts, ~10+ prod call sites). It is the project's primary namespaced logger and must stay in dependencies. The audit recommendation to move it would break production.

Updated audit-to-issue map:

Audit ID Severity Sub-issue
H-1 🔴 #2620 — Add GPG signature verification to install scripts
H-2 🔴 #2621 — Harden pull_request_target in contributor-rewards workflow
H-3 🔴 #2622 — Add manual approval gate to release-production push-to-main
M-2 🟡 #2625 — Move only redux-logger to devDependencies (supersedes #2623)
M-3 🟡 #2624 — Installer: fail early when neither python3 nor jq is available

Also a partial validation note on H-3 (#2622): release-production.yml:84 declares environment: Production, but the env's protection_rules only contain a branch_policy — no required_reviewers. So the audit's concern about no manual approver before the push is accurate; the env decoration alone doesn't gate it.

oxoxDev avatar May 25 '26 10:05 oxoxDev

Wave 1 PRs open (4 parallel, all GPG-signed):

Audit ID Sub-issue PR Branch Diff
H-1 (PR1) #2620 #2629 refactor/2620-readme-native-first README.md +43/-7
H-2 #2621 #2628 fix/2621-pr-target-sanitize contributor-rewards.yml +66/-9
M-2 #2625 #2630 refactor/2625-redux-logger-devdeps app/package.json + pnpm-lock.yaml
M-3 #2624 #2627 fix/2624-installer-python3-prereq install.sh +4/-1

Wave 2 (pending): #2622 release-approval gate → #2620 PR2 (GPG-signed install scripts + verified-install snippet).

Follow-ups surfaced during implementation:

  • #2630: redux-logger is STILL bundled into prod despite the IS_DEV runtime guard in app/src/store/index.ts:175-178 — Vite isn't tree-shaking the static import { createLogger } from 'redux-logger' at line 2. Pre-existing on main, orthogonal to the deps move. Worth a separate ticket for a dynamic-import or build-time strip.
  • #2629: gitbooks/developing/getting-set-up.md (L77-126) and docs/RELEASE-MANUAL-SMOKE.md (L26) still call curl | install.sh the "Primary install command" without an integrity warning — drifts from the new README guidance. Worth folding into PR2 of #2620.
  • #2629: Locale READMEs (de / ja-JP / ko / zh-CN) still promote curl | bash. Translator-friendly parity sweep needed.
  • #2627: A jq-backed parsing branch in install.sh would let it succeed on jq-only systems (current fix only enforces python3). Separate enhancement.

oxoxDev avatar May 25 '26 11:05 oxoxDev