Skip to content

Commit a8e7140

Browse files
committed
dbauthz
1 parent 386c443 commit a8e7140

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

coderd/cryptokeys/keycache.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55

66
"golang.org/x/xerrors"
7+
8+
"github.com/coder/coder/v2/coderd/database"
79
)
810

911
var ErrKeyNotFound = xerrors.New("key not found")
@@ -12,6 +14,6 @@ var ErrKeyInvalid = xerrors.New("key is invalid for use")
1214

1315
// Keycache provides an abstraction for fetching signing keys.
1416
type Keycache interface {
15-
Latest(ctx context.Context) ([]byte, error)
16-
Version(ctx context.Context, sequence int32) ([]byte, error)
17+
Latest(ctx context.Context) (database.CryptoKey, error)
18+
Version(ctx context.Context, sequence int32) (database.CryptoKey, error)
1719
}

coderd/database/dbauthz/dbauthz_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2302,6 +2302,10 @@ func (s *MethodTestSuite) TestCryptoKeys() {
23022302
DeletesAt: sql.NullTime{Time: time.Now(), Valid: true},
23032303
}).Asserts(rbac.ResourceCryptoKey, policy.ActionUpdate)
23042304
}))
2305+
s.Run("GetCryptoKeysByFeature", s.Subtest(func(db database.Store, check *expects) {
2306+
check.Args(database.CryptoKeyFeatureWorkspaceApps).
2307+
Asserts(rbac.ResourceCryptoKey, policy.ActionRead)
2308+
}))
23052309
}
23062310

23072311
func (s *MethodTestSuite) TestSystemFunctions() {

0 commit comments

Comments
 (0)