Commit graph

5 commits

Author SHA1 Message Date
A
16ee8e3461
refactor: Extract helpers from complex cloud provider functions (#118)
- kamatera: Replace 65-line kamatera_api() with generic_cloud_api_custom_auth (65 -> 8 lines)
- kamatera: Extract _load_kamatera_config() and _validate_kamatera_credentials() from ensure_kamatera_token()
- ovh: Extract _load_ovh_config() and _save_ovh_config() from ensure_ovh_authenticated() (79 -> 47 lines)
- upcloud: Extract _load_upcloud_config() from ensure_upcloud_credentials() (69 -> 49 lines)
- upcloud: Extract _wait_for_upcloud_server_ip() from create_server() (58 -> 39 lines)

Agent: complexity-hunter

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 19:51:31 -08:00
A
a24dc101e3
fix: Eliminate heredoc injection, eval, and API key exposure (#108)
- Replace unquoted heredocs with printf + json_escape for all JSON
  config files containing credentials (8 cloud providers + shared lib)
- Replace eval with printf -v for safe indirect variable assignment
- Move RunPod API key from URL query param to api-key header

Fixes #104, Fixes #105, Fixes #106

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 11:19:34 -08:00
A
27973bfb28
refactor: Reduce complexity across CLI and cloud provider libs (#103)
* refactor: Extract duplicated prompt flag parsing into extractFlagValue helper

The --prompt and --prompt-file argument extraction in main() shared identical
patterns for flag detection, value validation, and args splicing. Extracted
into a reusable extractFlagValue() function that handles all three concerns.

Agent: complexity-hunter

* refactor: Consolidate multiple python3 JSON reads into single calls

OVH, Kamatera, and UpCloud each spawned separate python3 processes to
read different fields from the same JSON config file. Consolidate into
a single python3 call per file, printing all fields at once and reading
them with bash read. Also fixes OVH using string interpolation for the
file path instead of the safer sys.argv[1] pattern.

Agent: complexity-hunter

* refactor: Extract flyctl auth and token validation from ensure_fly_token

Split the 75-line ensure_fly_token into focused helpers:
- _try_flyctl_auth: encapsulates flyctl CLI token retrieval
- _validate_fly_token: encapsulates API validation with error reporting

The main function is now a clear sequential flow of token source attempts.

Agent: complexity-hunter

* refactor: Deduplicate retry backoff logic in kamatera_api

The two error branches (network error and HTTP 429/503) had identical
interval update and attempt increment code. Restructure with early
return for success, then unified backoff at the end of the loop.

Agent: complexity-hunter

* refactor: Remove unnecessary async IIFE wrapper in validateAndGetAgent

The function wrapped its body in `return (async () => { ... })()` when
it can simply be declared as `async function` directly.

Agent: complexity-hunter

---------

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
2026-02-09 10:26:03 -08:00
A
b0f924b511
fix: Prevent Python/shell injection via env vars and triple-quote strings (#102)
- Fix triple-quote injection in SSH keys (Scaleway, UpCloud), userdata
  (BinaryLane), init scripts (Civo, Kamatera), and GraphQL queries
  (RunPod) by passing data via stdin/json_escape instead of inline
  string interpolation
- Add input validation for all cloud provider env vars (region, type,
  plan, etc.) using validate_region_name/validate_resource_name to block
  shell metacharacters before they reach Python string interpolation
- Validate Modal image name as Python identifier to prevent code injection
- Validate numeric env vars (RAM, GPU count, disk size) across all providers

Affects: 19 cloud provider lib/common.sh files
Agent: security-auditor

Co-authored-by: A <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 10:22:39 -08:00
A
a49c0874a9
feat: Add OVHcloud provider with 3 agents (#93)
Add OVHcloud Public Cloud as a new cloud provider with signature-based
API authentication (Application Key + Secret + Consumer Key).

Implements:
- ovh/lib/common.sh with OVH API wrapper, instance lifecycle, SSH key management
- ovh/claude.sh, ovh/aider.sh, ovh/codex.sh agent scripts
- manifest.json entries for all 13 agents (3 implemented, 10 missing)
- ovh/README.md with setup instructions

OVH defaults: d2-2 flavor, GRA7 region, Ubuntu 24.04

Agent: cloud-scout

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-09 09:40:28 -08:00