Skip to content
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

CEL Support #495

Merged
merged 43 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3d79881
First seam: DynamicCEL
alexsnaps Oct 14, 2024
79882b3
Refactored Cel into own pkg, removed CelResponse
alexsnaps Oct 14, 2024
95d3bfa
Adding the new seams
alexsnaps Oct 14, 2024
e138990
Cel Predicates
alexsnaps Oct 15, 2024
6087b3c
Add `context` to Cel's context
alexsnaps Oct 15, 2024
e469c17
Cel Expressions
alexsnaps Oct 15, 2024
d6dc884
Abstracted expressions.Value away somewhat
alexsnaps Oct 15, 2024
cd1b510
Fix imports
alexsnaps Oct 15, 2024
5431fed
Wired cel.Expression in the AuthConfig
alexsnaps Oct 15, 2024
69d0613
Fix imports
alexsnaps Oct 15, 2024
d946f1b
Deal with nil expression.Value as ""
alexsnaps Oct 15, 2024
ca31308
v1beta3 API
alexsnaps Oct 15, 2024
af463e7
HttpEndpointSpec.DynamicUrl
alexsnaps Oct 15, 2024
c1c2418
Facilitate StringValue, mimics expressions.Value
alexsnaps Oct 15, 2024
90201ce
PlainIdentitySpec.Value
alexsnaps Oct 15, 2024
c9580a4
Deleted response.DynamicCEL
alexsnaps Oct 15, 2024
bd7b2fc
remove unrelated rbac from the manifests
guicassolato Oct 16, 2024
686fb5d
Bind all well known attributes, no 'context' anymore
alexsnaps Oct 16, 2024
3925889
Update examples
alexsnaps Oct 18, 2024
9e7168e
makefile: use project bin controller-gen & bump kustomize
KevFan Oct 22, 2024
9fce964
manifests: generate v1beta3 changes
KevFan Oct 22, 2024
0707d5e
Fix update examples
alexsnaps Oct 23, 2024
49c9c42
Trying to fix things
alexsnaps Oct 24, 2024
613c9b5
Deal with cacheKey creation failures
alexsnaps Oct 24, 2024
b445436
Use v1beta2 for now
alexsnaps Oct 24, 2024
a64198b
I know it's halloween, but still... we should rewrite this in Ruby
alexsnaps Oct 24, 2024
adb07cf
manifests: update required oneOf conditions
KevFan Oct 25, 2024
1bea626
Fix cel predicate
alexsnaps Oct 25, 2024
a51c18b
CEL in IdentityExtensions
alexsnaps Oct 28, 2024
86dc495
Fix null, not needed
alexsnaps Oct 28, 2024
08cebd1
Default to use v1beta3 in e2e tests
alexsnaps Oct 28, 2024
eb15334
Updated predicates
alexsnaps Oct 28, 2024
2f5d43e
Like I need to understand this crap
alexsnaps Oct 28, 2024
3d1e1b8
All the things...
alexsnaps Oct 28, 2024
5f94c7c
Dunno where this comes from
alexsnaps Oct 28, 2024
b7cc27f
Neither where this is supposed to come from
alexsnaps Oct 28, 2024
44052a6
Exploring while I can
alexsnaps Oct 29, 2024
4324134
CEL
alexsnaps Oct 29, 2024
dae8683
optional selector field
guicassolato Oct 30, 2024
4610145
Store data as golang types
alexsnaps Oct 30, 2024
74ee28b
Sort imports
alexsnaps Oct 30, 2024
c4a2898
Test counters
alexsnaps Oct 30, 2024
baa37c3
Fix CEL
alexsnaps Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ controller-gen: ## Installs controller-gen in $PROJECT_DIR/bin

KUSTOMIZE = $(PROJECT_DIR)/bin/kustomize
kustomize: ## Installs kustomize in $PROJECT_DIR/bin
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@v4.5.5)
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5@v5.5.0)

ENVTEST = $(PROJECT_DIR)/bin/setup-envtest
envtest: ## Installs setup-envtest in $PROJECT_DIR/bin
Expand Down Expand Up @@ -118,11 +118,11 @@ vet: ## Runs go vet against code
go vet ./...

generate: vendor controller-gen ## Generates types deepcopy code
controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(MAKE) fmt vet

manifests: controller-gen kustomize ## Generates the manifests in $PROJECT_DIR/install
controller-gen crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=install/crd output:rbac:artifacts:config=install/rbac && $(KUSTOMIZE) build install > $(AUTHORINO_MANIFESTS)
$(CONTROLLER_GEN) crd:crdVersions=v1 rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=install/crd output:rbac:artifacts:config=install/rbac && $(KUSTOMIZE) build install > $(AUTHORINO_MANIFESTS)
$(MAKE) patch-webhook

run:git_sha=$(shell git rev-parse HEAD)
Expand Down
18 changes: 15 additions & 3 deletions api/v1beta3/auth_config_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,19 @@ type PatternExpression struct {
Value string `json:"value,omitempty"`
}

type CelExpression string

type CelPredicate struct {
Predicate string `json:"predicate,omitempty"`
}

// +kubebuilder:validation:Enum:=eq;neq;incl;excl;matches
type PatternExpressionOperator string

type PatternExpressionOrRef struct {
PatternExpression `json:",omitempty"`
PatternRef `json:",omitempty"`

CelPredicate `json:",omitempty"`
// A list of pattern expressions to be evaluated as a logical AND.
All []UnstructuredPatternExpressionOrRef `json:"all,omitempty"`
// A list of pattern expressions to be evaluated as a logical OR.
Expand Down Expand Up @@ -199,6 +205,8 @@ type ValueOrSelector struct {
// Any pattern supported by https://pkg.go.dev/github.com/tidwall/gjson can be used.
// The following Authorino custom modifiers are supported: @extract:{sep:" ",pos:0}, @replace{old:"",new:""}, @case:upper|lower, @base64:encode|decode and @strip.
Selector string `json:"selector,omitempty"`

Expression CelExpression `json:"expression,omitempty"`
}

type CommonEvaluatorSpec struct {
Expand Down Expand Up @@ -401,7 +409,9 @@ type PlainIdentitySpec struct {
// Simple path selector to fetch content from the authorization JSON (e.g. 'request.method') or a string template with variables that resolve to patterns (e.g. "Hello, {auth.identity.name}!").
// Any pattern supported by https://pkg.go.dev/github.com/tidwall/gjson can be used.
// The following Authorino custom modifiers are supported: @extract:{sep:" ",pos:0}, @replace{old:"",new:""}, @case:upper|lower, @base64:encode|decode and @strip.
Selector string `json:"selector"`
Selector string `json:"selector,omitempty"`

Expression CelExpression `json:"expression,omitempty"`
}

type AnonymousAccessSpec struct{}
Expand Down Expand Up @@ -437,7 +447,9 @@ type HttpEndpointSpec struct {
// The value can include variable placeholders in the format "{selector}", where "selector" is any pattern supported
// by https://pkg.go.dev/github.com/tidwall/gjson and selects value from the authorization JSON.
// E.g. https://ext-auth-server.io/metadata?p={request.path}
Url string `json:"url"`
Url string `json:"url,omitempty"`

UrlExpression CelExpression `json:"urlExpression,omitempty"`

// HTTP verb used in the request to the service. Accepted values: GET (default), POST.
// When the request method is POST, the authorization JSON is passed in the body of the request.
Expand Down
16 changes: 16 additions & 0 deletions api/v1beta3/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading