Sample project that demonstrates how to setup a multitenant application for a Software-as-a-Service scenario, leveraging the Kyma and Cloud Foundry Runtimes of the SAP Business Technology Platform. Developers learn how to implement their own CAP (mtxs) based SaaS app including an SaaS API and integration with various essential SAP BTP service of...
Apache License 2.0
93
stars
43
forks
source link
Bug in service-manager.js prevents removal of Service Brokers or removes potentially a wrong service broker. #6
We encountered this problem testing on a Subaccount where we subscribed this application in one subaccount from multiple provider instances (prod, dev, test).
The problem originates in the URLEncoding of the search query.
The final URL results in https://service-manager.cfapps.eu10.hana.ondemand.com/v1/service_brokers?fieldQuery%3Dname%20eq%20%27*-api-sb-test******
The problem is that the URL query's = sign is encoded to %3D; therefore, URL query parameters are not resolved.
As a result, the query is not applied, and the API returns all three service broker instances.
We encountered this problem testing on a Subaccount where we subscribed this application in one subaccount from multiple provider instances (prod, dev, test).
The current implementation pretends to work if you have only one service broker registered in the subscribing subaccount. The API call in
getServiceBroker
always returns all service brokers, because the filter condition is not applied. But only the first service broker from the result is returned here (https://github.com/SAP-samples/btp-cap-multitenant-saas/blob/222dcd0d334829011c59fdc3c55eee2604ed23d5/code/srv/srv/utils/service-manager.js#L214C16-L214C16)As consequence
automation.js
possibly deletes the wrong service broker https://github.com/SAP-samples/btp-cap-multitenant-saas/blob/222dcd0d334829011c59fdc3c55eee2604ed23d5/code/srv/srv/utils/automator.js#L109The problem originates in the URLEncoding of the search query.
The final URL results in
https://service-manager.cfapps.eu10.hana.ondemand.com/v1/service_brokers?fieldQuery%3Dname%20eq%20%27*-api-sb-test******
The problem is that the URL query's
=
sign is encoded to%3D
; therefore, URL query parameters are not resolved. As a result, the query is not applied, and the API returns all three service broker instances.With the fix in place, the result is as expected.