Configured HTTPS scheme is ignored by HTTP probes

Open Beginner friendly
#84 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go

Research direction

Start at the HTTPGetCheck entry point and use the TestHTTPSProbeAgainstPlainHTTP reproduction as the regression case. Trace how probe.Scheme is handled, then verify that an HTTPS-configured probe cannot pass against the plain HTTP test server and that the focused test reflects the expected behavior.

Written by the indexing model from the issue text.

Description

An HTTP probe configured with scheme: HTTPS still sends a plaintext HTTP request. This makes a TLS-only endpoint fail validation, while a plaintext endpoint can incorrectly satisfy a check that explicitly requires HTTPS.

Minimal reproduction

The following focused test uses a plain HTTP server but marks the probe as HTTPS:

func TestHTTPSProbeAgainstPlainHTTP(t *testing.T) {
	server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
		w.WriteHeader(http.StatusOK)
	}))
	defer server.Close()

	port := server.Listener.Addr().(*net.TCPAddr).Port
	probe := &canaryv1.Probe{HTTPGet: &canaryv1.HTTPGetAction{
		Path:   "/",
		Port:   port,
		Scheme: v1.URISchemeHTTPS,
	}}

	got, err := HTTPGetCheck(nil, probe)
	require.NoError(t, err)
	require.True(t, got)
}

Verified on main at db5af4f: the test passes, showing that the HTTPS setting is ignored.

Expected behavior

An HTTP probe should use its configured scheme. A probe requiring HTTPS must not pass against a plaintext HTTP endpoint.

Dominant language
Go
Stars
309
Forks
23
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/container-canary

All issues in NVIDIA/container-canary

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.