HTTP analysis ignores `expectedResponse`
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- go
- Domain
- devops, testing-qa
Research direction
Start in pkg/app/pipedv1/plugin/analysis/analysisprovider/http/http.go, then inspect AnalysisHTTP.ExpectedResponse in pkg/app/pipedv1/plugin/analysis/config/condition.go and the Provider.Run flow. Add or extend a unit test using httptest.Server for matching and non-matching response bodies. Done means the configured body assertion is applied, the matching rule is documented, and mismatch output is bounded without exposing an unbounded body.
Written by the indexing model from the issue text.
Description
What happened:
The pipedv1 HTTP analysis provider accepts an expectedResponse value in AnalysisHTTP, but it never reads or evaluates the HTTP response body. Provider.Run in pkg/app/pipedv1/plugin/analysis/analysisprovider/http/http.go only compares res.StatusCode with expectedCode and returns success immediately afterward.
As a result, an ANALYSIS stage passes when an endpoint returns the expected HTTP status but an unhealthy or otherwise unexpected response body. For example, a health endpoint returning 200 OK with {"status":"unhealthy"} passes even when expectedResponse is configured as {"status":"healthy"}.
What you expected to happen:
When expectedResponse is configured, the HTTP analysis should read the response body and fail the check when it does not match the configured expectation. A matching status code alone should not mark the analysis as successful when a body assertion is present.
The matching rule should be documented clearly (for example, exact body match or substring match), and failure output should identify the response-body mismatch without exposing an unbounded response body.
How to reproduce it:
-
Start an HTTP endpoint that always returns
200 OKwith this body:{"status":"unhealthy"} -
Configure an HTTP analysis check with a different expected response:
https: - url: http://localhost:8080/healthz method: GET expectedCode: 200 expectedResponse: '{"status":"healthy"}' interval: 10s timeout: 30s -
Run an ANALYSIS stage that uses this check.
-
Observe that the check succeeds because the status code is 200, despite the body being
{"status":"unhealthy"}rather than the configuredexpectedResponse.
The same behavior can be reproduced directly in a unit test with an httptest.Server that returns status 200 and a non-matching body, then calling http.Provider.Run with the configuration above.
Environment:
pipedversion: reproduced from source at3f7551c96(replace with the release/image version if reproducing in a deployed environment)control-planeversion: not version-specific; the behavior is in the pipedv1 HTTP analysis provider- Others: pipedv1 analysis plugin; an HTTP endpoint that returns the configured status code with a non-matching body
Relevant code:
pkg/app/pipedv1/plugin/analysis/config/condition.godeclaresAnalysisHTTP.ExpectedResponse.pkg/app/pipedv1/plugin/analysis/analysisprovider/http/http.gocurrently checks onlyExpectedCodeand contains a TODO for response-body evaluation.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 365
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 84
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pipe-cd/pipecd
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Label scoped RBAC policies are rejected by the role dialog, so roles that use them cannot be edited Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100