GitLabgitlab-org

cli

main
ply7 git calls203 ms103 KiB4 cachedprotocol v2
479 lines18 KiBRaw
1package pm
3import (
4 "bytes"
5 "crypto/x509"
6 "encoding/xml"
7 "errors"
8 "fmt"
9 "io"
10 "io/fs"
11 "net/url"
12 "os"
13 "os/exec"
14 "regexp"
15 "slices"
16 "strings"
18 "gitlab.com/gitlab-org/cli/internal/dbg"
19 "gitlab.com/gitlab-org/cli/internal/dependencyfirewall/proxy"
22// mavenManager routes mvn through the proxy via a settings.xml <proxy> block,
23// since Maven ignores HTTP(S)_PROXY, merged into the caller's own settings.
24type mavenManager struct {
25 proxyURL string
26 args []string
27 // mirrors is shared with the matcher Run hands the proxy before
28 // CATrustEnviron runs, and filled once the settings Maven reads are known.
29 mirrors *proxy.MavenMirrors
30 lookPath func(file string) (string, error)
33// Maven returns a fresh maven package manager (it stashes the proxy URL from
34// Environment for CATrustEnviron to build the settings.xml and truststore).
35func Maven() PackageManager {
36 return &mavenManager{mirrors: &proxy.MavenMirrors{}, lookPath: exec.LookPath}
39func (m *mavenManager) Name() string { return "maven" }
40func (m *mavenManager) Binary() string { return "mvn" }
42// SetArgs stashes the mvn arguments so CATrustEnviron can merge the caller's
43// settings file into the firewall's.
44func (m *mavenManager) SetArgs(args []string) { m.args = args }
46// userSettingsFile resolves the settings.xml mvn would read on its own.
47func (m *mavenManager) userSettingsFile() string {
48 dir, err := os.Getwd()
49 if err != nil {
50 dbg.Debugf("dependency firewall: could not get the working directory to resolve the maven settings file: %v; treating the caller as having no settings file", err)
51 return ""
52 }
53 return mavenUserSettingsFile(os.Environ(), dir, m.args)
56// Environment stashes the proxy URL; the settings.xml and truststore are
57// emitted from CATrustEnviron (called last by Run, after the CA bundle
58// exists) so both the routing and the trust anchor land together.
59func (m *mavenManager) Environment(proxyURL string) []string {
60 m.proxyURL = proxyURL
61 return nil
64func (m *mavenManager) CATrustEnviron(caPath string) []string {
65 var env []string
67 // Routing: a settings.xml <proxy> block. Written next to the CA bundle so
68 // Run, which removes caPath and its siblings, cleans it up too. Maven
69 // ignores HTTP(S)_PROXY and the JVM proxy properties, so this file is the
70 // only thing routing mvn through the proxy: surface a failure via dbg so a
71 // silent firewall bypass is diagnosable rather than fail-open unnoticed.
72 settingsPath, userSettings, ok := writeMavenProxySettings(caPath+".settings.xml", m.proxyURL, m.userSettingsFile(), os.Environ())
73 if !ok {
74 dbg.Debugf("dependency firewall: failed to write maven proxy settings.xml at %s; maven traffic will not be routed through the proxy", caPath+".settings.xml")
75 } else {
76 args := "-s " + settingsPath
77 if global, ok := m.pinGlobalSettings(userSettings, caPath+".global-settings.xml"); ok {
78 args += " -gs " + global
79 }
80 env = append(env, mavenArgsEnv(args))
81 }
83 // CA trust: a PKCS#12 truststore folded into MAVEN_OPTS.
84 if opts := JVMTrustOpts(caPath); opts != "" {
85 env = append(env, "MAVEN_OPTS="+opts)
86 }
88 return env
91// ExistingBundleVars is empty: Maven trusts the proxy through a generated JVM
92// truststore (MAVEN_OPTS), not a user-provided CA-bundle environment variable,
93// so there is nothing for the engine to prepend.
94func (m *mavenManager) ExistingBundleVars() []string { return nil }
96// CleanupCAFiles removes the settings files and PKCS#12 truststore this
97// manager writes next to the CA bundle in CATrustEnviron.
98func (m *mavenManager) CleanupCAFiles(caPath string) {
99 _ = os.Remove(caPath + ".settings.xml")
100 _ = os.Remove(caPath + ".global-settings.xml")
101 _ = os.Remove(caPath + ".p12")
104// upstreamTrustAnchors returns the certificates in the truststore mvn's JVM
105// would load. glab replaces that truststore for the child, so the user's
106// anchors move to the registry side. Maven 3's launcher passes jvm.config
107// before MAVEN_OPTS and MAVEN_DEBUG_OPTS, and Maven 4's passes it after
108// MAVEN_OPTS; this follows Maven 3. The JVM reads JAVA_TOOL_OPTIONS first,
109// the java launcher puts JDK_JAVA_OPTIONS before the command line, and
110// _JAVA_OPTIONS comes last. A -D option in mvn's own arguments fills only a
111// property those leave unset, as on Maven 4: on Maven 3 it replaces glab's
112// truststore, so the run fails whatever registry connections trust. The
113// error also reports a truststore option in MAVEN_DEBUG_OPTS, _JAVA_OPTIONS
114// or mvn's own arguments, which replaces glab's in the child.
115func (m *mavenManager) upstreamTrustAnchors(env []string, dir string, args []string) ([]*x509.Certificate, error) {
116 argProps := mavenArgProperties(env, dir, args)
117 certs, err := jvmTrustAnchors(env, dir, argProps,
118 lookupEnv(env, "JAVA_TOOL_OPTIONS"), lookupEnv(env, "JDK_JAVA_OPTIONS"), mavenJVMConfig(env, dir, args),
119 lookupEnv(env, "MAVEN_OPTS"), lookupEnv(env, "MAVEN_DEBUG_OPTS"), lookupEnv(env, "_JAVA_OPTIONS"))
120 return certs, errors.Join(err,
121 jvmTrustStoreOverride(env, "mvn", "MAVEN_OPTS", "MAVEN_DEBUG_OPTS", "_JAVA_OPTIONS"),
122 argTrustStoreOverride(argProps, "-D%s in the mvn arguments replaces glab's truststore on Maven 3, so mvn cannot trust the dependency firewall proxy there; set it in MAVEN_OPTS instead"))
125func (m *mavenManager) Matcher() proxy.Matcher { return proxy.MavenMatcher{Mirrors: m.mirrors} }
127// pinGlobalSettings lets the matcher read downloads exactly when the user and
128// global settings name every mirror Maven can route through, a catch-all
129// among them. user is the caller's file, or nil when glab used its own, which
130// has no mirrors. It writes the global settings it read to path for Maven's
131// -gs: Maven takes the first -gs, so it reads exactly what glab checked.
132func (m *mavenManager) pinGlobalSettings(user []byte, path string) (string, bool) {
133 dir, err := os.Getwd()
134 if err != nil {
135 dbg.Debugf("dependency firewall: could not get the working directory: %v; guessing maven mirror prefixes", err)
136 return "", false
137 }
138 global, err := m.globalSettings(dir)
139 if err != nil {
140 dbg.Debugf("dependency firewall: could not read the maven global settings: %v; guessing maven mirror prefixes", err)
141 return "", false
142 }
143 global = mavenExpandEnvURLs(global, os.Environ())
144 urls, externalOnly, ok := mavenKnownMirrors(user, global)
145 if !ok {
146 dbg.Debugf("dependency firewall: the maven settings don't name a known catch-all mirror; guessing maven mirror prefixes")
147 return "", false
148 }
149 // Maven fails on a -gs file that doesn't exist, so an absent one becomes empty.
150 if global == nil {
151 global = []byte("<settings/>\n")
152 }
153 if err := os.WriteFile(path, global, 0o600); err != nil {
154 dbg.Debugf("dependency firewall: could not write the maven global settings for -gs: %v; guessing maven mirror prefixes", err)
155 return "", false
156 }
157 m.mirrors.Set(urls, externalOnly)
158 return path, true
161// globalSettings returns the global settings.xml Maven reads, or nil when
162// there is none.
163func (m *mavenManager) globalSettings(dir string) ([]byte, error) {
164 mvn, err := m.lookPath(m.Binary())
165 if err != nil {
166 return nil, fmt.Errorf("could not find %s: %w", m.Binary(), err)
167 }
168 path, err := mavenGlobalSettingsFile(os.Environ(), dir, m.args, mvn)
169 if err != nil {
170 return nil, err
171 }
172 raw, err := os.ReadFile(path)
173 if errors.Is(err, fs.ErrNotExist) {
174 return nil, nil
175 }
176 return raw, err
179// mavenSettingsError describes err for the debug log without the XML
180// decoder's message, which can quote the settings file, a password included.
181func mavenSettingsError(err error) string {
182 var syntax *xml.SyntaxError
183 if errors.As(err, &syntax) {
184 return fmt.Sprintf("XML syntax error on line %d", syntax.Line)
185 }
186 return err.Error()
189// mavenArgsEnv prepends extra to any inherited MAVEN_ARGS. Maven takes the
190// first occurrence of a repeated option, and its launcher expands MAVEN_ARGS
191// ahead of the command line, so putting the firewall's -s first is what makes
192// it win over a settings file the caller passed either way.
193func mavenArgsEnv(extra string) string {
194 if existing := os.Getenv("MAVEN_ARGS"); existing != "" {
195 return "MAVEN_ARGS=" + extra + " " + existing
196 }
197 return "MAVEN_ARGS=" + extra
200// MavenJobArgsEnv returns the MAVEN_ARGS entry that routes every mvn in a job
201// through the proxy at proxyURL. It writes, at path, the install's global
202// settings with the proxy entries merged in and passes them as -gs, so the
203// image's global mirrors still apply and a job's own -s still layers on top.
204// When the global settings can't be resolved or merged, the file holds only
205// the proxy entries and warnf says why, because the install's mirrors,
206// proxies and credentials then stop applying. No mvn on PATH is not reported:
207// it is the normal case for a job that doesn't use Maven.
208func MavenJobArgsEnv(path, proxyURL string, warnf func(format string, args ...any)) (string, error) {
209 global, err := mavenJobGlobalSettings()
210 if err != nil {
211 warnf("dependency firewall: could not resolve the maven global settings (%v); mvn will not use the install's conf/settings.xml\n", err)
212 }
213 settings, merged, ok := writeMavenProxySettings(path, proxyURL, global, os.Environ())
214 if !ok {
215 return "", fmt.Errorf("could not write maven proxy settings at %s", path)
216 }
217 if global != "" && merged == nil {
218 warnf("dependency firewall: could not merge the proxy into %s; mvn will not use it\n", global)
219 }
220 // The firewall proxy goes into the global (-gs) settings so a job's own -s
221 // still layers on top, but Maven merges user settings over global ones and
222 // uses the first active <proxy> per protocol, with user proxies winning. A
223 // <proxy> already in the user settings therefore routes mvn around the
224 // firewall. We cannot merge ours in first without seeing a job's future -s,
225 // so warn rather than silently leave mvn unproxied.
226 dir, _ := os.Getwd()
227 if mavenUserSettingsHasActiveProxy(mavenUserSettingsFile(os.Environ(), dir, nil)) {
228 warnf("dependency firewall: your Maven user settings define a <proxy> that Maven prefers over the firewall's global (-gs) settings; mvn may bypass the firewall\n")
229 }
230 return mavenArgsEnv("-gs " + settings), nil
233// mavenUserSettingsHasActiveProxy reports whether the user settings file at
234// settingsPath defines a <proxy> that is not explicitly inactive. An omitted
235// <active> counts as active, so the check never misses one. Parse errors and a
236// missing file report false: this only drives an advisory warning.
237func mavenUserSettingsHasActiveProxy(settingsPath string) bool {
238 if settingsPath == "" {
239 return false
240 }
241 raw, err := os.ReadFile(settingsPath)
242 if err != nil {
243 return false
244 }
245 var parsed struct {
246 Proxies []struct {
247 Active string `xml:"active"`
248 } `xml:"proxies>proxy"`
249 }
250 if err := xml.Unmarshal(raw, &parsed); err != nil {
251 return false
252 }
253 for _, p := range parsed.Proxies {
254 if !strings.EqualFold(strings.TrimSpace(p.Active), "false") {
255 return true
256 }
257 }
258 return false
261// mavenJobGlobalSettings returns the global settings file the mvn on PATH
262// reads, or "" when there is no mvn on PATH or the install has none.
263func mavenJobGlobalSettings() (string, error) {
264 mvn, err := exec.LookPath("mvn")
265 if err != nil {
266 return "", nil //nolint:nilerr // no mvn on PATH: nothing to preserve
267 }
268 dir, err := os.Getwd()
269 if err != nil {
270 return "", err
271 }
272 path, err := mavenGlobalSettingsFile(os.Environ(), dir, nil, mvn)
273 if err != nil {
274 return "", err
275 }
276 if _, err := os.Stat(path); err != nil {
277 if errors.Is(err, fs.ErrNotExist) {
278 return "", nil
279 }
280 return "", err
281 }
282 return path, nil
285// writeMavenProxySettings writes the settings.xml that routes mvn through the
286// proxy at proxyURL and returns its path. When userPath names a readable
287// settings file, the <proxy> entries are merged into a copy of it so the
288// caller's mirrors, credentials and profiles still apply, with the variables
289// in its repository URLs expanded from environ; otherwise the file holds only
290// those entries. It also returns the caller's settings when they were merged,
291// and ok=false when proxyURL cannot be parsed.
292func writeMavenProxySettings(path, proxyURL, userPath string, environ []string) (string, []byte, bool) {
293 u, err := url.Parse(proxyURL)
294 if err != nil || u.Hostname() == "" || u.Port() == "" {
295 return "", nil, false
296 }
297 proxies := mavenProxyElem("df-https", "https", u.Hostname(), u.Port()) +
298 mavenProxyElem("df-http", "http", u.Hostname(), u.Port())
300 var settings []byte
301 if userPath != "" {
302 settings, err = mergeMavenProxies(userPath, proxies)
303 if err != nil {
304 dbg.Debugf("dependency firewall: could not merge the maven settings at %s: %s; using the firewall's own settings instead", userPath, mavenSettingsError(err))
305 }
306 settings = mavenExpandEnvURLs(settings, environ)
307 }
308 merged := settings
309 if settings == nil {
310 // No usable settings to merge into. Routing the traffic matters more
311 // than carrying over a file we could not use, so fall back to a
312 // standalone settings.xml rather than leaving mvn unproxied.
313 settings = []byte("<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\">\n" +
314 " <proxies>\n" + proxies + " </proxies>\n" +
315 "</settings>\n")
316 }
317 if err := os.WriteFile(path, settings, 0o600); err != nil {
318 return "", nil, false
319 }
320 return path, merged, true
323// mergeMavenProxies returns the settings file at path with proxies inserted as
324// the first entries of its <proxies> element, creating that element when the
325// file has none. The rest of the document is copied byte for byte: re-encoding
326// it would rewrite namespaces and self-closing tags, which can break a
327// settings file that works today. Inserting first matters because Maven uses
328// the first active proxy for a protocol, so the firewall's entry has to precede
329// any the caller already had.
330func mergeMavenProxies(path, proxies string) ([]byte, error) {
331 raw, err := os.ReadFile(path)
332 if err != nil {
333 return nil, err
334 }
335 start, end, insert, err := mavenProxiesInsertion(raw, proxies)
336 if err != nil {
337 return nil, err
338 }
339 out := make([]byte, 0, len(raw)+len(insert))
340 out = append(out, raw[:start]...)
341 out = append(out, insert...)
342 return append(out, raw[end:]...), nil
345// mavenProxiesInsertion parses raw far enough to find where proxies belongs
346// and returns the byte range to replace with the returned text: an empty range
347// just inside an existing <proxies>, the "/>" of a self-closed <proxies/>, or
348// an empty range before </settings> when the document has no <proxies> at all.
349// Offsets come from the XML parser rather than a text search, so a <proxies>
350// inside a comment or a CDATA section cannot be mistaken for the real one.
351func mavenProxiesInsertion(raw []byte, proxies string) (int, int, string, error) {
352 dec := xml.NewDecoder(bytes.NewReader(raw))
353 depth, prevEnd := 0, 0
354 for {
355 tok, err := dec.Token()
356 if errors.Is(err, io.EOF) {
357 return 0, 0, "", errors.New("no <settings> element")
358 }
359 if err != nil {
360 return 0, 0, "", err
361 }
362 switch t := tok.(type) {
363 case xml.StartElement:
364 depth++
365 if depth == 2 && t.Name.Local == "proxies" {
366 at := int(dec.InputOffset())
367 // Reopen a self-closed <proxies/> rather than discarding the
368 // document: falling back would lose the caller's whole file.
369 if bytes.HasSuffix(raw[:at], []byte("/>")) {
370 return at - 2, at, ">\n" + proxies + " </proxies>", nil
371 }
372 return at, at, proxies, nil
373 }
374 case xml.EndElement:
375 if depth == 1 && t.Name.Local == "settings" {
376 // A self-closed <settings/> reports an end element at the same
377 // offset as its start, so prevEnd would sit outside the root.
378 if !bytes.HasPrefix(bytes.TrimLeft(raw[prevEnd:], " \t\r\n"), []byte("</")) {
379 return 0, 0, "", errors.New("self-closed <settings/> element")
380 }
381 return prevEnd, prevEnd, " <proxies>\n" + proxies + " </proxies>\n", nil
382 }
383 depth--
384 }
385 prevEnd = int(dec.InputOffset())
386 }
389// mavenRepositoryElems are the settings.xml elements Maven resolves artifacts
390// from, each holding the <url> it fetches from.
391var mavenRepositoryElems = [][]string{
392 {"settings", "mirrors", "mirror"},
393 {"settings", "profiles", "profile", "repositories", "repository"},
394 {"settings", "profiles", "profile", "pluginRepositories", "pluginRepository"},
397var mavenEnvExpression = regexp.MustCompile(`\$\{env\.[^}]*\}`)
399// mavenExpandEnvURLs expands ${env.NAME} in raw's mirror and profile repository
400// URLs from environ, so Maven fetches from the URL glab checks. A URL it can't
401// expand fully, and raw that doesn't parse, are left as they are.
402func mavenExpandEnvURLs(raw []byte, environ []string) []byte {
403 dec := xml.NewDecoder(bytes.NewReader(raw))
404 var path []string
405 var text strings.Builder
406 var out []byte
407 copied, start, pieces := 0, 0, 0
408 for {
409 end := int(dec.InputOffset())
410 tok, err := dec.Token()
411 if errors.Is(err, io.EOF) {
412 if out == nil {
413 return raw
414 }
415 return append(out, raw[copied:]...)
416 }
417 if err != nil {
418 return raw
419 }
420 switch t := tok.(type) {
421 case xml.StartElement:
422 path = append(path, t.Name.Local)
423 text.Reset()
424 start, pieces = int(dec.InputOffset()), 0
425 case xml.CharData:
426 text.Write(t)
427 pieces++
428 case xml.EndElement:
429 // A URL in several pieces of text, around a comment or a CDATA
430 // section, is left alone.
431 if pieces == 1 && t.Name.Local == "url" && mavenIsRepository(path[:len(path)-1]) {
432 if u, ok := mavenExpandEnv(strings.TrimSpace(text.String()), environ); ok {
433 var escaped bytes.Buffer
434 if err := xml.EscapeText(&escaped, []byte(u)); err != nil {
435 return raw
436 }
437 out = append(append(out, raw[copied:start]...), escaped.Bytes()...)
438 copied = end
439 }
440 }
441 path = path[:len(path)-1]
442 }
443 }
446// mavenExpandEnv expands every ${env.NAME} in s from environ. ok is false when
447// s has no expression, holds another kind, or names a variable that is unset or
448// empty, and when a value holds an expression Maven would expand again.
449func mavenExpandEnv(s string, environ []string) (string, bool) {
450 if !strings.Contains(s, "${") {
451 return "", false
452 }
453 ok := true
454 expanded := mavenEnvExpression.ReplaceAllStringFunc(s, func(expr string) string {
455 value := lookupEnv(environ, expr[len("${env."):len(expr)-1])
456 if value == "" {
457 ok = false
458 }
459 return value
460 })
461 if !ok || strings.Contains(expanded, "${") {
462 return "", false
463 }
464 return expanded, true
467func mavenIsRepository(path []string) bool {
468 return slices.ContainsFunc(mavenRepositoryElems, func(p []string) bool { return slices.Equal(p, path) })
471func mavenProxyElem(id, protocol, host, port string) string {
472 return " <proxy>\n" +
473 " <id>" + id + "</id>\n" +
474 " <active>true</active>\n" +
475 " <protocol>" + protocol + "</protocol>\n" +
476 " <host>" + host + "</host>\n" +
477 " <port>" + port + "</port>\n" +
478 " </proxy>\n"
Diagnostics7 git calls · 203 ms
CallStatusSizeTime0203 ms
discover200185 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
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 KiB2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=59849
git.response.cache=UPDATING
git.response.duration_ms=2
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
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit2 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=2
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:0 · deepen 1020032 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=0
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=2
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
fetchtree:0200361 B · hit0 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=361
git.response.cache=HIT
git.response.duration_ms=0
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:02001.3 KiB · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=194
git.response.bytes=1327
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=2758711b27b3e124482ce287b5df86092bb20d62
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=1327
git.pkt.payload.max=1300
git.sideband.band1.bytes=1300
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=1300
git.pack.trailer=c83fc6004a9a1360845513c0fb16272b5c14a3e4
Open pack map
fetch2006.3 KiB195 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=6409
git.response.cache=MISS
git.response.duration_ms=195
git.fetch.wants=5e1872e457cf17a2e5d7d93fc97fdadf8cce0035
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=6409
git.pkt.payload.max=6382
git.sideband.band1.bytes=6382
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
a5e2c68fd81e4afc
Request
09f3f6e8…
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