Avoid/block AEM path based servlet post call from postman and curl
We are using path-based servlets to handle contact form submissions. These endpoints are accessible via tools like Postman and cURL. Our infrastructure includes AEM as a Cloud Service and Akamai CDN. By default, AEM’s CSRF protection does not block requests originating from Postman or cURL. Although we have CSRF configurations implemented in our codebase, these tools can still bypass the protection. We are looking for a way to block such requests. One option is to configure Akamai to block requests based on the User-Agent header, such as those sent by Postman. Could you please suggest the best approach to effectively block these types of requests?
{
"filter.enable.safe.user.agents": false,
"filter.methods": [
"DELETE",
"POST",
"PUT"
],
"filter.safe.user.agents": [
"Apache-HttpClient/*",
"Jakarta Commons-HttpClient/*",
"Jakarta-Commons-VFS",
"curl/*",
"Wget/*",
"WebDAVFS/*",
"Microsoft-WebDAV-MiniRedir/*",
"Ruby",
"Adobe-Campaign/*",
"Forms-Mobile *"
],
"filter.excluded.paths": [
"/libs/dam/gui/content/assets/assetlinkshare",
"/content/communities/scorm/RecordResults",
"/bin/api/abc",
"/bin/api/cde",
"/bin/api/efg",
"/bin/api/anb",
"/bin/api/awed",
"/bin/api/asdfg"
]
}