Artifactspublic-v0

ply

main
ply4 git calls24 ms39 KiB3 cachedprotocol v2
37 lines2.7 KiBRaw
1// Credential redaction (http.ts builds one from its Authorization). Its own module: pure, and testable without a transport.
3// The Basic user is a name on most hosts (`x-access-token`, `oauth2`, `git`, a login) and a secret on some (a deploy
4// token, a PAT given as the user). Scrubbing a name would mangle legitimate server text ("denied to ivar"), so the user
5// is scrubbed only when it is secret-shaped: at least 16 characters with a digit. Every token format seen (ghp_…, glpat-…,
6// hex, base64) is; every conventional user name is not. Below 4 characters nothing is scrubbed (it would eat text).
7// A user with no password beside it is the whole credential (the token-as-user form) and is a secret at 16 characters,
8// digit or not: a GitLab or GitHub token without one would otherwise stay readable.
9export const MIN_SECRET = 4;
10export const SECRET_USER_CHARS = 16;
11export const secretShaped = (s: unknown): boolean => typeof s === 'string' && s.length >= SECRET_USER_CHARS && /[0-9]/u.test(s);
12export const secretUser = (user: unknown, hasPassword: boolean): boolean => secretShaped(user) || (!hasPassword && typeof user === 'string' && user.length >= SECRET_USER_CHARS);
14// text → text with every secret replaced by '[redacted]'; null when there is nothing to hide. Server text is kept as a
15// tail or a prefix in places (progress, hook output, a quoted line), so a secret can arrive cut: any run of FRAGMENT or
16// more characters of a secret is redacted, not only whole ones. 12 characters of a random token cannot occur by chance
17// (a 12-hex window of a commit oid matches a hex token's with p ≈ 1e-13); shorter secrets are matched whole.
18export const FRAGMENT = 12;
19export const REDACTED = '[redacted]';
20export function scrubber(values: readonly unknown[]): ((text: unknown) => string) | null {
21 const secrets = values.filter((x): x is string => typeof x === 'string' && x.length >= MIN_SECRET);
22 if (secrets.length === 0) return null;
23 const whole = secrets.filter(x => x.length < FRAGMENT);
24 const grams = new Set<string>();
25 for (const x of secrets) for (let i = 0; i + FRAGMENT <= x.length; i++) grams.add(x.slice(i, i + FRAGMENT));
26 const cut = (s: string): string => {
27 let end = -1, from = 0, out = '', start = -1;
28 for (let i = 0; i + FRAGMENT <= s.length; i++) {
29 if (!grams.has(s.slice(i, i + FRAGMENT))) continue;
30 if (i > end) { if (start >= 0) { out += s.slice(from, start) + REDACTED; from = end; } start = i; }
31 end = i + FRAGMENT;
32 }
33 return start < 0 ? s : out + s.slice(from, start) + REDACTED + s.slice(end);
34 };
35 // oxlint-disable-next-line unicorn/no-array-reduce -- one expression; the loop form costs 17 B on every entry
36 return text => whole.reduce((acc, x) => acc.split(x).join(REDACTED), cut(String(text)));
Diagnostics4 git calls · 24 ms
CallStatusSizeTime024 ms
discover200152 B4 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=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200145 B · hit3 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=145
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=145
git.pkt.payload.max=76
git.ls_refs.count=2
git.ls_refs.head=refs/heads/main
fetchblob:none · deepen 1020038 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=18
git.response.bytes=38434
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=19912563f540228593df0c489082e5e2508e21e4
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=6
git.pkt.data=4
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=38434
git.pkt.payload.max=38339
git.sideband.band1.bytes=38338
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=63
git.pack.bytes=38338
git.pack.ofs_delta=0
git.pack.ref_delta=8
git.pack.chain.max=8
git.pack.trailer=0bc36ab7adf82d3109177f11f1ea93f1ce071f77
git.pack.full=55
Open pack map
fetch2001.4 KiB · hit18 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1416
git.response.cache=HIT
git.response.duration_ms=18
git.fetch.wants=9bb0ec59f97f7a5eeefeb962461094100b8e5111
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=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1416
git.pkt.payload.max=1395
git.sideband.band1.bytes=1394
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://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/ply.git
Ref
refs/heads/main
Commit
19912563f540228593df0c489082e5e2508e21e4
cf-ray
a5e1a695eb925e44
Request
5676a1ec…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format