-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into docs/jwt-docs-update
- Loading branch information
Showing
43 changed files
with
1,498 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
package api | ||
|
||
// NOTE: this file was copied from | ||
// https://github.com/hashicorp/vault/blob/main/sdk/helper/consts/plugin_types_test.go | ||
// Any changes made should be made to both files at the same time. | ||
|
||
import ( | ||
"encoding/json" | ||
"testing" | ||
) | ||
|
||
type testType struct { | ||
PluginType PluginType `json:"plugin_type"` | ||
} | ||
|
||
func TestPluginTypeJSONRoundTrip(t *testing.T) { | ||
for _, pluginType := range PluginTypes { | ||
original := testType{ | ||
PluginType: pluginType, | ||
} | ||
asBytes, err := json.Marshal(original) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
var roundTripped testType | ||
err = json.Unmarshal(asBytes, &roundTripped) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
if original != roundTripped { | ||
t.Fatalf("expected %v, got %v", original, roundTripped) | ||
} | ||
} | ||
} | ||
|
||
func TestPluginTypeJSONUnmarshal(t *testing.T) { | ||
// Failure/unsupported cases. | ||
for name, tc := range map[string]string{ | ||
"unsupported": `{"plugin_type":"unsupported"}`, | ||
"random string": `{"plugin_type":"foo"}`, | ||
"boolean": `{"plugin_type":true}`, | ||
"empty": `{"plugin_type":""}`, | ||
"negative": `{"plugin_type":-1}`, | ||
"out of range": `{"plugin_type":10}`, | ||
} { | ||
t.Run(name, func(t *testing.T) { | ||
var result testType | ||
err := json.Unmarshal([]byte(tc), &result) | ||
if err == nil { | ||
t.Fatal("expected error") | ||
} | ||
}) | ||
} | ||
|
||
// Valid cases. | ||
for name, tc := range map[string]struct { | ||
json string | ||
expected PluginType | ||
}{ | ||
"unknown": {`{"plugin_type":"unknown"}`, PluginTypeUnknown}, | ||
"auth": {`{"plugin_type":"auth"}`, PluginTypeCredential}, | ||
"secret": {`{"plugin_type":"secret"}`, PluginTypeSecrets}, | ||
"database": {`{"plugin_type":"database"}`, PluginTypeDatabase}, | ||
"absent": {`{}`, PluginTypeUnknown}, | ||
"integer unknown": {`{"plugin_type":0}`, PluginTypeUnknown}, | ||
"integer auth": {`{"plugin_type":1}`, PluginTypeCredential}, | ||
"integer db": {`{"plugin_type":2}`, PluginTypeDatabase}, | ||
"integer secret": {`{"plugin_type":3}`, PluginTypeSecrets}, | ||
} { | ||
t.Run(name, func(t *testing.T) { | ||
var result testType | ||
err := json.Unmarshal([]byte(tc.json), &result) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
if tc.expected != result.PluginType { | ||
t.Fatalf("expected %v, got %v", tc.expected, result.PluginType) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestUnknownTypeExcludedWithOmitEmpty(t *testing.T) { | ||
type testTypeOmitEmpty struct { | ||
Type PluginType `json:"type,omitempty"` | ||
} | ||
bytes, err := json.Marshal(testTypeOmitEmpty{}) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
m := map[string]any{} | ||
json.Unmarshal(bytes, &m) | ||
if _, exists := m["type"]; exists { | ||
t.Fatal("type should not be present") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
```release-note:improvement | ||
plugins: New API `sys/plugins/reload/:type/:name` available in the root namespace for reloading a specific plugin across all namespaces. | ||
``` | ||
```release-note:change | ||
cli: Using `vault plugin reload` with `-plugin` in the root namespace will now reload the plugin across all namespaces instead of just the root namespace. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:bug | ||
helper/pkcs7: Fix slice out-of-bounds panic | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
identity/tokens: adds plugin issuer with openid-configuration and keys APIs | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
sdk: Add identity token helpers to consistently apply new plugin WIF fields across integrations. | ||
``` |
Oops, something went wrong.