Skip to content

feat: proxy auth for both CLIs (2/2 — merge after upstream #501) - #1

Closed
niieani wants to merge 1 commit into
bb/bearer-gatewayfrom
bb/proxy-auth
Closed

niieani wants to merge 1 commit into
bb/bearer-gatewayfrom
bb/proxy-auth

Conversation

@niieani

@niieani niieani commented Oct 6, 2026

Copy link
Copy Markdown
Owner

Adds explicit proxy auth for jtk and cfl: only a URL is required, requests send no Authorization header, and token/keyring requirements are skipped. HTTPS and loopback HTTP endpoints are accepted; remote HTTP is rejected during client construction and init, including jtk init --no-verify before any config is saved.

Merge order: 2 of 2 — merge upstream open-cli-collective#501 first. This PR is stacked on bb/bearer-gateway in the niieani fork because GitHub cannot use a fork branch as the base of an upstream PR. After open-cli-collective#501 merges, rebase this branch onto upstream main and open the proxy-auth PR upstream. Do not merge this into the fork's gateway branch before open-cli-collective#501 lands; that would enlarge open-cli-collective#501's diff.

First PR: open-cli-collective#501

This replaces the proxy-auth portion of upstream open-cli-collective#411. It includes typed shared credential policy, consistent init validation and deferred-token behavior, both runtime paths, and all three auth passes in the integration runbooks. Existing tests remain in their original files to keep the review diff focused.

Validation: make check passed on the complete stack (module tidy, lint, race tests for all three modules, and both CLI builds). Coverage includes omitted Authorization headers, proxy config persistence without credentials, non-loopback HTTP rejection before save, and existing basic/bearer behavior.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-06T21:02:57.715970Z e0bde24 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@niieani

niieani commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded by open-cli-collective#502 so both ordered PRs are visible upstream. Merge upstream open-cli-collective#501 first, then rebase and merge open-cli-collective#502.

@niieani niieani closed this Oct 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e0bde24ff1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread shared/auth/auth.go
Comment on lines +77 to +78
if c.APIToken == "" {
return fmt.Errorf("--non-interactive: missing required value for --token-stdin or --token-from-env VAR (or pre-stage with `%s`)", toolHint)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor --no-verify when checking scripted credentials

When init runs with --no-verify and non-interactive or piped stdin, this unconditional token check rejects an empty token before either CLI reaches its new ValidateForInit(noVerify) and empty-token save paths. Consequently, deferred credential setup works interactively but commands such as jtk init --non-interactive --no-verify --url ... --email ... still fail, which prevents the intended scripted workflow of saving configuration and staging the token later. Pass the verification policy into this check or otherwise waive only the token requirement when verification is disabled.

Useful? React with 👍 / 👎.

Comment thread tools/jtk/api/client.go
Comment on lines +138 to +142
if err := url.RequireSecureOrLoopback(cfg.URL); err != nil {
return nil, err
}
baseURL := url.NormalizeURL(cfg.URL)
restURL := baseURL + "/rest/api/3"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject credentials embedded in proxy URLs

When a proxy URL contains userinfo such as https://user:secret@proxy.example, the secure-URL check accepts it and normalization preserves it; Go's net/http then synthesizes a Basic Authorization header from that userinfo even though SkipAuthHeader is set. This violates proxy mode's no-Authorization contract and also persists the embedded password in the non-secret URL field. Both proxy client constructors should reject URLs whose parsed User is non-nil.

Useful? React with 👍 / 👎.

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.

1 participant