Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b11f8d9
feat(cli): release check registered components: convo + partial state
sicoyle Aug 5, 2025
ab0619d
fix: add state components working properly with cli
sicoyle Aug 5, 2025
629dad1
feat: add pubsub component checks plus missing metadata files
sicoyle Aug 5, 2025
0c14def
feat: add secretstores and start on bindings
sicoyle Aug 6, 2025
4ec9db8
feat: add bindings
sicoyle Aug 6, 2025
4639640
feat: add crypto, lock, nameresolution comps to my setup and fix them up
sicoyle Aug 7, 2025
204f64f
style: rename file to what it should be
sicoyle Aug 7, 2025
c76ce88
feat: add middleware components to cli too
sicoyle Aug 7, 2025
4c9cfdb
style: clean up sam logs
sicoyle Aug 7, 2025
10e3174
style: add allllll other component types
sicoyle Aug 7, 2025
0d101e6
Merge branch 'main' into endgame-task-1.16-comp-registration
sicoyle Aug 7, 2025
556437c
fix: make build happy
sicoyle Aug 7, 2025
cea8dd2
fix(build): update to add newline i removed on accident
sicoyle Aug 7, 2025
2132832
style: ensure we use proper types in metadata files
sicoyle Aug 7, 2025
305a1d3
style: update metadata files for the analyzer to be happy
sicoyle Aug 8, 2025
7e7a7ae
fix: make metadata analyzer happy
sicoyle Aug 8, 2025
2842f7a
fix(rethink): support tls config with a workaround to make metadata a…
sicoyle Aug 8, 2025
0b616ef
style: rm extra quote
sicoyle Aug 8, 2025
443536f
style: make linter happy
sicoyle Aug 8, 2025
dd8ee7e
style: go back to old crypto nameing
sicoyle Aug 8, 2025
1f5262c
fix: last fixes for gcp pubsub bindingg
sicoyle Aug 8, 2025
94cb681
style: fix for metadata analyzer
sicoyle Aug 8, 2025
559f12a
style: appease linter
sicoyle Aug 8, 2025
ef4a474
revert: checkout state dir from main since in diff pr now
sicoyle Aug 11, 2025
7e19011
revert: checkout bindings dir from main since in diff pr now
sicoyle Aug 11, 2025
6f1ca96
revert: checkout nameresolution dir from main since in diff pr now
sicoyle Aug 11, 2025
e4da01b
revert: checkout middleware dir from main since in diff pr now
sicoyle Aug 11, 2025
5b4b3b0
revert: checkout ps dir from main since in diff pr now
sicoyle Aug 11, 2025
e3f9f16
fix: grab latest from master and reset these files to updated master
sicoyle Aug 11, 2025
e1371c6
revert: checkout lock + crypto dir from main since in diff pr now
sicoyle Aug 11, 2025
968cc23
revert: checkout secretstore dir from main since in diff pr now
sicoyle Aug 11, 2025
c0213e2
fix: clean up other changes moved to other prs
sicoyle Aug 11, 2025
8123429
style: few fixes after clean up on pr
sicoyle Aug 11, 2025
dfa1f29
Merge branch 'main' into endgame-task-1.16-comp-registration
sicoyle Aug 11, 2025
ce78278
Merge branch 'main' into endgame-task-1.16-comp-registration
yaron2 Aug 18, 2025
db64e28
Merge branch 'main' into endgame-task-1.16-comp-registration
sicoyle Aug 22, 2025
8de25d6
Merge branch 'main' into endgame-task-1.16-comp-registration
yaron2 Aug 22, 2025
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
Prev Previous commit
Next Next commit
feat: add middleware components to cli too
Signed-off-by: Samantha Coyle <[email protected]>
  • Loading branch information
sicoyle committed Aug 7, 2025
commit c76ce884089b16fb1591ba1952fbd6fd8199d1a2
81 changes: 66 additions & 15 deletions .build-tools/cmd/cmd-check-component-registrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ This is a required step before an official Dapr release.`,
checkLockComponents()
checkCryptographyComponents()
checkNameResolutionComponents()

// TODO: name resolution, middleware
checkMiddlewareComponents()

fmt.Println("\nCheck completed!")
},
Expand Down Expand Up @@ -125,8 +124,16 @@ func checkCryptographyComponents() {

func checkNameResolutionComponents() {
fmt.Println("\nChecking name resolution components...")
ignoreDaprComponents := []string{}
checkComponents("nameresolution", ignoreDaprComponents, []string{})
checkComponents("nameresolution", []string{}, []string{})
}

func checkMiddlewareComponents() {
fmt.Println("\nChecking middleware components...")
// uppercase is a component only in runtime which doesn't make sense give the nameresolution components have no real metadata of their own for the most part;
// however, it's definition is only in runtime and not in contrib so we must ignore it.
ignoreDaprComponents := []string{"uppercase"}
ignoreContribComponents := []string{}
checkComponents("middleware", ignoreDaprComponents, ignoreContribComponents)
}

// Note: because this cli cmd changes to the working directory to the root of the repo so pathing is relative to that.
Expand Down Expand Up @@ -190,49 +197,58 @@ func checkComponents(componentType string, ignoreDaprComponents []string, ignore
reportResults(missingRegistrations, missingBuildTags, missingMetadata, componentType)
}

func getRegistryPath(componentType string) string {
if componentType == "middleware" {
return fmt.Sprintf("../dapr/pkg/components/%s/http/registry.go", componentType)
}
return fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType)
}

func checkRegistry(componentType string) error {
registryPath := getRegistryPath(componentType)

// Check for default registry singleton
registryCmd := exec.Command("grep", "-r", `var DefaultRegistry \*Registry = NewRegistry\(\)`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
registryCmd := exec.Command("grep", "-r", `var DefaultRegistry \*Registry = NewRegistry\(\)`, registryPath)
_, err := registryCmd.Output()
if err != nil {
return fmt.Errorf("could not find default registry: %v", err)
}

// Check for RegisterComponent()
if componentType != "bindings" {
registerComponentCmd := exec.Command("grep", "-r", `Registry) RegisterComponent(componentFactory`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
_, err = registerComponentCmd.Output()
registerComponentCmd := exec.Command("grep", "-r", `Registry) RegisterComponent(componentFactory`, registryPath)
_, err := registerComponentCmd.Output()
if err != nil {
return fmt.Errorf("could not find RegisterComponent method: %v", err)
}

// Check for Create()
createCmd := exec.Command("grep", "-r", `Registry) Create(name, version, logName string)`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
createCmd := exec.Command("grep", "-r", `Registry) Create(name, version`, registryPath)
_, err = createCmd.Output()
if err != nil {
return fmt.Errorf("could not find Create method: %v", err)
}
} else {
registerInputBindingCmd := exec.Command("grep", "-r", `Registry) RegisterInputBinding(componentFactory func(logger.Logger)`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
_, err = registerInputBindingCmd.Output()
registerInputBindingCmd := exec.Command("grep", "-r", `Registry) RegisterInputBinding(componentFactory func(logger.Logger)`, registryPath)
_, err := registerInputBindingCmd.Output()
if err != nil {
return fmt.Errorf("could not find registerInputBindingCmd method: %v", err)
}

registerOutputBindingCmd := exec.Command("grep", "-r", `Registry) RegisterOutputBinding(componentFactory func(logger.Logger)`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
registerOutputBindingCmd := exec.Command("grep", "-r", `Registry) RegisterOutputBinding(componentFactory func(logger.Logger)`, registryPath)
_, err = registerOutputBindingCmd.Output()
if err != nil {
return fmt.Errorf("could not find registerOutputBindingCmd method: %v", err)
}

// Check for Creates
createInputBindingCmd := exec.Command("grep", "-r", `Registry) CreateInputBinding(name, version, logName string)`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
createInputBindingCmd := exec.Command("grep", "-r", `Registry) CreateInputBinding(name, version, logName string)`, registryPath)
_, err = createInputBindingCmd.Output()
if err != nil {
return fmt.Errorf("could not find CreateInputBinding method: %v", err)
}

createOutputBindingCmd := exec.Command("grep", "-r", `Registry) CreateOutputBinding(name, version, logName string)`, fmt.Sprintf("../dapr/pkg/components/%s/registry.go", componentType))
createOutputBindingCmd := exec.Command("grep", "-r", `Registry) CreateOutputBinding(name, version, logName string)`, registryPath)
_, err = createOutputBindingCmd.Output()
if err != nil {
return fmt.Errorf("could not find CreateInputBinding method: %v", err)
Expand All @@ -256,6 +272,8 @@ func findComponentsInBothRepos(componentType string, ignoreContribComponents []s
excludeFiles = []string{"--exclude=client.go"}
case "cryptography":
excludeFiles = []string{"--exclude=key.go", "--exclude=pubkey_cache.go"}
case "middleware":
excludeFiles = []string{"--exclude=mock*"}
default:
excludeFiles = []string{}
}
Expand All @@ -274,7 +292,13 @@ func findComponentsInBothRepos(componentType string, ignoreContribComponents []s
// Find all registered components in dapr/dapr
var registeredOutput []byte
if componentType != "bindings" {
registeredCmd := exec.Command("sh", "-c", fmt.Sprintf(`grep -r "RegisterComponent" ../dapr/cmd/daprd/components/%s_*.go`, componentType))
var searchPattern string
if componentType == "middleware" {
searchPattern = "../dapr/cmd/daprd/components/middleware_http_*.go"
} else {
searchPattern = fmt.Sprintf("../dapr/cmd/daprd/components/%s_*.go", componentType)
}
registeredCmd := exec.Command("sh", "-c", fmt.Sprintf(`grep -r "RegisterComponent" %s`, searchPattern))
registeredOutput, err = registeredCmd.Output()
if err != nil {
return nil, nil, fmt.Errorf("could not find all registered components in dapr/dapr: %v", err)
Expand Down Expand Up @@ -376,7 +400,9 @@ func normalizeComponentName(contrib string) string {
}

parts := strings.Split(contrib, ".")
vendorPrefixes := []string{"hashicorp", "aws", "azure", "gcp", "alicloud", "oci", "cloudflare", "ibm", "tencentcloud", "huaweicloud", "twilio"}
// Note: I am putting http as a vendor prefix, but that should be removed and all http middleware components should be http.blah bc
// in future we could add grpc middleware components.
vendorPrefixes := []string{"hashicorp", "aws", "azure", "gcp", "alicloud", "oci", "cloudflare", "ibm", "tencentcloud", "huaweicloud", "twilio", "http"}
versionSuffixes := []string{"v1", "v2", "internal"}

// Handle 2-part names (vendor.component)
Expand Down Expand Up @@ -447,6 +473,12 @@ func checkMetadataFile(contrib, componentType string) error {
}

func getMetadataFilePath(contrib, componentType string) string {
// Special handling for HTTP middleware components
// The metadata files are located at middleware/http/componentname/metadata.yaml
if componentType == "middleware" {
return fmt.Sprintf("%s/http/%s/metadata.yaml", componentType, contrib)
}

if strings.Contains(contrib, ".") {
// For nested components like "aws.bedrock", split and join with "/"
parts := strings.Split(contrib, ".")
Expand Down Expand Up @@ -531,6 +563,13 @@ func extractComponentNameFromPath(filePath, componentType string) string {
// For nested components: aws/bedrock/bedrock.go -> aws.bedrock
// Take all parts except the last (which is the filename)
dirParts := parts[:len(parts)-1]

// Special handling for HTTP middleware components
// middleware/http/componentname/ -> componentname (not http.componentname)
if componentType == "middleware" && len(dirParts) >= 2 && dirParts[0] == "http" {
return strings.Join(dirParts[1:], ".")
}

return strings.Join(dirParts, ".")
} else if len(parts) == 1 {
// For simple components: echo/echo.go -> echo
Expand Down Expand Up @@ -565,6 +604,13 @@ func getRegistrationFileName(contrib, componentType string) string {
}

fileName := strings.ReplaceAll(contrib, ".", "_")

// Special handling for HTTP middleware components
// The registration files are named middleware_http_componentname.go
if componentType == "middleware" {
return fmt.Sprintf("../dapr/cmd/daprd/components/%s_http_%s.go", componentType, fileName)
}

return fmt.Sprintf("../dapr/cmd/daprd/components/%s_%s.go", componentType, fileName)
}

Expand All @@ -589,6 +635,11 @@ func parseRegisteredComponents(output string, componentType string) []string {

// Process each file's content
for filePath := range fileGroups {
// skip the uppercase component as it has a ton of magic strings that we must ignore.
// all other components only have the component registration string in this file so it is an outlier.
if strings.Contains(filePath, "uppercase") {
continue
}

// Read the entire file content
cmd := exec.Command("cat", filePath)
Expand Down
29 changes: 29 additions & 0 deletions middleware/http/bearer/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# yaml-language-server: $schema=../../../component-metadata-schema.json
schemaVersion: v1
type: middleware
name: bearer
version: v1
status: stable
title: "Bearer Token Authentication"
description: |
The Bearer middleware provides JWT token authentication for HTTP requests.
It validates Bearer tokens in the Authorization header and can extract claims for downstream processing.
urls:
- title: Reference
url: https://docs.dapr.io/reference/components-reference/supported-middleware/middleware-bearer/
metadata:
- name: jwksURL
type: string
required: true
description: "The URL of the JSON Web Key Set (JWKS) endpoint"
example: "https://accounts.google.com/.well-known/jwks.json"
- name: issuer
type: string
required: true
description: "The expected issuer of the JWT tokens"
example: "https://accounts.google.com"
- name: audience
type: string
required: true
description: "The expected audience of the JWT tokens"
example: "my-app"
66 changes: 66 additions & 0 deletions middleware/http/oauth2/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# yaml-language-server: $schema=../../../component-metadata-schema.json
schemaVersion: v1
type: middleware
name: oauth2
version: v1
status: alpha
title: "OAuth2 Authentication"
description: |
The OAuth2 middleware provides OAuth2 authentication for HTTP requests.
It handles OAuth2 flows and token validation for securing API endpoints.
urls:
- title: Reference
url: https://docs.dapr.io/reference/components-reference/supported-middleware/middleware-oauth2/
authenticationProfiles:
- title: "OAuth2 Authentication"
description: "Configure OAuth2 authentication with any OAuth2 provider"
metadata:
- name: clientID
type: string
required: true
description: "The OAuth2 client ID from your OAuth2 provider"
example: "your-client-id"
- name: clientSecret
type: string
required: true
description: "The OAuth2 client secret from your OAuth2 provider"
sensitive: true
example: "your-client-secret"
- name: authURL
type: string
required: true
description: "The OAuth2 authorization URL from your provider"
example: "https://accounts.google.com/o/oauth2/v2/auth"
- name: tokenURL
type: string
required: true
description: "The OAuth2 token URL from your provider"
example: "https://oauth2.googleapis.com/token"
- name: scopes
type: string
required: false
description: "OAuth2 scopes to request from your provider"
example: "openid profile email"
metadata:
- name: redirectURL
type: string
required: false
description: "The OAuth2 redirect URL for your application"
example: "http://localhost:8080/callback"
- name: authHeaderName
type: string
required: false
description: "The name of the authorization header to use"
example: "Authorization"
default: "Authorization"
- name: forceHTTPS
type: string
required: false
description: "Whether to force HTTPS for the redirect URL"
example: "true"
default: "false"
- name: pathFilter
type: string
required: false
description: "Regular expression to filter which paths require authentication"
example: "^/api/.*"
64 changes: 64 additions & 0 deletions middleware/http/oauth2clientcredentials/metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# yaml-language-server: $schema=../../../component-metadata-schema.json
schemaVersion: v1
type: middleware
name: oauth2clientcredentials
version: v1
status: alpha
title: "OAuth2 Client Credentials"
description: |
The OAuth2 Client Credentials middleware provides OAuth2 client credentials flow authentication.
It handles machine-to-machine authentication using client credentials.
urls:
- title: Reference
url: https://docs.dapr.io/reference/components-reference/supported-middleware/oauth2clientcredentials/
authenticationProfiles:
- title: "OAuth2 Client Credentials"
description: "Configure OAuth2 client credentials authentication with any OAuth2 provider"
metadata:
- name: clientID
type: string
required: true
description: "The client ID of your application that is created as part of a credential hosted by a OAuth-enabled platform"
example: "your-client-id"
- name: clientSecret
type: string
required: true
description: "The client secret of your application that is created as part of a credential hosted by a OAuth-enabled platform"
sensitive: true
example: "your-client-secret"
- name: scopes
type: string
required: false
description: "A list of space-delimited, case-sensitive strings of scopes which are typically used for authorization in the application"
example: "https://www.googleapis.com/auth/userinfo.email"
- name: tokenURL
type: string
required: true
description: "The endpoint is used by the client to obtain an access token by presenting its authorization grant or refresh token"
example: "https://accounts.google.com/o/oauth2/token"
metadata:
- name: pathFilter
type: string
required: false
description: "Regular expression to filter which paths require authentication"
example: "^/api/.*"
- name: headerName
type: string
required: true
description: "The authorization header name to forward to your application"
example: "authorization"
- name: endpointParamsQuery
type: string
required: false
description: "Specifies additional parameters for requests to the token endpoint"
example: "param1=value1&param2=value2"
- name: authStyle
type: integer
required: false
description: "Optionally specifies how the endpoint wants the client ID & client secret sent. 0: Auto-detect (tries both ways and caches the successful way), 1: Sends client_id and client_secret in POST body as application/x-www-form-urlencoded parameters, 2: Sends client_id and client_secret using HTTP Basic Authorization"
example: 0
default: 0
allowedValues:
- 0
- 1
- 2
Loading