csrf enabled but empty through /libs/granite/csrf/token.json
Hi,
I have two questions regarding CSRF in AEM 6.1 which we recently migrated to.
Question 1. Empty CSRF token.
Locally, when accessing http://127.0.0.1:4502/libs/granite/csrf/token.json I can see a json object with "token" key, like
{ token:"eyJle.........Gec" }However, on the server, when I go to the /libs/granite/csrf/token.json, it returns an empty json { }.
The fact that I can get to the location means dispatcher is configured correctly to get to the url, and caching shouldn't be a problem. Double checked OSGi modules, and it seems csrf modules are all active. Where should I be looking that generates the token?
Question 2. CSRF architecture.
Why having granite.jquery to ajax load a csrf token via the URL and post via http header? If a public api is available to expose such token, a 3rd party can still inject client side script to request a legit token on client side and still get a legit csrf key for the client. That defeats the purpose of csrf protection from my understanding. Please correct me if I'm wrong (which I hope I am).
Thanks,
Jason
