fix: read PHASE_VERIFY_SSL env var so SSL bypass works#310
Merged
rohan-chaturvedi merged 5 commits intoJul 7, 2026
Conversation
rohan-chaturvedi
left a comment
Member
There was a problem hiding this comment.
@sundaram2021 This lgtm! Lets just take care of the missing trailing newlines. We can just run gofmt:
gofmt -w src/cmd/root.go src/pkg/config/env.go src/pkg/config/env_test.goand then get this merged.
rohan-chaturvedi
approved these changes
Jul 7, 2026
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.
Description 📣
What
The SSL error message tells users to set
PHASE_VERIFY_SSL=Falseto bypass certificateverification, but the environment variable was never read anywhere in the CLI — so the bypass
didn't work for any command, including the pre-auth external identity flows
(
phase auth --mode aws-iam/--mode azure) against self-hosted instances with self-signedcertificates.
This PR reads
PHASE_VERIFY_SSLonce at startup and applies it to the SDK, making thelong-advertised bypass actually work.
Fixes #292
Why it was broken
PHASE_VERIFY_SSLin the codebase was the error string inpkg/errors/errors.go— nothing read the variable.misc.VerifySSL) defaults totrueand was never set anywhere(not even by
sdk.New()).request. That's why it's applied in the root command's
init()rather than inPersistentPreRun— a subcommand-definedPersistentPreRunwould silently override aroot-level one.
Changes
pkg/config/env.go(new):ConfigureSSLVerification()— disables verification only whenPHASE_VERIFY_SSLequalsfalse(case-insensitive), mirroring the Python CLI's semantics(
os.environ.get("PHASE_VERIFY_SSL", "True").lower() != "false").cmd/root.go: call the helper ininit(), before any command or network call — thiscovers the pre-auth aws-iam/azure flows, which don't go through
NewPhase().pkg/config/env_test.go(new): table-driven tests for the parsing semantics.Behavior
PHASE_VERIFY_SSLfalse/False/FALSEtrue,0,no, anything elseNo behavior change unless the variable is explicitly set to
false.Testing
go vet ./...,go test ./...,go build ./...pass (10 new unit cases covering the valuematrix above).
Verified end-to-end against a local HTTPS server with a self-signed certificate, through the
real SDK client path:
🗿 SSL error: ... x509: certificate signed by unknown authority ...(fail-closed)PHASE_VERIFY_SSL=False→ request succeeds (TLS bypassed)PHASE_VERIFY_SSL=banana→ SSL error (fail-closed)Quick reproduction for reviewers — point the CLI at a self-signed endpoint with a dummy token
and watch the error type flip:
Notes
PHASE_VERIFY_SSL=Falsedisables MITM protection and is intended for dev / break-glass use.For production self-hosted instances, trusting the CA is preferable — on Linux, Go already
honors
SSL_CERT_FILE=/path/to/ca.pemwith no code changes. Happy to add a docs note(docs live in a separate repo).
phase update(plainhttp.Getto pkg.phase.dev) andPHASE_DEBUGwiring are untouched.Type ✨