api-manager icon indicating copy to clipboard operation
api-manager copied to clipboard

Publishing api with certificates which contain "&" symbol generates an error

Open PasinduGunarathne opened this issue 2 years ago • 1 comments

Description

We have identified an issue with publishing APIs with faulty backend certificates(which includes the "&" symbol). Please follow the below steps to reproduce the issue and it seems when the certificates contain the "&" symbol we can not publish APIs due to the following error.

Error while updating the API in Gateway fd5d1702-9c11-4451-b3a0-1a7752d11deb {"UNPUBLISHED":{},"PUBLISHED":{"AWS Cloud":"Error while Deploying API: Error while publishing API to the Gateway. com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '#' (code 35); expected a semi-colon after the reference for entity 'C'\n at [row,col {unknown-source}]: [294,237]"}}

Steps to reproduce:

  1. Download an APIM 3.2.0 pack and update it to 277 update level
  2. Execute the following commands and generate a backend certificate.

openssl genrsa -out private.key 2048

openssl req -new -key private.key -out csr.pem

Note: Please note that the Organizational Unit Name should contain an “&” symbol(i.e. Organizational Unit Name (eg, section) []:C&C)

openssl x509 -req -days 365 -in csr.pem -signkey private.key -out certificate.crt

  1. Create a new API
  2. Upload the certificate in "Transport Level Security" section
  3. Publish it on gateway

Current behaviour

  • Unable to publish API with this certificate and it give the below error.
Screenshot 2023-08-14 at 14 38 19

Expected behaviour

  • The API should be able to publish without any issue since when uploading the certificate it doesn't give any error(due to the “&” symbol)

However, as per the analysis a certificate can contain the “&” symbol[1] and hence we believe that we need to address the issue in publishing APIs with this “&” symbol.

[1] https://docs.digicert.com/en/certcentral/manage-certificates/public-certificates---data-entries-that-violate-industry-standards.html

Affected Component

APIM

Version

3.2.0

PasinduGunarathne avatar Aug 16 '23 05:08 PasinduGunarathne

Merge the public PR: https://github.com/wso2/carbon-apimgt/pull/12134

YasasRangika avatar Jan 15 '24 11:01 YasasRangika