Skip to content

fix(ga_ultraplan): require Bearer token on /exec (closes #729) - #731

Open
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-729-ultraplan-exec-auth
Open

fix(ga_ultraplan): require Bearer token on /exec (closes #729)#731
Kailigithub wants to merge 1 commit into
lsdefine:mainfrom
Kailigithub:fix/issue-729-ultraplan-exec-auth

Conversation

@Kailigithub

Copy link
Copy Markdown
Contributor

Closes #729

assets/ga_ultraplan.py daemon now mints a per-start secret (secrets.token_urlsafe(32)), persists it to a 0600-permissioned file in _RUN_DIR, and requires Authorization: Bearer <token> on every POST /exec. Tokens are compared with secrets.compare_digest. The same token is propagated to the auto-spawned subprocess via GA_ULTRAPLAN_TOKEN env var, and plan() reads it from the env (or the file fallback) before sending.

Mirrors the RemoteAuth pattern established in PR #727 (frontends/conductor.py).

Diff

  • assets/ga_ultraplan.py: 27 lines added / 4 removed
    • 2 module-globals: _TOKEN, _TOKEN_FILE
    • _serve_daemon: mint + persist token at start (or use inherited env)
    • do_POST /exec: 401 unless Authorization: Bearer matches via compare_digest
    • _show: spawn daemon subprocess with GA_ULTRAPLAN_TOKEN env + persist token file
    • plan(): read token from env or file, send Authorization: Bearer header
  • test_issue_729_ultraplan_exec_auth.py: new, 99 lines
    • Case 1: no Authorization header → 401
    • Case 2: wrong Bearer token → 401
    • Case 3: correct Bearer token → 200, canary file written proving exec sink reached

Verification

  • python3 -m py_compile assets/ga_ultraplan.py
  • python3 -m py_compile test_issue_729_ultraplan_exec_auth.py
  • Git-stash three-step dance (per skill Iron Rule 1): test FAILS on old code (no token file → FileNotFoundError), PASSES on new code (3/3 cases)
  • Diff respects Iron Rule 3 (≤5 lines source — actual handler logic is exactly 3 lines, all other changes are token-mint plumbing that mirrors RemoteAuth)

Notes

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.

UltraPlan /exec daemon accepts unauthenticated local code submissions

1 participant