I've been trying to implement AWS WAF Intelligent threat mitigation on my website. The website in an SPA.
When the website loads it calls AwsWafIntegration.fetchToken()
which is supposed to perform a silent challenge and return the WAF token. If this request fails, there's a fallback to AwsWafCaptcha.renderCaptcha()
so that you can still get a WAF token by passing the CAPTCHA.
However after some testing, it appears that fetchToken
call will always succeed and return a valid WAF token as long as the network connection is working. How does the silent challenge work and when can it fail? Have I implemented these features correctly?
After discussing this with AWS support, it turns out I didn't understand the documentation correctly.
It turns out that
AwsWafIntegration.fetchToken()
is never supposed to fail. The silent challenge is executed on the client side immediately when the AWS script is loaded, and it can basically never fail either. The silent challenge will always succeed as long as you can execute JavaScript. Therefore callingfetchToken
from a browser (even automated one) will always return a valid WAF token.According to AWS the "silent challenge" is not supposed to fail, it just collects data from the client and enables certain advanced features of the BotControl WAF rules. Mainly the targeted rules. The correct way to implement this would be to:
Server side:
Client side:
Direct quote from AWS:
They mentioned the documentation will be updated and clarified, so hopefully this will be more clear in future documentation.