๐ bug: serve a request with a TLS state over TLS in app.Test #4839
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.68) ร (1 โ Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 ยท Change Risk (XGBoost)
Score: 0.68 ยท 403 lines diff across 5 files
Model 2 ยท Review Depth (DistilBERT)
Depth Score: 0.17 ยท 1 substantive comment(s)
Model 3 ยท Review Timing & Attention
Session adequacy: 100% ยท Reviewer familiarity: 35%
Bedrock Claude 3 ยท Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 ยท Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.068
Real PR Conversation Timeline
1 comments
"Review active on #4839"
general
weight: 0.35
nk-batman21
Description
httptest.NewRequestgives anhttps://target a non-nilreq.TLS, butapp.Testserves the dumped request on a plain in-memory connection. In the handlerc.Scheme()is thenhttp,c.Secure()isfalse,c.BaseURL()ishttp://example.comandc.RequestCtx().TLSConnectionState()is nil, so testing HTTPS-dependent behaviour withapp.Testfails, or passes for the wrong reason:csrf.New(), a same-originPOST https://example.com/withOrigin: https://example.comand a valid token gets403 Forbidden, because the origin is compared withhttp://example.com. The same flow overhttp://gets200.helmet.New(helmet.Config{HSTSMaxAge: 3600}),GET https://example.com/has noStrict-Transport-Securityheader.app.Testnow serves a request with aTLSstate on atestTLSConn, which has theConnectionStateandHandshakemethods fasthttp detects TLS by and returns*req.TLS. This is whatadaptor.FiberAppalready does withr.TLS. A request without a TLS state is served as before; one built withhttp.NewRequestor a path-only target can setreq.TLSto be served over TLS. Existing tests that sendhttps://targets now seehttps. With the change both cases above answer200 savedandmax-age=3600; includeSubDomains.Test_App_Test_TLScovers anhttps://target and a request with a TLS state set by hand (both fail onmain), and keepshttp://and path-only targets onhttp.docs/api/app.md(Test) anddocs/whats_new.mdget one sentence each.Ran:
go test ./... -count=1 -shuffle=on,golangci-lint run ./...(v2.14.0),gofumpt -extra=group_params -l .,go vet ./...,betteralign -test_files -generated_files ./...(v0.8.0),markdownlint-cli2on the two docs files.Changes introduced
Type of change
Checklist
/docs/directory for Fiber's documentation.<!-- pr-command-hint -->
<sub>๐ค Maintainers:
/generatere-runs the code generators on this branch</sub>