GitLabgitlab-org

cli

main
ply7 git calls278 ms100 KiB4 cachedprotocol v2
578 lines16 KiBRaw
1//go:build !integration
3package gomodproxy
5import (
6 "context"
7 "errors"
8 "io"
9 "net/http"
10 "strings"
11 "sync"
12 "sync/atomic"
13 "testing"
14 "time"
16 "github.com/stretchr/testify/assert"
17 "github.com/stretchr/testify/require"
18 "go.uber.org/goleak"
20 "gitlab.com/gitlab-org/cli/internal/dependencyfirewall/policy"
21 "gitlab.com/gitlab-org/cli/internal/dependencyfirewall/verdict"
24type stubChecker struct {
25 result policy.Result
26 err error
27 calls atomic.Int64
30func (s *stubChecker) Check(context.Context, policy.Request) (policy.Result, error) {
31 s.calls.Add(1)
32 return s.result, s.err
35type backendStub struct {
36 mu sync.Mutex
37 hits int
38 paths []string
39 body string
40 status int
43func (b *backendStub) ServeHTTP(w http.ResponseWriter, r *http.Request) {
44 b.mu.Lock()
45 b.hits++
46 b.paths = append(b.paths, r.URL.Path)
47 b.mu.Unlock()
48 if b.status != 0 {
49 w.WriteHeader(b.status)
50 }
51 body := b.body
52 if body == "" {
53 body = "upstream-bytes"
54 }
55 _, _ = io.WriteString(w, body)
58func (b *backendStub) count() int {
59 b.mu.Lock()
60 defer b.mu.Unlock()
61 return b.hits
64func (b *backendStub) lastPath() string {
65 b.mu.Lock()
66 defer b.mu.Unlock()
67 if len(b.paths) == 0 {
68 return ""
69 }
70 return b.paths[len(b.paths)-1]
73func startServer(t *testing.T, checker policy.Checker, backend http.Handler) *Server {
74 t.Helper()
75 s := New(checker, "group/proj", backend)
76 require.NoError(t, s.Start())
77 t.Cleanup(s.Stop)
78 return s
81type response struct {
82 status int
83 contentType string
84 body string
87func do(t *testing.T, method, rawURL string) response {
88 t.Helper()
89 req, err := http.NewRequestWithContext(t.Context(), method, rawURL, http.NoBody)
90 require.NoError(t, err)
92 res, err := http.DefaultClient.Do(req)
93 require.NoError(t, err)
94 defer res.Body.Close()
96 body, err := io.ReadAll(res.Body)
97 require.NoError(t, err)
99 return response{
100 status: res.StatusCode,
101 contentType: res.Header.Get("Content-Type"),
102 body: string(body),
103 }
106func get(t *testing.T, s *Server, suffix string) response {
107 t.Helper()
108 return do(t, http.MethodGet, s.BaseURL()+suffix)
111func TestAllowedZipReachesBackendVerbatim(t *testing.T) {
112 t.Parallel()
113 checker := &stubChecker{result: policy.Result{}}
114 backend := &backendStub{body: "zip-bytes"}
115 s := startServer(t, checker, backend)
117 res := get(t, s, "/github.com/pkg/errors/@v/v0.9.1.zip")
119 assert.Equal(t, http.StatusOK, res.status)
120 assert.Equal(t, "zip-bytes", res.body)
121 assert.Equal(t, 1, backend.count())
122 assert.Equal(t, int64(1), checker.calls.Load())
123 assert.Empty(t, s.Verdicts(), "allowed coordinates are not recorded")
124 assert.Equal(t, 1, s.CheckedZips())
127func TestBlockedZipIsRefusedAndRecorded(t *testing.T) {
128 t.Parallel()
129 checker := &stubChecker{result: policy.Result{Verdict: verdict.Blocked, Reason: "policy violation"}}
130 backend := &backendStub{}
131 s := startServer(t, checker, backend)
133 res := get(t, s, "/github.com/pkg/errors/@v/v0.9.1.zip")
135 assert.Equal(t, http.StatusForbidden, res.status)
136 assert.Equal(t, "text/plain; charset=utf-8", res.contentType)
137 assert.Contains(t, res.body, "github.com/pkg/errors")
138 assert.Contains(t, res.body, "policy violation")
139 assert.Zero(t, backend.count(), "a blocked module must never reach the backend")
141 entries := s.Verdicts()
142 require.Len(t, entries, 1)
143 assert.Equal(t, "github.com/pkg/errors", entries[0].Package)
144 assert.Equal(t, "v0.9.1", entries[0].Version)
145 assert.Equal(t, verdict.Blocked, entries[0].Verdict)
146 assert.Equal(t, http.StatusForbidden, entries[0].Status)
147 assert.Equal(t, 1, s.CheckedZips())
150func TestWarnedZipIsServedAndRecorded(t *testing.T) {
151 t.Parallel()
152 checker := &stubChecker{result: policy.Result{Verdict: verdict.Warning, Reason: "deprecated"}}
153 backend := &backendStub{}
154 s := startServer(t, checker, backend)
156 res := get(t, s, "/github.com/pkg/errors/@v/v0.9.1.zip")
157 assert.Equal(t, http.StatusOK, res.status)
158 assert.Equal(t, 1, backend.count())
160 entries := s.Verdicts()
161 require.Len(t, entries, 1)
162 assert.Equal(t, verdict.Warning, entries[0].Verdict)
163 assert.Equal(t, "deprecated", entries[0].Reason)
164 assert.Zero(t, entries[0].Status)
165 assert.Equal(t, 1, s.CheckedZips())
168func TestCheckerErrorFailsClosed(t *testing.T) {
169 t.Parallel()
170 checker := &stubChecker{err: errors.New("boom")}
171 backend := &backendStub{}
172 s := startServer(t, checker, backend)
174 res := get(t, s, "/github.com/pkg/errors/@v/v0.9.1.zip")
176 assert.Equal(t, http.StatusForbidden, res.status)
177 assert.Contains(t, res.body, "policy check failed")
178 assert.Zero(t, backend.count())
179 require.Len(t, s.Verdicts(), 1)
180 assert.Equal(t, verdict.Blocked, s.Verdicts()[0].Verdict)
181 assert.Equal(t, 1, s.CheckedZips())
184func TestMetadataPassesThroughUngated(t *testing.T) {
185 t.Parallel()
186 checker := &stubChecker{result: policy.Result{Verdict: verdict.Blocked, Reason: "would block"}}
187 backend := &backendStub{}
188 s := startServer(t, checker, backend)
190 for _, suffix := range []string{
191 "/github.com/pkg/errors/@v/v0.9.1.info",
192 "/github.com/pkg/errors/@v/v0.9.1.mod",
193 "/github.com/pkg/errors/@v/list",
194 "/github.com/pkg/errors/@latest",
195 "/github.com/@v/v1.6.0.info",
196 "/github.com/google/@v/v1.6.0.info",
197 } {
198 res := get(t, s, suffix)
199 assert.Equal(t, http.StatusOK, res.status, suffix)
200 }
202 assert.Equal(t, 6, backend.count())
203 assert.Zero(t, checker.calls.Load(), "metadata must not reach the firewall")
204 assert.Empty(t, s.Verdicts())
205 assert.Zero(t, s.CheckedZips())
208func TestSumDBReachesBackend(t *testing.T) {
209 t.Parallel()
210 checker := &stubChecker{result: policy.Result{Verdict: verdict.Blocked}}
211 backend := &backendStub{}
212 s := startServer(t, checker, backend)
214 res := get(t, s, "/sumdb/sum.golang.org/supported")
215 assert.Equal(t, http.StatusOK, res.status)
216 assert.Equal(t, 1, backend.count())
217 assert.Equal(t, "/sumdb/sum.golang.org/supported", backend.lastPath())
218 assert.Zero(t, checker.calls.Load())
221func TestToolchainZipIsExempt(t *testing.T) {
222 t.Parallel()
223 checker := &stubChecker{result: policy.Result{Verdict: verdict.Blocked}}
224 backend := &backendStub{}
225 s := startServer(t, checker, backend)
227 res := get(t, s, "/golang.org/toolchain/@v/v0.0.1-go1.27.0.darwin-arm64.zip")
228 assert.Equal(t, http.StatusOK, res.status)
229 rc := get(t, s, "/golang.org/toolchain/@v/v0.0.1-go1.27rc1.linux-amd64.zip")
230 assert.Equal(t, http.StatusOK, rc.status)
231 assert.Equal(t, 2, backend.count())
232 assert.Zero(t, checker.calls.Load())
233 assert.Empty(t, s.Verdicts())
234 assert.Zero(t, s.CheckedZips())
237func TestUnparseablePathIsRefusedNotDelegated(t *testing.T) {
238 t.Parallel()
239 checker := &stubChecker{}
240 backend := &backendStub{}
241 s := startServer(t, checker, backend)
243 for _, suffix := range []string{
244 "/example.com/M/@v/v1.0.0.zip",
245 "/not-a-module-path",
246 "//github.com/x/@v/v1.0.0.zip",
247 } {
248 res := get(t, s, suffix)
249 assert.Equal(t, http.StatusNotFound, res.status, suffix)
250 }
251 assert.Zero(t, backend.count(), "an unclassifiable path must not reach the backend")
252 assert.Zero(t, checker.calls.Load())
255func TestNonGetIsRejected(t *testing.T) {
256 t.Parallel()
257 checker := &stubChecker{}
258 backend := &backendStub{}
259 s := startServer(t, checker, backend)
261 res := do(t, http.MethodPost, s.BaseURL()+"/github.com/pkg/errors/@v/v0.9.1.zip")
263 assert.Equal(t, http.StatusMethodNotAllowed, res.status)
264 assert.Zero(t, backend.count())
267func TestConcurrentBlocksRecordOneVerdict(t *testing.T) {
268 t.Parallel()
269 checker := &stubChecker{result: policy.Result{Verdict: verdict.Blocked, Reason: "nope"}}
270 backend := &backendStub{}
271 s := startServer(t, checker, backend)
273 var wg sync.WaitGroup
274 for range 8 {
275 wg.Go(func() {
276 res, err := http.Get(s.BaseURL() + "/github.com/pkg/errors/@v/v0.9.1.zip")
277 if err == nil {
278 _, _ = io.Copy(io.Discard, res.Body)
279 _ = res.Body.Close()
280 }
281 })
282 }
283 wg.Wait()
285 assert.Len(t, s.Verdicts(), 1, "verdicts dedupe by entry key")
288func TestBaseURLEmptyBeforeStart(t *testing.T) {
289 t.Parallel()
290 s := New(&stubChecker{}, "group/proj", &backendStub{})
291 assert.Empty(t, s.BaseURL())
294func TestBaseURLCarriesPerRunPathToken(t *testing.T) {
295 t.Parallel()
296 s := startServer(t, &stubChecker{}, &backendStub{})
297 other := startServer(t, &stubChecker{}, &backendStub{})
299 host, token, found := strings.Cut(strings.TrimPrefix(s.BaseURL(), "http://"), "/")
300 require.True(t, found, "BaseURL %q has no path token", s.BaseURL())
301 assert.Equal(t, s.listener.Addr().String(), host)
302 assert.NotEmpty(t, token)
303 assert.NotContains(t, token, "/")
305 _, otherToken, _ := strings.Cut(strings.TrimPrefix(other.BaseURL(), "http://"), "/")
306 assert.NotEqual(t, token, otherToken, "the token is random per server")
309func TestMissingOrWrongPathTokenIsRefused(t *testing.T) {
310 t.Parallel()
311 checker := &stubChecker{}
312 backend := &backendStub{}
313 s := startServer(t, checker, backend)
314 root := "http://" + s.listener.Addr().String()
316 missing := do(t, http.MethodGet, root+"/github.com/pkg/errors/@v/v0.9.1.info")
317 assert.Equal(t, http.StatusNotFound, missing.status)
319 wrong := do(t, http.MethodGet, root+"/not-the-token/github.com/pkg/errors/@v/v0.9.1.zip")
320 assert.Equal(t, http.StatusNotFound, wrong.status)
322 sumdb := do(t, http.MethodGet, root+"/sumdb/sum.golang.org/supported")
323 assert.Equal(t, http.StatusNotFound, sumdb.status)
325 assert.Zero(t, backend.count())
326 assert.Zero(t, checker.calls.Load())
329func TestForeignHostIsRefused(t *testing.T) {
330 t.Parallel()
331 checker := &stubChecker{}
332 backend := &backendStub{}
333 s := startServer(t, checker, backend)
335 req, err := http.NewRequestWithContext(t.Context(), http.MethodGet, s.BaseURL()+"/github.com/pkg/errors/@v/v0.9.1.info", http.NoBody)
336 require.NoError(t, err)
337 req.Host = "evil.example"
338 res, err := http.DefaultClient.Do(req)
339 require.NoError(t, err)
340 require.NoError(t, res.Body.Close())
342 assert.Equal(t, http.StatusNotFound, res.StatusCode)
343 assert.Zero(t, backend.count())
344 assert.Zero(t, checker.calls.Load())
347func TestToolchainLookalikeZipIsChecked(t *testing.T) {
348 t.Parallel()
349 tests := []struct {
350 name string
351 suffix string
352 }{
353 {name: "submodule of toolchain", suffix: "/golang.org/toolchain/x/@v/v0.0.1-go1.27.0.darwin-arm64.zip"},
354 {name: "ordinary version", suffix: "/golang.org/toolchain/@v/v1.0.0.zip"},
355 {name: "toolchain prefix without platform", suffix: "/golang.org/toolchain/@v/v0.0.1-go1.27.0.zip"},
356 {name: "toolchain prefix with non-release", suffix: "/golang.org/toolchain/@v/v0.0.1-evil.darwin-arm64.zip"},
357 }
358 for _, tc := range tests {
359 t.Run(tc.name, func(t *testing.T) {
360 t.Parallel()
361 checker := &stubChecker{result: policy.Result{Verdict: verdict.Blocked, Reason: "not a toolchain"}}
362 backend := &backendStub{}
363 s := startServer(t, checker, backend)
365 res := get(t, s, tc.suffix)
367 assert.Equal(t, http.StatusForbidden, res.status)
368 assert.Equal(t, int64(1), checker.calls.Load())
369 assert.Zero(t, backend.count())
370 })
371 }
374type hangingChecker struct {
375 entered chan struct{}
378func (h *hangingChecker) Check(ctx context.Context, _ policy.Request) (policy.Result, error) {
379 close(h.entered)
380 <-ctx.Done()
381 return policy.Result{}, ctx.Err()
384type cancellableBackend struct {
385 entered chan struct{}
388func (h *cancellableBackend) ServeHTTP(_ http.ResponseWriter, r *http.Request) {
389 close(h.entered)
390 <-r.Context().Done()
393type wedgedBackend struct {
394 entered chan struct{}
395 release chan struct{}
398func (h *wedgedBackend) ServeHTTP(http.ResponseWriter, *http.Request) {
399 close(h.entered)
400 <-h.release
403func stopWithin(t *testing.T, s *Server, limit time.Duration) {
404 t.Helper()
405 stopped := make(chan struct{})
406 go func() {
407 s.Stop()
408 close(stopped)
409 }()
410 select {
411 case <-stopped:
412 case <-time.After(limit):
413 t.Fatalf("Stop did not return within %s", limit)
414 }
417func getZipInBackground(s *Server) (<-chan struct{}, func()) {
418 client := &http.Client{Transport: &http.Transport{}}
419 ch := make(chan struct{})
420 go func() {
421 defer close(ch)
422 res, err := client.Get(s.BaseURL() + "/github.com/pkg/errors/@v/v0.9.1.zip")
423 if err == nil {
424 _ = res.Body.Close()
425 }
426 }()
427 return ch, client.CloseIdleConnections
430func TestStopCancelsHangingBackendRequest(t *testing.T) {
431 defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
433 backend := &cancellableBackend{entered: make(chan struct{})}
434 s := New(&stubChecker{}, "group/proj", backend)
435 require.NoError(t, s.Start())
437 done, closeIdle := getZipInBackground(s)
438 <-backend.entered
440 stopWithin(t, s, drainTimeout/2)
441 <-done
442 closeIdle()
445func TestStopIsBoundedWhileBackendIgnoresCancellation(t *testing.T) {
446 defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
448 backend := &wedgedBackend{entered: make(chan struct{}), release: make(chan struct{})}
449 s := New(&stubChecker{}, "group/proj", backend)
450 require.NoError(t, s.Start())
452 done, closeIdle := getZipInBackground(s)
453 <-backend.entered
455 stopWithin(t, s, drainTimeout+2*time.Second)
456 <-done
457 close(backend.release)
458 closeIdle()
461func TestStopCancelsHangingPolicyCheckWithoutVerdict(t *testing.T) {
462 defer goleak.VerifyNone(t, goleak.IgnoreCurrent())
464 checker := &hangingChecker{entered: make(chan struct{})}
465 backend := &backendStub{}
466 s := New(checker, "group/proj", backend)
467 require.NoError(t, s.Start())
469 done, closeIdle := getZipInBackground(s)
470 <-checker.entered
472 stopWithin(t, s, drainTimeout)
473 <-done
474 closeIdle()
476 assert.Empty(t, s.Verdicts(), "a check cut short by Stop is not a firewall decision")
477 assert.Zero(t, backend.count())
478 assert.Zero(t, s.CheckedZips())
481type ctxErrChecker struct{}
483func (ctxErrChecker) Check(ctx context.Context, _ policy.Request) (policy.Result, error) {
484 return policy.Result{}, ctx.Err()
487// A request on a still-open keep-alive connection can reach check after
488// Stop. Both select arms are then ready and Go picks one at random, so the
489// check runs repeatedly to reach the arm that receives the failed result.
490func TestCheckAfterStopIsNotADecision(t *testing.T) {
491 t.Parallel()
492 s := New(ctxErrChecker{}, "group/proj", &backendStub{})
493 s.Stop()
495 for range 100_000 {
496 _, decided := s.check(request{module: "github.com/pkg/errors", version: "v0.9.1", kind: kindZip})
497 require.False(t, decided, "a check ended by Stop is not a firewall decision")
498 }
499 assert.Zero(t, s.CheckedZips())
502// wedgedChecker never sees cancellation, like the inner call
503// policy.CachingChecker makes under context.WithoutCancel, and fails once
504// released.
505type wedgedChecker struct {
506 entered chan struct{}
507 release chan struct{}
510func (c *wedgedChecker) Check(context.Context, policy.Request) (policy.Result, error) {
511 close(c.entered)
512 <-c.release
513 return policy.Result{}, errors.New("policy API unreachable")
516func TestStopAbandonsCheckThatIgnoresCancellation(t *testing.T) {
517 ignore := goleak.IgnoreCurrent()
519 inner := &wedgedChecker{entered: make(chan struct{}), release: make(chan struct{})}
520 backend := &backendStub{}
521 s := New(policy.NewCachingChecker(inner, nil), "group/proj", backend)
522 require.NoError(t, s.Start())
524 done, closeIdle := getZipInBackground(s)
525 <-inner.entered
527 stopWithin(t, s, drainTimeout/2)
528 <-done
529 closeIdle()
530 close(inner.release)
531 goleak.VerifyNone(t, ignore)
533 assert.Empty(t, s.Verdicts(), "a check abandoned by Stop is not a firewall decision")
534 assert.Zero(t, backend.count())
535 assert.Zero(t, s.CheckedZips())
538func TestStopIsIdempotent(t *testing.T) {
539 t.Parallel()
540 s := New(&stubChecker{}, "group/proj", &backendStub{})
541 assert.NotPanics(t, s.Stop, "Stop before Start must be safe")
543 s2 := New(&stubChecker{}, "group/proj", &backendStub{})
544 require.NoError(t, s2.Start())
545 assert.NotPanics(t, s2.Stop)
546 assert.NotPanics(t, s2.Stop)
549type panickingChecker struct{}
551func (panickingChecker) Check(context.Context, policy.Request) (policy.Result, error) {
552 panic("secret-token in a checker bug")
555func TestPanickingCheckBlocksInsteadOfCrashing(t *testing.T) {
556 t.Parallel()
557 for name, checker := range map[string]policy.Checker{
558 "when the checker panics": panickingChecker{},
559 "when the checker panics behind the cache": policy.NewCachingChecker(panickingChecker{}, nil),
560 } {
561 t.Run(name, func(t *testing.T) {
562 t.Parallel()
563 backend := &backendStub{}
564 s := startServer(t, checker, backend)
566 res := get(t, s, "/github.com/pkg/errors/@v/v0.9.1.zip")
568 assert.Equal(t, http.StatusForbidden, res.status)
569 assert.Contains(t, res.body, "Blocked: glab internal error while checking github.com/pkg/errors@v0.9.1")
570 assert.NotContains(t, res.body, "secret-token", "the panic value stays out of the response")
571 assert.Zero(t, backend.count(), "a module whose check panicked must never reach the backend")
572 entries := s.Verdicts()
573 require.Len(t, entries, 1)
574 assert.Equal(t, verdict.Blocked, entries[0].Verdict)
575 assert.Contains(t, entries[0].Reason, "glab hit an internal error while checking github.com/pkg/errors@v0.9.1 and blocked it")
576 })
577 }
Diagnostics7 git calls · 278 ms
CallStatusSizeTime0278 ms
discover200185 B4 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=59849
git.response.cache=UPDATING
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchtree:0 · deepen 1020032 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0200361 B · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=361
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=506cba622ceda1473ee3cde63969809c144b7247
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=361
git.pkt.payload.max=334
git.sideband.band1.bytes=334
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=334
git.pack.trailer=26d32585a3a474717e00a318584ccd16918c9d32
Open pack map
fetchtree:0200379 B · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=264
git.response.bytes=379
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=21702eb6df99111b4d7a039e655c720d4209d5b6
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=379
git.pkt.payload.max=352
git.sideband.band1.bytes=352
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=352
git.pack.trailer=7d54607262a7ed73d2686c4df38d0272960c21fc
Open pack map
fetch2003.9 KiB264 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=4011
git.response.cache=MISS
git.response.duration_ms=264
git.fetch.wants=b4647edfbcf2fe8e8c2f78622788058eadf29dcf
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=4011
git.pkt.payload.max=3984
git.sideband.band1.bytes=3984
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e208038a43c69c
Request
0cd361ab…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format