Repository navigation
fix: use the system CA roots for -tls without -ca-cert - #8
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
promptctl push|publish -tlswithout-ca-certpassed""tocredentials.NewClientTLSFromFile, which fails withopen : The system cannot find the file specified.A server with a public certificate couldn't be reached unless-ca-certpointed at the OS bundle.The fix
Credential selection moved into
transportCreds(useTLS, caCert):-tls: plaintext (unchanged)-tls, no-ca-cert:credentials.NewTLS(&tls.Config{}), where nilRootCAsmeans the system root pool (new)-tls -ca-cert <file>: that CA file (unchanged)The
-ca-certhelp text now says(default: system roots), and the README notes the behavior.Tests
New
cmd/promptctl/dial_test.goTestTransportCreds. With the system-roots branch disabled, it fails the same way main does:Full suite:
GOWORK=off go build ./... && go vet ./... && go test ./...givesok github.com/priompt/cli/cmd/promptctlBefore / 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):
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:
Independent of #7 (also unmerged). Both touch
cmd/promptctl/main.goimports andREADME.mdin different hunks. A local test merge of the two branches applied cleanly andgo test ./...passed.Fixes #4
🤖 Generated with Claude Code