Skip to content

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.

fix(authz): validate transactionGroups in UpdateRole like CreateRole (#11898)

Vikrant Gupta0d47f02100be
diff --git a/pkg/types/authtypes/role.go b/pkg/types/authtypes/role.go
index b6e51a70f5..632e861610 100644
--- a/pkg/types/authtypes/role.go
+++ b/pkg/types/authtypes/role.go
@@ -221,8 +221,8 @@ func (role *PostableRole) UnmarshalJSON(data []byte) error {
func (role *UpdatableRole) UnmarshalJSON(data []byte) error {
shadow := struct {
- Description *string `json:"description"`
- TransactionGroups TransactionGroups `json:"transactionGroups"`
+ Description *string `json:"description"`
+ TransactionGroups *json.RawMessage `json:"transactionGroups"`
}{}
if err := json.Unmarshal(data, &shadow); err != nil {
@@ -237,8 +237,13 @@ func (role *UpdatableRole) UnmarshalJSON(data []byte) error {
return errors.New(errors.TypeInvalidInput, ErrCodeRoleInvalidInput, "transactionGroups is required").WithAdditional("send an empty array to clear the role's transaction groups")
}
+ transactionGroups, err := NewTransactionGroups(*shadow.TransactionGroups)
+ if err != nil {
+ return err
+ }
+
role.Description = *shadow.Description
- role.TransactionGroups = shadow.TransactionGroups
+ role.TransactionGroups = transactionGroups
return nil
}