Skip to content

Prevent subscription to third-party gateway APIs (AWS, etc.)#1229

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-api-subscription-issue
Draft

Prevent subscription to third-party gateway APIs (AWS, etc.)#1229
Copilot wants to merge 4 commits intomainfrom
copilot/fix-api-subscription-issue

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Users can currently subscribe to APIs deployed on AWS API Gateway and other third-party gateways from the Developer Portal, which should not be allowed.

Changes

  • Added gatewayVendor filter to subscription eligibility check in APICardView.jsx

    • Only APIs with gatewayVendor === 'wso2' or undefined are now subscribable
    • Third-party gateway APIs (AWS, Azure, etc.) will show "Not Allowed" status
  • Refactored subscription logic for clarity

    • Replaced nested double-negation condition with explicit boolean variables
    • isWSO2Gateway, isNotSubscribed, isNotAdvertised, canSubscribe

Implementation

// Before: Missing gatewayVendor check
if (!((!subscribedIds.includes(api.id) && !api.advertiseInfo.advertised)
    && api.isSubscriptionAvailable)) {
    api.throttlingPolicies = null;
}

// After: Filter third-party gateway APIs
const isWSO2Gateway = api.gatewayVendor === 'wso2' || !api.gatewayVendor;
const canSubscribe = isNotSubscribed && isNotAdvertised
    && api.isSubscriptionAvailable && isWSO2Gateway;

if (!canSubscribe) {
    api.throttlingPolicies = null;
}

This follows the existing pattern used throughout the devportal for filtering third-party gateway APIs.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • scarf.sh
    • Triggering command: /usr/local/bin/node node ./report.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Can subscribe to APIs deployed in AWS API Gateway</issue_title>
<issue_description>### Description

Users are not intended to be able to subscribe to APIs deployed in AWS API Gateway. However, when accessing an application and attempting to subscribe to an API through the application, we can still view the APIs deployed in AWS API Gateway and, through this option, we can subscribe to the API.

Steps to Reproduce

  1. Deploy an API in AWS API Gateway.
  2. Go to Devportal and create an applcaiton.
  3. Go to the created application and select Subscriptions. Here you can subscribe to the API deployed at step 1.

Version

4.5.0

Environment Details (with versions)

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link

coderabbitai bot commented Dec 10, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 3 commits December 10, 2025 07:06
Co-authored-by: AnuGayan <19290404+AnuGayan@users.noreply.github.com>
Co-authored-by: AnuGayan <19290404+AnuGayan@users.noreply.github.com>
Co-authored-by: AnuGayan <19290404+AnuGayan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix subscription access for APIs in AWS API Gateway Prevent subscription to third-party gateway APIs (AWS, etc.) Dec 10, 2025
@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

Copilot AI requested a review from AnuGayan December 10, 2025 07:11
YasasRangika pushed a commit to YasasRangika/apim-apps that referenced this pull request Dec 18, 2025
YasasRangika pushed a commit to YasasRangika/apim-apps that referenced this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can subscribe to APIs deployed in AWS API Gateway

3 participants