SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore(authz): add support for wildcard selectors (#11310)
Vikrant Guptad6f4b051e632
diff --git a/ee/authz/openfgaauthz/provider.go b/ee/authz/openfgaauthz/provider.goindex cdb30c35f0..26ad9f27d2 100644--- a/ee/authz/openfgaauthz/provider.go+++ b/ee/authz/openfgaauthz/provider.go@@ -87,7 +87,7 @@ func (provider *provider) BatchCheck(ctx context.Context, tupleReq map[string]*o}func (provider *provider) CheckTransactions(ctx context.Context, subject string, orgID valuer.UUID, transactions []*authtypes.Transaction) ([]*authtypes.TransactionWithAuthorization, error) {- tuples, err := authtypes.NewTuplesFromTransactions(transactions, subject, orgID)+ tuples, correlations, err := authtypes.NewTuplesFromTransactionsWithCorrelations(transactions, subject, orgID)if err != nil {return nil, err}@@ -99,10 +99,21 @@ func (provider *provider) CheckTransactions(ctx context.Context, subject string,results := make([]*authtypes.TransactionWithAuthorization, len(transactions))for i, txn := range transactions {- result := batchResults[txn.ID.StringValue()]+ txnID := txn.ID.StringValue()+ authorized := batchResults[txnID].Authorized++ if !authorized {+ for _, correlationID := range correlations[txnID] {+ if result, exists := batchResults[correlationID]; exists && result.Authorized {+ authorized = true+ break+ }+ }+ }+results[i] = &authtypes.TransactionWithAuthorization{Transaction: txn,- Authorized: result.Authorized,+ Authorized: authorized,}}return results, nildiff --git a/pkg/types/authtypes/tuple.go b/pkg/types/authtypes/tuple.goindex cb601d8507..e99ab6ee1e 100644--- a/pkg/types/authtypes/tuple.go+++ b/pkg/types/authtypes/tuple.go@@ -47,6 +47,42 @@ func NewTuplesFromTransactions(transactions []*Transaction, subject string, orgIreturn tuples, nil}+// NewTuplesFromTransactionsWithCorrelations converts transactions to tuples for BatchCheck,+// and for each transaction whose selector is not already a wildcard, generates an additional+// tuple with the wildcard selector. This ensures that permissions granted via wildcard+// selectors (e.g., dashboard:*) are checked alongside exact selectors (e.g., dashboard:abc-123).+//+// Returns:+// - tuples: all tuples to check (exact + correlated), keyed by transaction ID or generated correlation ID+// - correlations: maps transaction ID to a slice of correlation IDs for the additional tuples+func NewTuplesFromTransactionsWithCorrelations(transactions []*Transaction, subject string, orgID valuer.UUID) (tuples map[string]*openfgav1.TupleKey, correlations map[string][]string, err error) {+ tuples = make(map[string]*openfgav1.TupleKey)+ correlations = make(map[string][]string)++ for _, txn := range transactions {+ resource, err := coretypes.NewResourceFromTypeAndKind(txn.Object.Resource.Type, txn.Object.Resource.Kind)+ if err != nil {+ return nil, nil, err+ }++ txnID := txn.ID.StringValue()++ txnTuples := NewTuples(resource, subject, txn.Relation, []coretypes.Selector{txn.Object.Selector}, orgID)+ tuples[txnID] = txnTuples[0]++ if txn.Object.Selector.String() != coretypes.WildCardSelectorString {+ wildcardSelector := txn.Object.Resource.Type.MustSelector(coretypes.WildCardSelectorString)+ wildcardTuples := NewTuples(resource, subject, txn.Relation, []coretypes.Selector{wildcardSelector}, orgID)++ correlationID := valuer.GenerateUUID().StringValue()+ tuples[correlationID] = wildcardTuples[0]+ correlations[txnID] = append(correlations[txnID], correlationID)+ }+ }++ return tuples, correlations, nil+}+// NewTuplesFromTransactionsWithManagedRoles converts transactions to tuples for BatchCheck.// Direct role-assignment transactions (TypeRole + VerbAssignee) produce one tuple keyed by txn ID.// Other transactions are expanded via managedRolesByTransaction into role-assignee checks, keyed by "txnID:roleName".