How dangerous is it to let users specify RazorEngine templates?

前端 未结 3 1642
无人及你
无人及你 2021-01-12 08:06

I have mail-merge like functionality, which takes a template, some business object, and produces html which is then made into PDF.

I\'m using RazorEngine to do the t

3条回答
  •  悲哀的现实
    2021-01-12 08:36

    I believe that having removed using statements and replacing any @System.[...] like System.IO.File.Delete(filepath) using regex can reduce a fair amount of possible security holes.

    Keep in mind that the Template runs inside a context and can access only what is available in it but that includes also .NET Framework assemblies.

提交回复
热议问题