-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix sudo paths missing from OpenAPI and docs #21772
Changes from all commits
01f87c9
f7ca560
64530c2
ed8edc0
b4244c4
22b66de
bbe23bd
c1b1fb6
651bbae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
core: Fix OpenAPI representation and `-output-policy` recognition of some non-standard sudo paths | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ package vault | |
import ( | ||
"context" | ||
"encoding/json" | ||
"errors" | ||
"fmt" | ||
"path" | ||
"reflect" | ||
|
@@ -2325,12 +2326,12 @@ func TestTokenStore_HandleRequest_RevokeOrphan(t *testing.T) { | |
testMakeServiceTokenViaBackend(t, ts, root, "child", "60s", []string{"root", "foo"}) | ||
testMakeServiceTokenViaBackend(t, ts, "child", "sub-child", "50s", []string{"foo"}) | ||
|
||
req := logical.TestRequest(t, logical.UpdateOperation, "revoke-orphan") | ||
req := logical.TestRequest(t, logical.UpdateOperation, "auth/token/revoke-orphan") | ||
req.Data = map[string]interface{}{ | ||
"token": "child", | ||
} | ||
req.ClientToken = root | ||
resp, err := ts.HandleRequest(namespace.RootContext(nil), req) | ||
resp, err := c.HandleRequest(namespace.RootContext(nil), req) | ||
if err != nil || (resp != nil && resp.IsError()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to reviewer: Since the common sudo-enforcing logic is part of the Core, we need to fix tests which care about the sudo behaviour, and were previously slipping requests directly to the backend, bypassing the Core, to make the request via the proper layers. This test is the case where the requesting token does have sudo rights, testing the "allowed" case, and the next test below is testing the "denied" case. |
||
t.Fatalf("err: %v\nresp: %#v", err, resp) | ||
} | ||
|
@@ -2384,14 +2385,14 @@ func TestTokenStore_HandleRequest_RevokeOrphan_NonRoot(t *testing.T) { | |
t.Fatalf("bad: %v", out) | ||
} | ||
|
||
req := logical.TestRequest(t, logical.UpdateOperation, "revoke-orphan") | ||
req := logical.TestRequest(t, logical.UpdateOperation, "auth/token/revoke-orphan") | ||
req.Data = map[string]interface{}{ | ||
"token": "child", | ||
} | ||
req.ClientToken = "child" | ||
resp, err := ts.HandleRequest(namespace.RootContext(nil), req) | ||
if err != logical.ErrInvalidRequest { | ||
t.Fatalf("did not get error when non-root revoking itself with orphan flag; resp is %#v", resp) | ||
resp, err := c.HandleRequest(namespace.RootContext(nil), req) | ||
if !errors.Is(err, logical.ErrPermissionDenied) { | ||
t.Fatalf("did not get expected error when non-root revoking itself with orphan flag; resp is %#v; err is %#v", resp, err) | ||
} | ||
|
||
time.Sleep(200 * time.Millisecond) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to reviewer:
The prior definition of
revoke-orphan/*
is just plain wrong, so it is fixed.The prior definition of
accessors*
technically works, because it uses a needless wildcard - that change is just for precision.