GitLabgitlab-org

cli

main
ply6 git calls197 ms96 KiB3 cachedprotocol v2
67 lines1.9 KiBRaw
1package oauth2
3import (
4 "encoding/hex"
5 "errors"
6 "strings"
7)
9// gitlabTokenPrefixes lists standard token prefixes generated by GitLab.
10var gitlabTokenPrefixes = []string{
11 "glcbt-",
12 "gldt-",
13 "glrt-",
14 "glrtr-",
15 "glft-",
16 "glptt-",
17 "glimt-",
18 "glagent-",
19 "glsoat-",
20 "glffct-",
21 "glwt-",
24// validateTokenPrefix detects common mistake values such as personal access tokens (glpat-)
25// or application secrets (gloas-) and returns descriptive error messages.
26func validateTokenPrefix(clientID string) error {
27 trimmed := strings.TrimSpace(clientID)
28 lower := strings.ToLower(trimmed)
29 if strings.HasPrefix(lower, "glpat-") {
30 return errors.New("value is a personal access token (glpat-), not an OAuth application ID")
31 }
32 if strings.HasPrefix(lower, "gloas-") {
33 return errors.New("value is an OAuth application secret (gloas-), not the Application ID (glab is a public client and does not use a secret)")
34 }
35 for _, prefix := range gitlabTokenPrefixes {
36 if strings.HasPrefix(lower, prefix) {
37 return errors.New("value appears to be a GitLab token, not an OAuth application ID")
38 }
39 }
41 return nil
44// ValidateClientID checks that clientID is a 64-character hexadecimal string
45// as generated by GitLab OAuth Application registrations.
46// It also detects common mistake values such as personal access tokens (glpat-)
47// or application secrets (gloas-) and returns descriptive error messages.
48func ValidateClientID(clientID string) error {
49 trimmed := strings.TrimSpace(clientID)
50 if trimmed == "" {
51 return errors.New("OAuth application ID cannot be empty")
52 }
54 if err := validateTokenPrefix(trimmed); err != nil {
55 return err
56 }
58 if len(trimmed) != 64 {
59 return errors.New("OAuth application ID must be 64 hexadecimal characters")
60 }
62 if _, err := hex.DecodeString(trimmed); err != nil {
63 return errors.New("OAuth application ID must be 64 hexadecimal characters")
64 }
66 return nil
Diagnostics6 git calls · 197 ms
CallStatusSizeTime0197 ms
discover200185 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
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=2
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=3
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=4
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:0200468 B · hit3 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=468
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=c498f09dbd0cebbc59f9eff3b3ef8be66186fac6
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=468
git.pkt.payload.max=441
git.sideband.band1.bytes=441
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=441
git.pack.trailer=6420a98b3b2e923a6b61c550c00de326d620e479
Open pack map
fetch200712 B187 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=187
git.response.bytes=712
git.response.cache=MISS
git.response.duration_ms=187
git.fetch.wants=b0d29365bcd2c2f7cd856f6d28261844a3f1f252
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=712
git.pkt.payload.max=685
git.sideband.band1.bytes=685
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
a5e21addfc8aecd4
Request
be7e5a4e…
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