久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <bdo id='PIPuF'></bdo><ul id='PIPuF'></ul>

  • <tfoot id='PIPuF'></tfoot>

  • <i id='PIPuF'><tr id='PIPuF'><dt id='PIPuF'><q id='PIPuF'><span id='PIPuF'><b id='PIPuF'><form id='PIPuF'><ins id='PIPuF'></ins><ul id='PIPuF'></ul><sub id='PIPuF'></sub></form><legend id='PIPuF'></legend><bdo id='PIPuF'><pre id='PIPuF'><center id='PIPuF'></center></pre></bdo></b><th id='PIPuF'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PIPuF'><tfoot id='PIPuF'></tfoot><dl id='PIPuF'><fieldset id='PIPuF'></fieldset></dl></div>

    1. <small id='PIPuF'></small><noframes id='PIPuF'>

      <legend id='PIPuF'><style id='PIPuF'><dir id='PIPuF'><q id='PIPuF'></q></dir></style></legend>

      1. Newtonsoft Json 中的 TypeNameHandling 謹慎

        TypeNameHandling caution in Newtonsoft Json(Newtonsoft Json 中的 TypeNameHandling 謹慎)
        • <small id='lBa97'></small><noframes id='lBa97'>

              <legend id='lBa97'><style id='lBa97'><dir id='lBa97'><q id='lBa97'></q></dir></style></legend>
              • <bdo id='lBa97'></bdo><ul id='lBa97'></ul>

                  <i id='lBa97'><tr id='lBa97'><dt id='lBa97'><q id='lBa97'><span id='lBa97'><b id='lBa97'><form id='lBa97'><ins id='lBa97'></ins><ul id='lBa97'></ul><sub id='lBa97'></sub></form><legend id='lBa97'></legend><bdo id='lBa97'><pre id='lBa97'><center id='lBa97'></center></pre></bdo></b><th id='lBa97'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='lBa97'><tfoot id='lBa97'></tfoot><dl id='lBa97'><fieldset id='lBa97'></fieldset></dl></div>
                  <tfoot id='lBa97'></tfoot>
                    <tbody id='lBa97'></tbody>
                  本文介紹了Newtonsoft Json 中的 TypeNameHandling 謹慎的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  在 this 鏈接上,在備注部分提到:

                  On this link, in remarks section it's mentioned that:

                  TypeNameHandling.使用 TypeNameHandling.None 以外的值進行反序列化時,應使用自定義 SerializationBinder 驗證傳入類型.

                  TypeNameHandling should be used with caution when your application deserializes JSON from an external source. Incoming types should be validated with a custom SerializationBinder when deserializing with a value other than TypeNameHandling.None.

                  在什么情況下,如果使用 TypeNameHandling.All 序列化/反序列化來自外部源的 JSON 會有害?一個工作示例將不勝感激.

                  In what cases JSON from external source would be harmful if serialized/deserialized with TypeNameHandling.All? A working example would be appreciated.

                  推薦答案

                  當使用 TypeNameHandling.All 反序列化并且沒有 SerializationBinder 檢查時,json.net 將嘗試創建一個類型為JSON 中的元數據.

                  When deserialize with TypeNameHandling.All and without a SerializationBinder checks json.net will try to create a instace of the type that comes as metadata in the JSON.

                  public class Car
                  {
                      public string Maker { get; set; }
                      public string Model { get; set; }
                  }
                  
                  {
                     "$type": "Car",
                     "Maker": "Ford",
                     "Model": "Explorer"
                  } //create a Car and set property values
                  

                  但攻擊者可能會向您發送代碼或框架中存在的危險類型.

                  But an attacker could send you dangerous types that exist in your code or in the framework.

                  即來自 這里 System.CodeDom.Compiler.TempFileCollection 是一個可序列化的類,其目的是維護一個由編譯過程產生的臨時文件列表,并在不再需要它們時刪除它們.為了確保文件被刪除,該類實現了一個終結器,當垃圾收集器清理對象時將調用該終結器.攻擊者將能夠構建此類的序列化版本,將其內部文件集合指向受害者系統上的任何文件.這將在反序列化后的某個時間點被刪除,而無需與反序列化應用程序進行任何交互.

                  i.e. from here System.CodeDom.Compiler.TempFileCollection is a serializable class whose purpose is to maintain a list of temporary files which resulted from a compilation process and delete them when they are no longer needed. To ensure that the files are deleted the class implements a finalizer that will be called when the object is being cleaned up by the Garbage Collector. An attacker would be able to construct a serialized version of this class which pointed its internal file collection to any file on a victims system. This will be deleted at some point after deserialization without any interaction from the deserializing application.

                      [Serializable]
                      public class TempFileCollection
                      {
                         private Hashtable files;
                         // Other stuff...
                  
                         ~TempFileCollection()
                         {
                           if (KeepFiles) {return}
                           foreach (string file in files.Keys)
                           {
                              File.Delete(file);
                           }
                         }
                      }
                  
                     {
                         "$type": "System.CodeDom.Compiler.TempFileCollection",
                         "BasePath": "%SYSTEMDRIVE",
                         "KeepFiles": "False",
                         "TempDir": "%SYSTEMROOT%"
                      } // or something like this, I just guessing but you got the idea
                  

                  這篇關于Newtonsoft Json 中的 TypeNameHandling 謹慎的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Ignore whitespace while reading XML(讀取 XML 時忽略空格)
                  XML to LINQ with Checking Null Elements(帶有檢查空元素的 XML 到 LINQ)
                  Reading XML with unclosed tags in C#(在 C# 中讀取帶有未閉合標簽的 XML)
                  Parsing tables, cells with Html agility in C#(在 C# 中使用 Html 敏捷性解析表格、單元格)
                  delete element from xml using LINQ(使用 LINQ 從 xml 中刪除元素)
                  Parse malformed XML(解析格式錯誤的 XML)

                    <tfoot id='kGuz6'></tfoot>
                    <i id='kGuz6'><tr id='kGuz6'><dt id='kGuz6'><q id='kGuz6'><span id='kGuz6'><b id='kGuz6'><form id='kGuz6'><ins id='kGuz6'></ins><ul id='kGuz6'></ul><sub id='kGuz6'></sub></form><legend id='kGuz6'></legend><bdo id='kGuz6'><pre id='kGuz6'><center id='kGuz6'></center></pre></bdo></b><th id='kGuz6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='kGuz6'><tfoot id='kGuz6'></tfoot><dl id='kGuz6'><fieldset id='kGuz6'></fieldset></dl></div>

                        <tbody id='kGuz6'></tbody>

                      <small id='kGuz6'></small><noframes id='kGuz6'>

                        <bdo id='kGuz6'></bdo><ul id='kGuz6'></ul>

                          • <legend id='kGuz6'><style id='kGuz6'><dir id='kGuz6'><q id='kGuz6'></q></dir></style></legend>
                            主站蜘蛛池模板: 在线国产视频 | 免费不卡av| 91精品国产乱码久久久久久久久 | 日本在线免费看最新的电影 | 五月婷婷色| 欧美日韩国产一区二区三区不卡 | 国产精品伦理一区 | 女人牲交视频一级毛片 | 99亚洲视频| 秋霞电影一区二区 | 一区二区三区国产 | 国产99精品 | 国产精品美女久久久 | 亚洲国产成人精品久久 | 亚洲精品在线看 | 91精品久久久久久久久中文字幕 | 精品国产一区久久 | 欧美三区在线观看 | www.久久艹 | 午夜国产一级 | 日本亚洲欧美 | 91成人免费观看 | 日本亚洲精品 | 国产精品色av | 男女羞羞视频在线免费观看 | 综合中文字幕 | 欧美视频免费在线 | h片在线看 | 欧美一区精品 | 亚洲免费人成在线视频观看 | 狠狠爱综合网 | 午夜在线观看视频 | 自拍偷拍中文字幕 | 国产精品久久久久久婷婷天堂 | 久久一二三区 | 欧美在线a | 在线观看视频你懂得 | 精品久久久一区 | 国产精品久久久久久久久久三级 | 亚洲成人网在线观看 | 精品国产色 |