Fix nil-pointer dereference when mapping WebSub API channels in mapWebSubAPIModelToAPI
@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
- PR: https://github.com/wso2/api-platform/pull/1992
- Review comment: https://github.com/wso2/api-platform/pull/1992#discussion_r3273481569
Reported by @senthuran16.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.