Remove double quotes from variable

Matthew Newton mcn at freeradius.org
Fri Oct 26 12:22:20 CEST 2018


On Fri, 2018-10-26 at 15:41 +0530, Raghu nathan wrote:
> Access-Reject = "{\"Datetime\":\"%t\",\
> \"Packet-Type\":\"%{reply:Packet-Type}\",\
> \"User-Name\":\"%{User-Name}\",\
> \"Module-Failure-Message\":\"%{Module-Failure-Message}\"\
>                 }"
...
> In the Module-Failure-Message output we are receiving the message
> with
> double quotes which is not as per JSON standard.
> Please let me know how I can solve the issue without doing any
> coding.

Use the jsonquote xlat on any untrusted data that comes in the request
(e.g. User-Name as well, as that can be controlled by the connecting
device).

 ..., \"Module-Failure-Message\":\"%{jsonquote:%{Module-Failure-Message}}\", ...

-- 
Matthew



More information about the Freeradius-Users mailing list