const MaxNameLen, MaxChainLen, MaxRenderEntries, RenderLatestHops
1const (
2 MaxNameLen = 64
3
4 // MaxChainLen bounds two WALKS, and is NOT a bound on how long a
5 // migration chain can become (round-4 audit: the previous comment
6 // named only the first of the two uses, which read as though chain
7 // length itself were capped at 50):
8 //
9 // 1. GetMigrationChain's traversal and output — a chain longer than
10 // this is explicitly marked truncated rather than presented as
11 // ending early.
12 // 2. Deprecate's cycle-verification walk, which refuses rather than
13 // walking unbounded.
14 //
15 // Neither bounds TOTAL chain length, because Deprecate's walk runs
16 // FORWARD from the new successor and never sees the chain BEHIND the
17 // predecessor. Its cost is proportional to the chain AHEAD of the
18 // successor, which is:
19 //
20 // - zero hops when the successor is terminal — the ordinary
21 // tail-append. The walk breaks immediately, so tail-appending grows
22 // a chain without limit. The realm's own
23 // TestMigrationChain_MarksTruncation builds MaxChainLen+5 links this
24 // way and is expected to succeed.
25 // - O(chain ahead) when the successor is ITSELF already deprecated — a
26 // head-append. Deprecate does NOT reject an already-deprecated
27 // successor (it validates only existence and ownership), so this is
28 // a permitted call, and past MaxChainLen hops it refuses. See
29 // TestDeprecate_BoundedWalkRefusal.
30 //
31 // This is why GetLatest documents an UNBOUNDED cost (see its COST
32 // WARNING) — that warning is accurate, not conservative.
33 //
34 // Extending a chain requires owning both ends of THE ONE NEW LINK at
35 // call time (see Deprecate, which checks exactly that and never
36 // re-verifies earlier links). That is a per-call consent check, not an
37 // invariant of the finished chain: an owner who transfers away only the
38 // TAIL entry hands the recipient the ability to extend it, and so to
39 // move GetLatest for every entry behind it, without that recipient ever
40 // having owned the root. Acquiring the tail still takes the two-step
41 // nominate/accept handoff from its owner, so no chain can be lengthened
42 // without some consenting owner along it.
43 MaxChainLen = 50
44
45 // Render bounds (re-audit): rendering is paginated and the per-row
46 // "latest" annotation walks a bounded number of hops, so an
47 // attacker-built long chain cannot blow up the realm page.
48 MaxRenderEntries = 100
49 RenderLatestHops = 10
50)