From c512633cbe83a8e1aee050c11aca83561460a252 Mon Sep 17 00:00:00 2001 From: Nirmal N R Date: Wed, 21 Jan 2026 14:57:21 +0530 Subject: [PATCH] chore: updated error message for allowedParentnamespaces validation --- .../implementation/dediregistry/dediregistry.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/plugin/implementation/dediregistry/dediregistry.go b/pkg/plugin/implementation/dediregistry/dediregistry.go index d13a1e6..352342f 100644 --- a/pkg/plugin/implementation/dediregistry/dediregistry.go +++ b/pkg/plugin/implementation/dediregistry/dediregistry.go @@ -152,13 +152,6 @@ func (c *DeDiRegistryClient) Lookup(ctx context.Context, req *model.Subscription return nil, fmt.Errorf("invalid response format: missing details field") } - parentNamespaces := extractStringSlice(data["parent_namespaces"]) - if len(c.config.AllowedParentNamespaces) > 0 { - if len(parentNamespaces) == 0 || !containsAny(parentNamespaces, c.config.AllowedParentNamespaces) { - return nil, fmt.Errorf("registry entry not in allowed parent namespaces") - } - } - // Extract required fields from details signingPublicKey, ok := details["signing_public_key"].(string) if !ok || signingPublicKey == "" { @@ -171,6 +164,14 @@ func (c *DeDiRegistryClient) Lookup(ctx context.Context, req *model.Subscription detailsDomain, _ := details["domain"].(string) detailsSubscriberID, _ := details["subscriber_id"].(string) + // Validate parent namespaces if configured + parentNamespaces := extractStringSlice(data["parent_namespaces"]) + if len(c.config.AllowedParentNamespaces) > 0 { + if len(parentNamespaces) == 0 || !containsAny(parentNamespaces, c.config.AllowedParentNamespaces) { + return nil, fmt.Errorf("registry entry with subscriber_id '%s' does not belong to any configured parent namespaces (registry.config.allowedParentNamespaces)", detailsSubscriberID) + } + } + // Extract encr_public_key if available (optional field) encrPublicKey, _ := details["encr_public_key"].(string)