[Bug] HTTPS-enforcement scenarios fail when Connect / Package Manager terminate TLS on their own port
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Lee cross_product/test_ssl.py y security/test_https.py; después, compara cómo request_http y make_http_request clasifican las respuestas HTTP con las pruebas existentes de los helpers en selftests/test_ssl_helper.py y selftests/test_https_helper.py. Añade casos específicos para la respuesta documentada de rechazo de TLS y para respuestas 400 no relacionadas. El objetivo se cumple cuando la respuesta conocida de texto sin cifrar sobre TLS se acepta como aplicación de HTTPS, mientras que las respuestas 400 y 200 no relacionadas siguen sin cumplir las aserciones pertinentes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
VIP version
Seen live with posit-vip 2026.11.2. Reproduced against the v2026.12.0 source (1a54f5f4). The step logic in both files is unchanged on main.
Affected area
Cross-product tests (cross_product/test_ssl.py) and security tests (security/test_https.py)
What happened?
On a deployment where Connect and Package Manager terminate TLS themselves, four scenarios fail:
cross_product/test_ssl.py::test_http_redirects_to_https_for_product[Connect]and[Package Manager]security/test_https.py::test_product_enforces_https[Connect]and[Package Manager]
Here "terminate TLS themselves" means [HTTPS] Listen = :3939 / :4242, with no plain-HTTP listener on those ports.
Both make_http_request and request_http build the HTTP URL by swapping the scheme and keeping the port. So https://connect.example.com:3939 becomes http://connect.example.com:3939, and the plaintext request lands on the TLS listener.
Connect and Package Manager serve TLS with Go's net/http. On a TLS listener, Go answers a plaintext request with a valid HTTP response, not a reset (src/net/http/server.go, c.serve, the tls.RecordHeaderError / tlsRecordHeaderLooksLikeHTTP branch):
HTTP/1.0 400 Bad Request
Client sent an HTTP request to an HTTPS server.
httpx parses that as an ordinary response, so neither function reaches its httpx.NetworkError / httpx.ProtocolError branch. The code comments there describe that branch as "what a plaintext HTTP request gets back from a TLS-only port". The assertions then see a non-3xx status:
make_http_request -> {'status': 400, 'location': '', 'refused': False}
AssertionError: HTTP request was not refused or redirected (got HTTP 400). HTTPS is not enforced.
request_http -> {'status': 400, 'location': '', 'final_url_scheme': 'http', 'error': None}
AssertionError: HTTP did not redirect to HTTPS. Initial response: HTTP 400, Location: '', final URL scheme after following redirects: 'http'
The products are enforcing HTTPS. Nothing is served over plaintext, and http_port_no_content passes on the same response. They also cannot redirect on that port. Both products document HTTP→HTTPS redirection as a separate listener ([HTTPRedirect] Listen = :80). HTTPS.Permanent only adds HSTS and the secure cookie flag. References: Connect HTTPRedirect, Connect HTTPS, Package Manager HttpRedirect, Package Manager SSL.
So a deployment that follows the docs is reported as "HTTPS is not enforced". In the same run, Workbench on :443 with a :80 redirect passes both scenarios.
What did you expect to happen?
A TLS-only port that rejects plaintext with Go's 400 should be classified like the refused/reset case (refused: True / error: "port_closed"). Both scenarios should then pass for Connect and Package Manager on :3939 / :4242.
Steps to reproduce
No Posit product needed. Run a 12-line Go TLS listener and call VIP's own step functions against it.
main.go:
package main
import (
"log"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("ok\n")) })
log.Fatal(http.ListenAndServeTLS("127.0.0.1:18443", "cert.pem", "key.pem", nil))
}
openssl req -x509 -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem -days 1 \
-subj /CN=localhost -addext subjectAltName=DNS:localhost,IP:127.0.0.1
printf 'module repro\ngo 1.27\n' > go.mod && go build -o tlsonly . && ./tlsonly &
curl -s http://127.0.0.1:18443/ # -> Client sent an HTTP request to an HTTPS server.
test_repro.py, run from an empty dir containing a bare pytest.ini ([pytest]):
import types
URL = "https://127.0.0.1:18443"
def cfg(url):
pc = types.SimpleNamespace(is_configured=True, url=url)
return types.SimpleNamespace(verify=False, product_config=lambda key: pc)
def test_security_https_enforced():
from vip_tests.security.test_https import make_http_request, https_enforced
https_enforced(make_http_request(URL, cfg(URL)))
def test_ssl_redirects_to_https():
from vip_tests.cross_product.test_ssl import request_http, redirects_to_https
redirects_to_https(request_http("Connect", cfg(URL)))
def test_ssl_http_port_no_content():
from vip_tests.cross_product.test_ssl import request_http, http_port_no_content
http_port_no_content(request_http("Connect", cfg(URL)))
uv run --no-project --with /path/to/vip python -m pytest -p no:vip -q -rA test_repro.py
# FAILED test_security_https_enforced - AssertionError: HTTP request was not refused or redirected (got HTTP 400) ...
# FAILED test_ssl_redirects_to_https - AssertionError: HTTP did not redirect to HTTPS. Initial response: HTTP 400 ...
# PASSED test_ssl_http_port_no_content
Relevant logs or output
Live vip verify --basic (2026.11.2), on one host running all three products: 4 failed, 65 passed, 26 skipped. The four failures are exactly the scenarios above, with the same assertion messages. A plain curl http://<host>:3939/ and curl http://<host>:4242/ both return Client sent an HTTP request to an HTTPS server.
Environment
- Live:
- Ubuntu 24.04, publicly trusted certificates.
- Workbench 2026.11.1 on
:443, with a:80redirect. - Connect 2026.11.1 with
[HTTPS] Listen = :3939and noHTTP.Listen. - Package Manager 2026.11.2 with
[HTTPS] Listen = :4242and[HTTP] Listen =(empty).
- Repro: Go 1.27.4, Python 3.15, VIP source
1a54f5f4.
Suggested fix
The comments in request_http and make_http_request say to keep the two in sync. In both, classify the response as refused / port_closed when it is a 400 carrying a known plaintext-on-TLS signature.
Keep it as narrow as #457 / #555 intended: match the server's signature, not any 400. A 400 for any other reason should still fail.
_PLAINTEXT_ON_TLS = (
b"Client sent an HTTP request to an HTTPS server", # Go net/http: Connect, Package Manager
b"The plain HTTP request was sent to HTTPS port", # nginx 497 -> 400 page
)
def _rejected_plaintext_on_tls(resp: httpx.Response) -> bool:
return resp.status_code == 400 and any(sig in resp.content for sig in _PLAINTEXT_ON_TLS)
The nginx string is from ngx_http_special_response.c (ngx_http_error_497_page). I only hit the Go case. Nothing here tested Workbench serving TLS on a non-default port.
request_http could report a distinct reason such as "tls_only" instead of reusing port_closed. The report would then say the TLS port rejected plaintext rather than "port closed".
Selftests can follow the existing monkeypatch.setattr(httpx, "get", fake_get) pattern in selftests/test_https_helper.py and the #555 block in selftests/test_ssl_helper.py:
httpx.Response(400, content=b"Client sent an HTTP request to an HTTPS server.\n")→ refused / passes;- a 400 with an unrelated body → still fails;
- a 200 → still fails
http_port_no_content.
Related: #457 and #555 narrowed this exception handling. #546 (TLS in CI) would exercise this path if the product terminates TLS itself.
- Lenguaje dominante
- Python
- Estrellas
- 9
- Forks
- 1
- Merge medio
- 15 h 31 min
- PR fusionados (30 d)
- 44
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de posit-dev/vip
-
team: workbench
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
[Bug] k8s_cluster_configured step misses the kubeconfig exceptions fixtures.py already handlesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
nightly-failure
Dificultad 4/5 1-2 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
nightly-failure
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
[Epic] Trustworthy resultsAbiertotracking
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de posit-dev/vip
Issues similares
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobAbiertoaccepted
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
future-agi/future-agi#6392 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
memmapped_arange ignores the start value and drops the last point above the memmap thresholdPosiblemente ocupada @prathameshfuke la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
StingraySoftware/HENDRICS#213 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días