Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
261 stars 275 forks source link

JSS (Next.js) GraphQL Azure web Application Firewall issues #1119

Closed SemionMcAlice closed 2 years ago

SemionMcAlice commented 2 years ago

Description

We use next.js JSS library. Whenever we run graphQL queries against our Sitecore CD instance behind an Azure Web Application Firewall they get blocked. when we run the same query in postman without the newline (\n) charachters and whitespaces, it succeeds. These are identified as SQL Injection Attack, Windows Command Injection, SQL Injection Attack Detected via libinjection by the WAF.

Expected behavior

Graph QL queries succeed through WAF

Steps To Reproduce

any next.js Jss application, when connecting to Sitecore through an Azure web application Firewall.

Possible Fix

A possible solution would be to add a graphQL minifier, either library or self coded. example library https://github.com/drwpow/gqlmin the main point is to remove all the whitespaces and new line charachters.

Your Environment

Screenshots

SemionMcAlice commented 2 years ago

On further investigation and testing, the minification wouldn't solve all the firewall rules. the only workaround at this point is to add a firewall exclusion.