Skip to main content
obxBill
Participant
Feb 17, 2025 5:24 PM UTC
Question

ColdFusion 2023 HF12 Finding - writeLog() and JSON

ColdFusion 2023 HF12 Finding - writeLog() function.  Following CF2023 server update to HF12, If a JSON string is passed as part of the text input to the writeLog() function, it double quotes {""key"":""value""} all JSON key/value pairs in the log.  Prior to HF12, JSON was logged normally {"key":"value"}.  Anyone able to confirm/verify this finding and whether there is a way to resolve?  thx! 

    5 replies

    Community Expert
    Feb 17, 2025 5:48 PM UTC

    Try using single quotes to see what happens - but open a support ticket at tracker.adobe.com (I think that's the right URL) anyway.

     

    Translate
    Dave Watts, Eidolon LLC
    obxBill
    obxBillAuthor
    Participant
    Feb 17, 2025 6:33 PM UTC

    well, we are using serializeJSON() to create the json body, thus that function only creates valid {"key":"value"} json strings.  likely if could do single quote JSON, it will likely output as {"'key'":"'value'"}.  I will look at opening a tracker ticket based on the finding.  Perhaps there is a java argument possible to suppress some change in the CF engine tied to a update to writeLog().

     

    Fortunately, CF continues to create valid JSON and this issue only ties to writing logs.

    Translate
    Community Expert
    Feb 17, 2025 7:29 PM UTC

    You shouldn't have an issue with CF doubling single quotes. That said, I don't really see how you'd get to where you can control how the CF error logger rewrites the output of serializeJSON. You could create a temporary wrapper for the function that conditionally rewrites the quotes after the JSON has been created, based on a feature flag. I'm not sure it's worth the effort for you though.

     

    Translate
    Dave Watts, Eidolon LLC