mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-22 23:21:08 +02:00
* First pass at filtered-path endpoint. It seems to be working, but there are tests missing, and possibly some optimization to handle large key sets. * Vendor go-cmp. * Fix incomplete vendoring of go-cmp. * Improve test coverage. Fix bug whereby access to a subtree named X would expose existence of a the key named X at the same level. * Add benchmarks, which showed that hasNonDenyCapability would be "expensive" to call for every member of a large folder. Made a couple of minor tweaks so that now it can be done without allocations. * Comment cleanup. * Review requested changes: rename some funcs, use routeCommon instead of querying storage directly. * Keep the same endpoint for now, but move it from a LIST to a POST and allow multiple paths to be queried in one operation. * Modify test to pass multiple paths in at once. * Add endpoint to default policy. * Move endpoint to /sys/access/filtered-path.
24 lines
674 B
Go
24 lines
674 B
Go
// Copyright 2017, The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE.md file.
|
|
|
|
// +build !purego
|
|
|
|
package cmp
|
|
|
|
import (
|
|
"reflect"
|
|
"unsafe"
|
|
)
|
|
|
|
const supportAllowUnexported = true
|
|
|
|
// unsafeRetrieveField uses unsafe to forcibly retrieve any field from a struct
|
|
// such that the value has read-write permissions.
|
|
//
|
|
// The parent struct, v, must be addressable, while f must be a StructField
|
|
// describing the field to retrieve.
|
|
func unsafeRetrieveField(v reflect.Value, f reflect.StructField) reflect.Value {
|
|
return reflect.NewAt(f.Type, unsafe.Pointer(v.UnsafeAddr()+f.Offset)).Elem()
|
|
}
|