============================================================================= Adversarial key-path generator ============================================================================= genKeyPath returns a variadic key path that targets known-dangerous dereference sites: empty strings (the SYS-REQ
(r *rand.Rand)
| 933 | // syntax (the SYS-REQ-110 Set array-index-beyond-length hazard), out-of-range |
| 934 | // indices, and deeply-nested paths. |
| 935 | func genKeyPath(r *rand.Rand) []string { |
| 936 | n := 1 + r.Intn(4) // 1..4 components |
| 937 | path := make([]string, n) |
| 938 | for i := range path { |
| 939 | path[i] = genPathComponent(r) |
| 940 | } |
| 941 | return path |
| 942 | } |
| 943 | |
| 944 | // genPathComponent returns a single adversarial path component. |
| 945 | func genPathComponent(r *rand.Rand) string { |
no test coverage detected