Json Sanitization for C#
neerajknextgen opened this issue · comments
Neeraj Chahal commented
Do you have C# version for this ?
Jim Manico commented
No but we welcome contributions!
…--
Jim Manico
@manicode
Secure Coding Education
+1 (808) 652-3805
On May 13, 2020, at 3:46 AM, neerajknextgen ***@***.***> wrote:
Do you have C# version for this ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Cristian commented
The new (3.x) netcore JsonSerializer comes with an optional JavaScriptEncoder that you could use.
In my case, I set it at the controller level when configuring the services and it does the job. I tested it using various ways of injecting HTML/JS and it seemed to work well.
Just an example:
services.AddControllers().AddJsonOptions(options =>
{
options.JsonSerializerOptions.Encoder = JavaScriptEncoder.Default;
});
Anyway, you may find it useful.
Cheers!
Manas commented
Hi, Can anyone help me to sanitize my json in Asp.Net Core
Yemliha Öner commented