wso2 / wso2/api-platform

Fix nil-pointer dereference when mapping WebSub API channels in mapWebSubAPIModelToAPI

Open
#1,995 0 comments 0 reactions 1 assignee View on GitHub

@senthuran16 is already working on this.

Since May 20, 2026.

Dominant language
Go
Stars
71
Forks
111
Avg merge
1d 14h
Merged PRs (30d)
110

Description

Summary

In platform-api/src/internal/service/websub_api.go, the mapWebSubAPIModelToAPI function (line 417) dereferences the pointer returned by mapWebSubChannelsModelToAPI, which returns nil when the input channel map is empty. This causes a nil-pointer dereference panic at runtime when a WebSub API has no channels.

Location

  • File: platform-api/src/internal/service/websub_api.go
  • Function: mapWebSubAPIModelToAPI
  • Line: 417

Steps to Reproduce

Retrieve a WebSub API that was created or stored with an empty channels map. The Get, List, or Update return path will trigger the panic via mapWebSubAPIModelToAPI.

Expected Behavior

The mapping should handle an empty or nil channel map gracefully and return an empty (non-nil) value for Channels.

Related

Reported by @senthuran16.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.