Forum Discussion
Muhannad
Cirrus
Aug 24, 2020Rewrite JSON value.
Dear Experts, I need to ask if is it possible to inject a value "deviceName": "ESSApp" in the JSON content below if i got the following value in the "formName": "P59MBLVR_W59MBLVRE" value, in m...
- Aug 30, 2020
when HTTP_REQUEST { log local0. "starting collect" HTTP::collect [HTTP::header Content-Length] set clen [HTTP::header Content-Length] } when HTTP_REQUEST_DATA { binary scan [HTTP::payload] c* throwaway set incoming [HTTP::payload] log local0. "before: $incoming" regsub -all {, "formName} $incoming {, {"deviceName":"ESSApp"}, } newdata log local0. "new data is $newdata" HTTP::payload replace 0 $clen $newdata log local0. "after: [HTTP::payload]" }$ curl -kv https://172.16.0.220/xxx/formservice -d '{"token":"044VZAliLSXEo2l4Xcv9DFPNLQKbX7p8E3i/Zt+ksskQ+E=MDE5MDA2MjgwOTQzNzQwNjUwMjI4NzM5OUVTU0FwcDE1OTgzNDA4NzQ3NDM=",", "formName": "P59MBLVR_W59MBLVRE", "returnControlIDs":"39|31|37" }' -H 'Content-Type: application/json; charset=utf-8' Aug 30 16:07:03 bigip1 info tmm[12235]: Rule /Common/json_modify <HTTP_REQUEST>: starting collect Aug 30 16:07:03 bigip1 info tmm[12235]: Rule /Common/json_modify <HTTP_REQUEST_DATA>: before: {"token":"044VZAliLSXEo2l4Xcv9DFPNLQKbX7p8E3i/Zt+ksskQ+E=MDE5MDA2MjgwOTQzNzQwNjUwMjI4NzM5OUVTU0FwcDE1OTgzNDA4NzQ3NDM=",", "formName": "P59MBLVR_W59MBLVRE", "returnControlIDs":"39|31|37" } Aug 30 16:07:03 bigip1 info tmm[12235]: Rule /Common/json_modify <HTTP_REQUEST_DATA>: new data is {"token":"044VZAliLSXEo2l4Xcv9DFPNLQKbX7p8E3i/Zt+ksskQ+E=MDE5MDA2MjgwOTQzNzQwNjUwMjI4NzM5OUVTU0FwcDE1OTgzNDA4NzQ3NDM=",", {"deviceName":"ESSApp"}, ": "P59MBLVR_W59MBLVRE", "returnControlIDs":"39|31|37" } Aug 30 16:07:03 bigip1 info tmm[12235]: Rule /Common/json_modify <HTTP_REQUEST_DATA>: after: {"token":"044VZAliLSXEo2l4Xcv9DFPNLQKbX7p8E3i/Zt+ksskQ+E=MDE5MDA2MjgwOTQzNzQwNjUwMjI4NzM5OUVTU0FwcDE1OTgzNDA4NzQ3NDM=",", {"deviceName":"ESSApp"}, ": "P59MBLVR_W59MBLVRE", "returnControlIDs":"39|31|37" }
Simon_Blakely
Employee
Aug 24, 2020You can do this in an irule with the STREAM profile, or collect the payload parse it and rewrite it.
The question is how much parsing of the content is required to make the insertion safe.
Please provide an example of the incoming and outgoing content.
Muhannad
Cirrus
Aug 27, 2020Any update Simon?
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
