diff options
| author | Brad Fitzpatrick <bradfitz@tailscale.com> | 2026-04-05 22:56:53 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <brad@danga.com> | 2026-04-05 20:20:32 -0700 |
| commit | 86f42ea87bf8e701ec784a1aa2106fa6a796af14 (patch) | |
| tree | 72a1c2e8e39bd76eb5d15404b83bf4821275e125 /control/controlhttp/controlhttpserver | |
| parent | 5a899e406db0c06b8ba205a2c3c17a4d5e20e680 (diff) | |
| download | tailscale-86f42ea87bf8e701ec784a1aa2106fa6a796af14.tar.xz tailscale-86f42ea87bf8e701ec784a1aa2106fa6a796af14.zip | |
cmd/cloner, cmd/viewer: handle named map/slice types with Clone/View methods
The cloner and viewer code generators didn't handle named types
with basic underlying types (map/slice) that have their own Clone
or View methods. For example, a type like:
type Map map[string]any
func (m Map) Clone() Map { ... }
func (m Map) View() MapView { ... }
When used as a struct field, the cloner would descend into the
underlying map[string]any and fail because it can't clone the any
(interface{}) value type. Similarly, the viewer would try to create
a MapFnOf view and fail.
Fix the cloner to check for a Clone method on the named type
before falling through to the underlying type handling.
Fix the viewer to check for a View method on named map/slice types,
so the type author can provide a purpose-built safe view that
doesn't leak raw any values. Named map/slice types without a View
method fall through to normal handling, which correctly rejects
types like map[string]any as unsupported.
Updates tailscale/corp#39502 (needed by tailscale/corp#39594)
Change-Id: Iaef0192a221e02b4b8e409c99ef8398090327744
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'control/controlhttp/controlhttpserver')
0 files changed, 0 insertions, 0 deletions
