You want to perform CSRF tag validation for a portal where you want to allow the URL https://example.com/ui/s3/abctest.html?v=11.0.0-20170901.1910.f68b2db and https://example.com/api/v2/org/abctest?limit=500.
You have deployed relaxation rules for the CSRF tag validation under the NetScaler AppFirewall profile as below:
bind appfw profile APPFW_Profile_portal -CSRFTag "^http://$" "^https://example\\.com/api/v2/org/abctest\\?limit=(\\d{1,4})$"
>bind appfw profile APPFW_Profile_portal -CSRFTag "^http://$" "^https://example\\.com/ui/s3/abctest\\.html\\?v=(\\d{1,2}\\.\\d{1}\\.\\d{1}\\-\\d{8}\\.\\d{4}\\.[0-9a-z]{7})$"
Always deploy the NetScaler AppFirewall rules from learned data and for CSRF validation do not use/or manually add query string in the rule validation.
Rules deployed from the learnt rules for the same request will be shown as below:
>bind appfw profile APPFW_Profile_portal -CSRFTag "^http://$" "^https://example\\.com/api/v2/org/abctest$" -comment "Deployed from learned data"
>bind appfw profile APPFW_Profile_portal -CSRFTag "^http://$" "^https://example\.com/ui/s3/abctest\\.html$" -comment "Deployed from learned data"
As per design, NetScaler considers action URL without query for CSRF protections. While deploying, action URL without query has to be used. Also If you deploy it from learned data, you will not see issues relaxations with query parameters as CSRF Tag validation is not supposed to validate the query part.
Adding a query to the relaxation rules manually will cause failure.