英文:
How do I use ModSecurity's transformation function to encode the request_body
问题
我想使用ModSecurity阶段2对RequestBody的特定部分进行编码。我认为使用转换函数可能会有所帮助,但我不知道如何使其仅转换在请求体中的哈希内部的值。
要编码的消息哈希中的“details”键的值。
请求体包含一个Ruby哈希
{
"message": {
"details": "这里存在攻击"
}
}
在ModSecurity中是否可能?
英文:
I would like to encode a specific part of the RequestBody using ModSecurity
phase 2. I believe using a transformation function could help but I don't know how to get it to just transform the value nested within a hash in the body.
The value of the "details" key in the messages hash to be encoded.
The request body contains a ruby hash
{
"message": {
"details": "there is an attack here"
}
}
Is that possible in ModSecurity?
答案1
得分: 2
这是不可能的,因为ModSecurity无法解析Ruby哈希对象。但使用JSON或XML数据是可能的。请记住,编码的数据只能在ModSecurity内部使用,不会传递到您的应用程序。
英文:
This is not possible as ModSecurity is not able to parse Ruby hash object. It would be possible with JSON or XML data though. Remember that encoded data are usable only within ModSecurity and will not reach your application.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论