Hi,
I have a Go application that use Vault, importing the following packages:
github.com/hashicorp/vault/api
github.com/hashicorp/vault/sdk
In addition, for the unit tests the following are also imported to create a test cluster:
github.com/hashicorp/vault
github.com/hashicorp/vault-plugin-secrets-kv
There seems to be an issue should I try to perform either of the following:
1.12.6
→1.12.7
1.13.2
→1.13.3
For both of these, I am getting the following errors show up:
# github.com/hashicorp/vault/audit
../go/pkg/mod/github.com/hashicorp/vault@v1.12.7/audit/format.go:148:22: p.NamespacePath undefined (type logical.PolicyInfo has no field or method NamespacePath)
../go/pkg/mod/github.com/hashicorp/vault@v1.12.7/audit/format.go:339:22: p.NamespacePath undefined (type logical.PolicyInfo has no field or method NamespacePath)
This appears to be a backport:
commit 8e96ea16982ac926dbfd574506b41dc0e4a1d041
Author: hc-github-team-secure-vault-core <82990506+hc-github-team-secure-vault-core@users.noreply.github.com>
Date: Fri May 5 10:13:23 2023 -0400
backport of commit dee7fd839e5db8956d7c08495d8bd96feb062ac8 (#20526)
Co-authored-by: Pratyoy Mukhopadhyay <35388175+pmmukh@users.noreply.github.com>
diff --git a/audit/format.go b/audit/format.go
index 88e264f14b..6cafc1b4f3 100644
--- a/audit/format.go
+++ b/audit/format.go
@@ -143,9 +143,10 @@ func (f *AuditFormatter) FormatRequest(ctx context.Context, w io.Writer, config
for _, p := range auth.PolicyResults.GrantingPolicies {
reqEntry.Auth.PolicyResults.GrantingPolicies = append(reqEntry.Auth.PolicyResults.GrantingPolicies, PolicyInfo{
- Name: p.Name,
- NamespaceId: p.NamespaceId,
- Type: p.Type,
+ Name: p.Name,
+ NamespaceId: p.NamespaceId,
+ NamespacePath: p.NamespacePath,
+ Type: p.Type,
})
}
}
@@ -333,9 +334,10 @@ func (f *AuditFormatter) FormatResponse(ctx context.Context, w io.Writer, config
for _, p := range auth.PolicyResults.GrantingPolicies {
respEntry.Auth.PolicyResults.GrantingPolicies = append(respEntry.Auth.PolicyResults.GrantingPolicies, PolicyInfo{
- Name: p.Name,
- NamespaceId: p.NamespaceId,
- Type: p.Type,
+ Name: p.Name,
+ NamespaceId: p.NamespaceId,
+ NamespacePath: p.NamespacePath,
+ Type: p.Type,
})
}
}
@@ -433,9 +435,10 @@ type AuditPolicyResults struct {
}
type PolicyInfo struct {
- Name string `json:"name,omitempty"`
- NamespaceId string `json:"namespace_id,omitempty"`
- Type string `json:"type"`
+ Name string `json:"name,omitempty"`
+ NamespaceId string `json:"namespace_id,omitempty"`
+ NamespacePath string `json:"namespace_path,omitempty"`
+ Type string `json:"type"`
}
type AuditSecret struct {
Considering that namespaces are in the enterprise version, can anyone shed any light on why this appeared and what might be causing the error using the opensource code?
Cheers