Skip to content

Allow skipping tls verification#35

Closed
spicyneuron wants to merge 2 commits into
chr15m:mainfrom
spicyneuron:pr/insecure
Closed

Allow skipping tls verification#35
spicyneuron wants to merge 2 commits into
chr15m:mainfrom
spicyneuron:pr/insecure

Conversation

@spicyneuron

Copy link
Copy Markdown
Contributor

Local endpoints may be deployed with self-signed certificates, which Python rejects.

This PR adds an opt-in way to skip validation, following the existing patterns. Default behavior remains unchanged.

(Copy of #32, simply moved into a separate branch)

@chr15m

chr15m commented May 7, 2026

Copy link
Copy Markdown
Owner

I did some research and apparently this can be accomplished with the following built in Python env vars.

Disable Python's HTTPS verification globally:

PYTHONHTTPSVERIFY=0 ./runprompt hello.prompt

Trust a specific self-signed certificate:

SSL_CERT_FILE=/path/to/custom-ca.pem ./runprompt hello.prompt

I'd be happy to add these examples to the README.md - I'm a bit hesitant to duplicate this functionality inside runprompt itself. Is there some reason why it would be better to have it in runprompt?

@spicyneuron

Copy link
Copy Markdown
Contributor Author

PYTHONHTTPSVERIFY=0 would work for the requests library, but you're using urllib.request.urlopen(), which is controlled by ssl.SSLContext. No global off switch for ssl, AFAIK.

SSL_CERT_FILE would probably work, but requires cert pinning on every client. That's the exactly hassle I'm trying to avoid by not verifying. No hard feelings if you prefer not supporting this; I'm fine using my fork regardless.

@chr15m

chr15m commented May 7, 2026

Copy link
Copy Markdown
Owner

I have a much smaller patch for this:

    if get_conf("insecure"):
        import ssl
        ssl._create_default_https_context = ssl._create_unverified_context

@spicyneuron

Copy link
Copy Markdown
Contributor Author

@chr15m Good catch. Updated!

@spicyneuron spicyneuron closed this May 7, 2026
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