Skip to content

fix: use the system CA roots for -tls without -ca-cert - #8

Merged
sujal-maheshwari2004 merged 1 commit into
mainfrom
fix/4-tls-system-roots
Oct 18, 2026
Merged

sujal-maheshwari2004 merged 1 commit into
mainfrom
fix/4-tls-system-roots

Conversation

@sujal-maheshwari2004

Copy link
Copy Markdown
Contributor

What was wrong

promptctl push|publish -tls without -ca-cert passed "" to credentials.NewClientTLSFromFile, which fails with open : The system cannot find the file specified. A server with a public certificate couldn't be reached unless -ca-cert pointed at the OS bundle.

The fix

Credential selection moved into transportCreds(useTLS, caCert):

  • no -tls: plaintext (unchanged)
  • -tls, no -ca-cert: credentials.NewTLS(&tls.Config{}), where nil RootCAs means the system root pool (new)
  • -tls -ca-cert <file>: that CA file (unchanged)

The -ca-cert help text now says (default: system roots), and the README notes the behavior.

Tests

New cmd/promptctl/dial_test.go TestTransportCreds. With the system-roots branch disabled, it fails the same way main does:

dial_test.go:14: -tls without -ca-cert: open : The system cannot find the file specified.
FAIL

Full suite: GOWORK=off go build ./... && go vet ./... && go test ./... gives ok github.com/priompt/cli/cmd/promptctl

Before / after (real run)

promptctl publish -server github.com:443 -tls acme/support/new.prompt (a public TLS endpoint that isn't a gRPC server):

Before (main):

open : The system cannot find the file specified.
exit=1

After: the TLS handshake verifies against the system roots, and the request reaches the server over HTTP/2. It fails only because github.com isn't a Priompt server:

publish acme/support/new.prompt: rpc error: code = Unknown desc = unexpected HTTP status code received from server: 422 (Unprocessable Entity); transport: received unexpected content-type "text/html; charset=utf-8"
exit=1

Independent of #7 (also unmerged). Both touch cmd/promptctl/main.go imports and README.md in different hunks. A local test merge of the two branches applied cleanly and go test ./... passed.

Fixes #4

🤖 Generated with Claude Code

promptctl push/publish -tls passed an empty -ca-cert straight to
credentials.NewClientTLSFromFile, which failed with `open : The system
cannot find the file specified.` A server with a public certificate
could not be reached without pointing -ca-cert at the OS bundle.

With -tls and no -ca-cert, promptctl now verifies the server against the
system root pool. -ca-cert still selects a private CA.

Fixes #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sujal-maheshwari2004
sujal-maheshwari2004 merged commit 7ace652 into main Oct 18, 2026
1 check passed
@sujal-maheshwari2004
sujal-maheshwari2004 deleted the fix/4-tls-system-roots branch October 18, 2026 14:22
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.

promptctl -tls requires -ca-cert (can't use system CA roots)

1 participant