Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

fix(security-core): parse the provider case arm on its own lines

MSO7696b2247def
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 59ca4800..eab3c780 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,11 @@
+## 2026-10-15: Let a cached OAuth client id authorize again, and unbreak the Semgrep gate
+
+The consent page rejected every `client_id` it had not minted itself with "This client must register before requesting authorization", but ChatGPT's user-defined connector caches a self-declared id and never calls `/oauth/register` — so that client could never authorize. The rejection also added no security, because `/oauth/register` is already a public endpoint that mints a client for any https callback; the only thing it broke was clients whose registration had been swept (the store deletes unreferenced clients an hour after creation). An unknown but well-formed public id is now registered on demand at `/oauth/authorize` for its exact callback, and again inside the approval action so a swept registration cannot dead-end the click. The registration is server-side and inert until the owner approves and completes PKCE; server-owned MSO principals (`manual:`, `pat:`, `mso_`) and malformed ids still fail closed, and an existing client only ever has redirect targets unioned, never replaced. Client lifecycle moved to `lib/mcp/store-clients.ts` so both files stay inside the 220-line architecture ratchet.
+
+The Security Core gate was failing deterministically at `bff30987` on the Semgrep job with exit code 3 despite zero findings. Semgrep's bash parser rejects a one-line `case` whose pattern list contains `|` alternation, and `--strict` promotes that parse warning to a fatal exit; the trigger was `scripts/cli/ai-provider-auth.sh:63`. The arm is expanded to three lines, which parses clean, so the strict gate keeps catching genuinely unparseable shells instead of being relaxed.
+
+A ChatGPT connector therefore reconnects against the callback it already holds; no re-add is required.
+
## 2026-10-14: Fix the provider picker and make `mso models add` scriptable
`mso models add` with no argument died with `mso picker: EAGAIN: resource temporarily unavailable, read`. The native arrow picker read its candidate rows with `fs.readFileSync(0)`, and Node throws instead of retrying when it is handed a non-blocking pipe that has not been written yet — exactly the state the manager's subshell pipeline produces. The picker now drains fd 0 through `fs.readSync` in a loop, sleeping on `Atomics.wait` and retrying `EAGAIN` until the producer closes the pipe, so the same selector works for both a pipeline and a redirected file. This restores the live provider list (Nvidia, OpenCode, OpenRouter, ZenMux and the rest) that the broken read had been hiding behind the static fallback.
diff --git a/scripts/cli/ai-provider-auth.sh b/scripts/cli/ai-provider-auth.sh
index d741ddd2..2dc304c0 100644
--- a/scripts/cli/ai-provider-auth.sh
+++ b/scripts/cli/ai-provider-auth.sh
@@ -60,7 +60,9 @@ configure_ai_provider() {
""|api-key|api_key|key|oauth) ;;
*) die "--type must be api-key or oauth" ;;
esac
- case "$provider" in chatgpt|codex) provider=openai-codex ;; esac
+ case "$provider" in
+ chatgpt|codex) provider=openai-codex ;;
+ esac
# OAuth (device flow) is a sign-in, never a pasted key.
if [ "$cred_type" = oauth ] || [ "$provider" = openai-codex ]; then