apk icon indicating copy to clipboard operation
apk copied to clipboard

Null pointer when APIKey is missing in Authentication CR in Dp to CP flow

Open Krishanx92 opened this issue 4 months ago • 0 comments

Description

When enableApiPropagation=true, APIs are expected to propagate to the Publisher UI. However, if the Authentication CR does not define an apiKey block, the controller hits a nil pointer at the following check:

https://github.com/wso2/apk/blob/main/adapter/internal/operator/controllers/dp/api_controller.go#L3735

Expected Behavior

If apiKey is not defined, the controller should safely skip the check.

APIs should continue propagating to the Publisher UI without failure.

Suggested Fix

if authSpec.AuthTypes != nil && authSpec.AuthTypes.APIKey != nil && len(authSpec.AuthTypes.APIKey.Keys) > 0 { // safe to use Keys here }

Steps to Reproduce

  • Set enableApiPropagation=true. (Configure DP to CP flow)
  • Deploy an API with an Authentication CR that does not include an apiKey section.
  • The controller attempts to check APIKey.Keys, leading to a nil pointer.

Affected Component

Adapter

Version

1.3.0

Environment Details (with versions)

No response

Relevant Log Output


Related Issues

No response

Suggested Labels

No response

Krishanx92 avatar Aug 19 '25 14:08 Krishanx92