mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-28 08:27:26 +02:00
authorize: bypass data in rego for databroker data (#2041)
This commit is contained in:
parent
76bc7a7e9a
commit
4218f49741
7 changed files with 141 additions and 139 deletions
|
@ -12,6 +12,8 @@ import (
|
|||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"google.golang.org/protobuf/types/known/anypb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
"github.com/pomerium/pomerium/config"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/databroker"
|
||||
|
@ -168,18 +170,18 @@ func BenchmarkEvaluator_Evaluate(b *testing.B) {
|
|||
|
||||
lastSessionID := ""
|
||||
|
||||
for i := 0; i < 100; i++ {
|
||||
for i := 0; i < 100000; i++ {
|
||||
sessionID := uuid.New().String()
|
||||
lastSessionID = sessionID
|
||||
userID := uuid.New().String()
|
||||
data, _ := ptypes.MarshalAny(&session.Session{
|
||||
data, _ := anypb.New(&session.Session{
|
||||
Version: fmt.Sprint(i),
|
||||
Id: sessionID,
|
||||
UserId: userID,
|
||||
IdToken: &session.IDToken{
|
||||
Issuer: "benchmark",
|
||||
Subject: userID,
|
||||
IssuedAt: ptypes.TimestampNow(),
|
||||
IssuedAt: timestamppb.Now(),
|
||||
},
|
||||
OauthToken: &session.OAuthToken{
|
||||
AccessToken: "ACCESS TOKEN",
|
||||
|
@ -193,7 +195,7 @@ func BenchmarkEvaluator_Evaluate(b *testing.B) {
|
|||
Id: sessionID,
|
||||
Data: data,
|
||||
})
|
||||
data, _ = ptypes.MarshalAny(&user.User{
|
||||
data, _ = anypb.New(&user.User{
|
||||
Version: fmt.Sprint(i),
|
||||
Id: userID,
|
||||
})
|
||||
|
@ -203,6 +205,29 @@ func BenchmarkEvaluator_Evaluate(b *testing.B) {
|
|||
Id: userID,
|
||||
Data: data,
|
||||
})
|
||||
|
||||
data, _ = anypb.New(&directory.User{
|
||||
Version: fmt.Sprint(i),
|
||||
Id: userID,
|
||||
GroupIds: []string{"1", "2", "3", "4"},
|
||||
})
|
||||
store.UpdateRecord(&databroker.Record{
|
||||
Version: uint64(i),
|
||||
Type: data.TypeUrl,
|
||||
Id: userID,
|
||||
Data: data,
|
||||
})
|
||||
|
||||
data, _ = anypb.New(&directory.Group{
|
||||
Version: fmt.Sprint(i),
|
||||
Id: fmt.Sprint(i),
|
||||
})
|
||||
store.UpdateRecord(&databroker.Record{
|
||||
Version: uint64(i),
|
||||
Type: data.TypeUrl,
|
||||
Id: fmt.Sprint(i),
|
||||
Data: data,
|
||||
})
|
||||
}
|
||||
|
||||
b.ResetTimer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue