You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was comparing multiple JS cookie libraries and noticed that client-side generated cookies are correctly created in the browser, but ColdFusion/Tomcat servers haven't been configured for RFC 6265 compliance by default and cookie values are truncated as soon as a the first parenthesis is encountered in a string value.
ie, a(b)c in the client becomes a when read by the server.
In order to get cookie.js to function similar to ColdFusion's CFCOOKIE tag and avoid truncating data (using Tomcat), I've added the following default path setting & encoder function.
Yep, that generally looks good to me.
I can't say anything about the specific decoding function for ColdFusion, but setting cookie.utils.encode is the way to go.
Since your tests work, I'm assuming the exact decoding logic is also correct.
Thanks a lot for documenting this!
I've linked this issue in the README.
I audited encoding & decoding cookies values between cookie.js and Adobe ColdFusion 2016, 2018 & 2021. (I'm experiencing issues trying to test Lucee CFM at the moment, but will report back later.)
Here's the tested encoding function for Adobe ColdFusion.
cookie.utils.encode = function (value) {
return encodeURIComponent(value).replace(/%(23|24|26|2F|5E|60|7C)/g, decodeURIComponent).replace(/[\(\)]/g, escape);
};
Activity
florian commentedon Jul 4, 2019
Yep, that generally looks good to me.
I can't say anything about the specific decoding function for ColdFusion, but setting
cookie.utils.encodeis the way to go.Since your tests work, I'm assuming the exact decoding logic is also correct.
Thanks a lot for documenting this!
I've linked this issue in the README.
JamoCA commentedon May 10, 2022
I discovered an issue... the
@symbol needs to be encoded to%40or ColdFusion can't read it or anything after it.JamoCA commentedon May 10, 2022
I audited encoding & decoding cookies values between cookie.js and Adobe ColdFusion 2016, 2018 & 2021. (I'm experiencing issues trying to test Lucee CFM at the moment, but will report back later.)
Here's the tested encoding function for Adobe ColdFusion.
No encoding required:
Encoding required: