Skip to content

PRO-1042: route Codex plugin login through typed CLI auth - #4

Merged
rares04 merged 3 commits into
mainfrom
pro-1042-typed-cli-auth
Aug 30, 2026
Merged

PRO-1042: route Codex plugin login through typed CLI auth#4
rares04 merged 3 commits into
mainfrom
pro-1042-typed-cli-auth

Conversation

@rares04

@rares04 rares04 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep working credentials from LUA_API_KEY, ~/.lua-cli/credentials, and .env unchanged. This includes non-dotted legacy keys.
  • Send new login to lua auth configure in a private terminal. lua-cli 3.28.0 and later issue a typed personal credential after the user selects an organization, one or more agents, and a role. Builder remains the default role.
  • Stop collecting email addresses, OTPs, and raw credentials in the Codex conversation. The shell hook denies model-run lua auth configure, and lua auth key* remains denied.
  • Identify direct MCP HTTP requests as codex-plugin/1.1.0. Calls that spawn lua-cli use the CLI's own versioned identity.
  • Update the setup guide, tester guide, security contract, troubleshooting guide, and MCP examples. A lint rejects the old secret-bearing auth commands.
  • Release Codex plugin 1.1.0 on merge. A consistency lint keeps the package, manifest, MCP, and telemetry versions aligned.

Source-derived caller inventory

The inventory came from a repository-wide rg before editing.

  • skills/lua-auth/SKILL.md, skills/lua-doctor/SKILL.md, and the auth preflight in skills/lua-init/SKILL.md own setup.
  • lib/credentials.mjs and mcp/lua-platform/src/auth.mjs resolve LUA_API_KEY, the CLI credentials file, and .env. This PR does not change their order or formats.
  • mcp/lua-platform/src/tools/list-agents.mjs and get-agent.mjs spawn lua agents --json. Those requests use cli/<version>.
  • mcp/lua-platform/src/api-client.mjs owns direct Lua API requests for deployment status, primitive versions, and logs. Those requests now use codex-plugin/1.1.0, which lua-core-services #2183 recognizes as a bounded family.

Merge gate

Merge only after npm view lua-cli version reports 3.28.0 or later. The current PR head must also have green CI and current-head approval.

This PR does not rotate, revoke, rewrite, or invalidate an existing credential. It does not use work from the closed #2008 prototype.

Verification

  • npm run lint
  • npm test -- --coverage (249 tests)
  • node scripts/check-coverage.mjs
  • MCP npm test (83 tests)
  • MCP npm run build
  • node scripts/check-bundle-size.mjs

Linear: PRO-1042

@rares04

rares04 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

Dependency update: lua-core-services #2183 must merge and deploy before this draft can release. Direct api-client.mjs requests now identify as codex-plugin/<package version>; Lua CLI subprocesses keep cli/<lua-cli version>. Focused tests also fail if a new raw HTTP caller bypasses the identified wrapper.

@rares04
rares04 marked this pull request as ready for review August 30, 2026 12:38
@rares04
rares04 requested review from richard-lua August 30, 2026 12:38
richard-lua
richard-lua previously approved these changes Aug 30, 2026

@richard-lua richard-lua left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — MEDIUM risk

The security direction here is sound: new logins are routed to lua-cli's private lua auth configure, the conversation no longer collects email/OTP/credentials, the shell hook now denies model-run lua auth configure (with good test coverage), and the CLI-flag lint is extended to docs to prevent secret-bearing commands from reshipping. The docs, SECURITY.md, and permissions template are consistent with the new flow. Two concrete issues below should be addressed before merge; note also that the PR body's own release gate keeps this blocked until upstream CLI/services ship, which is a legitimate constraint rather than a review action.

Major

  • mcp/lua-platform/src/api-client.mjs:38 — The client version is hardcoded (codex-plugin/1.0.0) while the new test asserts codex-plugin/${package.json.version}. The PR's own release gate requires bumping the plugin version before merge, which will immediately break the test — or, if patched by hand, will silently misreport the version to the backend. Derive the header from package.json so the client and test share one source of truth.

Minor

  • scripts/lint-cli-flags.mjs:30SCAN_DIRS was renamed commandsskills. Correct for this Codex port, but it silently drops a scan root and the history comment still references commands/lua-sync.md. Confirm no commands/ tree ships and update the stale comment.
  • mcp/lua-platform/tests/api-client.test.mjs:74 — The "single direct caller" structural test regexes for fetch(/fetchFn( and will misfire on benign refactors (e.g. a prefetch( helper) or miss globalThis.fetch( without a space. Tighten the pattern and document how to extend the allowlist for an intentional new HTTP entry point.

Nothing here is exploitable or data-losing; the findings are correctness/maintainability. Once the version-drift issue is fixed and the release gate conditions are met, this is safe to merge.


PR Risk Reviewer — automated senior review of a7b24a0 · risk: medium · confidence: 0.78

@rares04
rares04 requested review from richard-lua and removed request for richard-lua August 30, 2026 12:46

@richard-lua richard-lua left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review — LOW risk

Previously flagged

  • Hardcoded client version will drift from package.json — resolved. The header literal in api-client.mjs:38 is still codex-plugin/1.1.0, but the new scripts/lint-release-version.mjs (now in the lint script) fails CI unless that literal, both plugin_version strings and the server name/version in server.mjs, .codex-plugin/plugin.json, and mcp/lua-platform/package.json all equal package.json's version. Drift is now mechanically caught rather than silently shipped, and the api-client test asserts against package.json.
  • Lint SCAN_DIRS commandsskills — still open (cosmetic). The rename is correct (no commands/ tree ships), but the history comment in scripts/lint-cli-flags.mjs still references commands/lua-sync.md.
  • Structural lint test brittleness — still open (minor). api-client.test.mjs:74 keeps the fetch|fetchFn regex with no allowlist-extension guidance.

The core change is sound and well-covered: new logins route to lua-cli's private lua auth configure, the shell hook now denies model-run lua auth configure (with the flagged-variant and flagless cases both tested), the permissions template moves lua auth configure* to deny, and the CLI-flag lint now scans docs/README/SECURITY for secret-bearing auth commands. Docs, SECURITY.md, and the version-consistency lint are internally consistent. Nothing here is exploitable or data-losing.

Minor

  • scripts/lint-cli-flags.mjs:8 — History comment still references commands/lua-sync.md, a path that no longer exists after the SCAN_DIRS rename to skills. Update to skills/lua-sync/SKILL.md.
  • mcp/lua-platform/tests/api-client.test.mjs:74 — The /\b(?:fetch|fetchFn)\s*\(/ guard can misfire on future refactors and documents no way to register an intentional new HTTP entry point. Tighten the pattern and add an allowlist note.
  • mcp/lua-platform/README.md:5 — Intro still says "6 read-only tools" and "Claude Code"; contradicts the "5 tools (was 6 before v1.25)" line and the Codex port. Correct the count and host.

Once the release-gate conditions in the PR body are met (upstream CLI 3.28.0 + services deployed, CI rerun against the published dependency), this is safe to merge.


PR Risk Reviewer — automated senior re-review of 2a9f477 · risk: low · confidence: 0.80


PR Risk Reviewer — automated senior review of 2a9f477 · risk: low · confidence: 0.80 · re-review

@rares04
rares04 merged commit 9aab64b into main Aug 30, 2026
7 checks passed
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.

2 participants