paytrail / api-documentation

Paytrail Payment API documentation
MIT License
6 stars 11 forks source link

The example code to render providers contains a potential XSS vulnerability #109

Open mikkorantalainen opened 6 months ago

mikkorantalainen commented 6 months ago

Describe the bug

The example code to render providers contains a potential XSS vulnerability.

Steps to Reproduce

  1. Go to JavaScript example payment-provider-form in the documentation
  2. Use the example code

Expected behaviour

The example code should be safe to use.

Actual behaviour

The example code assumes that the API provided data never contains any meta characters such as & or " or line feed. This is not promised by the documentation https://docs.paytrail.com/#/?id=provider so it should not be assumed. All the data must be correctly encoded for correct context instead.

Note that the encoding needed for part between the HTML tags (text node) is slightly different from the encoding of HTML attributes (element attribute string).

loueranta-paytrail commented 5 months ago

@mikkorantalainen Thanks for pointing out the potential vulnerability, we will fix it!