Commit Graph

15 Commits

Author SHA1 Message Date
delta-cloud-208e
06057f864b fix(installers): 8 critical bugs from gpt-5.5 + glm-5.1 audit (Item 17)
Sub-agents reviewed all 26 installer scripts. Fixed (TDD):

BLOCKERS (install fails on platform):
1. claude/uclaude_uninstall.sh: replace `sed -i` → portable `sedi()` helper
   (BSD sed on macOS requires `-i ''`, GNU uses `-i`). Same fix style as
   codex/ucodex_install.sh:sedi.
2. claude/uclaude_install.ps1: abort if $apiKey null after fetch attempt
   (was silently completing install with broken auth env vars). Guard
   added to all 8 ps1 scripts.
3. qwen/uqwen_install.ps1 + uqwen_update.ps1: build trustedFolders.json
   via [ordered]@{} | ConvertTo-Json (PowerShell single-quoted literal
   was preserving `\"` as backslash+quote, producing INVALID JSON).
4. codex/ucodex_update.ps1: check $LASTEXITCODE after Python patcher call
   (native command non-zero exit doesn't throw under
   ErrorActionPreference='Continue' — patcher failure was silent, no
   PowerShell fallback triggered).

HIGH (wrong behavior / regressions):
5. gemini/ugemini_install.ps1 + update.ps1: read $env:UGEMINI_API_KEY
   FIRST (was only checking $env:UCLAUDE_API_KEY — claude variable).
6. gemini/ugemini_update.ps1: download gemini_config.json from PRIVATE
   unlimitedcoding-config (was downloading from public — would 404 after
   Item 14 sanitization).
7. claude/uclaude_update.ps1: drop ANTHROPIC_API_KEY assignment + dynamic
   models fetch (regression — install.ps1 was fixed earlier but update.ps1
   still set both env vars, re-introducing Auth conflict warning).
8. codex/ucodex_install.sh + update.sh: GitHub API curl needs
   `-H "User-Agent: UnlimitedCoding-Installer"` and `-f` flag (default
   curl/X.Y UA gets 403 from GitHub API + silent fail on 5xx).

Bonus fixes pulled in:
- codex/ucodex_install.ps1: switch codex_config download URL to private
  repo (consistency with update.ps1 + Item 14 sanitization)
- codex/ucodex_install.ps1: add `--all` flag to patcher invocation
  (matched between install + update)

Tests: tests/test_installer_bugs_audit.py — 9 GREEN regression guards.
Total: 186 tests GREEN.

Audit transcripts: gpt-5.5 found 24 issues (claude+gemini), glm-5.1
found 11 issues (codex+qwen). Lower-priority items (heredoc unsafe
quoting, lock files, schema validation) deferred to next iteration.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-25 17:16:43 +00:00
delta-cloud-208e
31f9c3e1a8 refactor(installers): extract PRIVATE_CONFIG_BASE in sh scripts (DRY) 2026-04-25 16:43:59 +00:00
delta-cloud-208e
8924b75e91 SECURITY: redact api_key from public repo (Variant B)
CRITICAL: api_key 'ClauderAPI2' was committed to PUBLIC unlimitedcoding
repo (private:False on gitea) in 4 *_config.json + 8 ps1 scripts. Anyone
on the internet could read it via curl with no auth (HTTP 200 raw access).

This commit:
1. Sanitizes 4 *_config.json: api_key → "YOUR_API_KEY" + _note pointing
   users to private config repo for production credentials.
2. Removes 'ClauderAPI2' literal from 8 ps1 installer/updater scripts
   (claude/codex/gemini/qwen × install/update). Each script now has a
   sanitized block at top that fetches api_key from private
   unlimitedcoding-config repo at runtime via Authorization token.
3. Switches 6 sh installer scripts from public REPO_RAW to PRIVATE
   unlimitedcoding-config base URL for *_config.json downloads.
4. Removes stale .patcher.config.cache.json (will regen on next install).

Production configs MOVED to private repo (separate commit e839102 on
unlimitedcoding-config/main).

KNOWN UNCHANGED:
- releases/v2.1.119/sea/cli-wrapper.cjs still has api_key (part of npm
  package distribution; clients need it locally; sensey serves same).
- Read-only gitea token (cadffcb0...) remains in installers — needed
  for token-auth fetch from private repo. Scoped read-only.

RECOMMEND: api_key rotation in proxy auth list because ClauderAPI2 was
publicly exposed for an unknown period. Existing client installs would
need re-install or env override.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-25 16:43:08 +00:00
delta-cloud-208e
c8c56b58b7 fix(codex): force chown+chmod on all user .codex dirs after install
Previous chown was unreliable — stat-based owner detection, missing
chmod, SUDO_USER edge cases. Now: simple loop over /Users/* (macOS)
or /home/* (Linux), chown -R + chmod -R u+rwX for each.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:34:22 +00:00
delta-cloud-208e
2a585ec758 fix(codex): clean broken config.toml before patching + fix macOS user discovery
- Delete config.toml with double-quoted keys bug before regenerating
- Replace pwd.getpwall() with /Users/* scan on macOS (Directory Services unreliable)
- Proper chown via stat of home directory

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:31:13 +00:00
delta-cloud-208e
b27c0cd65e fix(codex): fix permission denied for non-root users
- chown -R ~/.codex/ to actual user after patching (sudo creates as root)
- Detect SUDO_USER for the invoking user
- Iterate /Users/*/.codex (macOS) and /home/*/.codex (Linux) to fix all

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:24:07 +00:00
delta-cloud-208e
ab6be896bd fix(codex): patch all users, not just root — add --all flag and fix macOS UID threshold
- Install script now runs patcher with --all to patch every user's ~/.codex/config.toml
- Fix list_users() UID threshold: macOS starts at 500, Linux at 1000
- Fix file ownership: chown config files to the actual user after patching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:54:43 +00:00
delta-cloud-208e
128ec80ed0 fix(codex): macOS compatibility for install/update/uninstall scripts
- Replace grep -oP (Perl regex) with portable sed — fixes "grep: invalid option -- P" on macOS
- Add sedi() wrapper for cross-platform sed -i (BSD vs GNU)
- Detect macOS via uname and use apple-darwin binary suffix instead of linux-musl
- Add is_native_binary() helper: checks both ELF (Linux) and Mach-O (macOS)
- macOS env vars: use launchctl setenv + /etc/codex-env.sh + ~/.zshrc source line
- Linux env vars: keep /etc/environment + /etc/profile.d/ as before
- Wrapper script uses dynamic ENV_FILE path instead of hardcoded /etc/profile.d/
- Fix SUDO_USER handling for correct ~/.zshrc path when run via sudo
- Uninstaller: also remove .codex-bin, /etc/codex-env.sh, launchctl vars, rc file entries
- Uninstaller: scan /Users/* on macOS instead of /home/*
- Fix CRLF line endings in ucodex_uninstall.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 17:45:41 +00:00
delta-cloud-208e
089f6e0be5 fix(codex): create wrapper before patcher runs
Patcher uses `which codex` to find binary. After migrating
codex -> .codex-bin, wrapper must exist before Step 2 (patcher)
or patcher fails with "Codex CLI not found".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:59:45 +00:00
delta-cloud-208e
deb1c2cfd2 fix(codex): drop Python 3.11 requirement, auto-install python3
- tomllib fallback: try tomllib (3.11+) -> tomli -> minimal parser
- Works with Python 3.8+ (Ubuntu 20.04, Debian 11, etc.)
- Auto-install python3 if not found (like Gemini/Qwen scripts)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:58:16 +00:00
delta-cloud-208e
d37772d67c fix: wrapper scripts for all CLIs — env vars work immediately without source
Problem: `sudo bash install.sh` runs in child process, `export` inside it
never reaches the user's current shell. /etc/environment and /etc/profile.d/
only work for NEW sessions. So `codex`/`gemini`/`qwen` fail with
"Missing environment variable" right after install.

Solution: wrapper scripts that auto-source env file before exec'ing binary.
- codex: /usr/local/bin/codex (wrapper) -> /usr/local/bin/.codex-bin (real)
- gemini: /usr/local/bin/gemini (wrapper) -> node .../dist/index.js
- qwen: /usr/local/bin/qwen (wrapper) -> node .../dist/index.js

Works immediately in ANY shell, no manual `source` needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:51:56 +00:00
delta-cloud-208e
77cde5d012 fix(codex): rewrite install script as self-contained for curl pipe usage
- Script no longer depends on local update-codex.sh or SCRIPT_DIR files
- Downloads Codex binary directly from GitHub releases
- Downloads patcher + config from gitea repo
- Sets env vars system-wide (/etc/environment + /etc/profile.d/)
- Proper error handling with set -euo pipefail

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:40:39 +00:00
delta-cloud-208e
b7c72793fe fix(codex): system-wide env vars via /etc/environment + /etc/profile.d/
- Write OPENAI_API_KEY and OPENAI_BASE_URL to /etc/environment (all users)
- Create /etc/profile.d/codex-env.sh for login shell export (all users)
- Export for current session too
- Removes per-user ~/.bashrc approach — system-wide is more reliable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:33:46 +00:00
delta-cloud-208e
3b81f61192 fix(codex): set OPENAI_API_KEY in shell profile + current session
Install/update scripts now:
- Export env vars for current session (fixes "Missing OPENAI_API_KEY")
- Write to ~/.bashrc or ~/.zshrc for persistence
- Handle sudo (detect real user via SUDO_USER)
- Remove stale entries before writing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 10:32:20 +00:00
delta-cloud-208e
491b2a6854 feat(codex): add Codex CLI patcher — config+env based patching
Codex CLI is a Rust binary — patched via config.toml + env vars.
6 targets: api_endpoint, auth, telemetry, permissions, model, env.
Includes installer, binary updater, config validator, pipeline CLI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 10:30:57 +00:00