{"id":294,"date":"2007-07-05T12:21:39","date_gmt":"2007-07-05T11:21:39","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2007\/07\/05\/webconfig-olvasas-medium-trust-eseten\/"},"modified":"2007-07-05T12:21:39","modified_gmt":"2007-07-05T11:21:39","slug":"webconfig-olvasas-medium-trust-eseten","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2007\/07\/05\/webconfig-olvasas-medium-trust-eseten\/","title":{"rendered":"Web.config olvas\u00e1s medium trust eset\u00e9n"},"content":{"rendered":"<p>Internetszolg\u00e1ltat\u00f3k shared hosting eset\u00e9n \u00e1ltal\u00e1ban medium trustra \u00e1ll\u00edtj\u00e1k be a webappokat, \u00edgy azok nem tudj\u00e1k sz\u00e9tbabr\u00e1lni a g\u00e9pet, az nt secu mell\u00e9 m\u00e9g a .NET CAS secu is beseg\u00edt.<br \/>\nN\u00e9ha ez <a href=\"http:\/\/blogs.advantaje.com\/blog\/kevin\/2006\/06\/29\/log4Net-and-ASP-Net-Medium-Trust.html\">gondot okoz<\/a>, pl. a <a href=\"http:\/\/logging.apache.org\/log4net\/\">log4net<\/a> se tudja kiolvasni a konfigj\u00e1t, mert a CAS megakad\u00e1lyozza ebben. Pedig ez nem olyan v\u00e9szes dolog.<\/p>\n<p>ASP.NET 2.0-ban m\u00e1r meg lehet mondani, hogy egy szekci\u00f3 olvas\u00e1sa okozzon-e CAS Demandot, magyarul, kell-e hozz\u00e1 er\u0151sebb jog, vagy sem. Err\u0151l sz\u00f3l a konfig szekci\u00f3 <a href=\"http:\/\/www.leastprivilege.com\/ConfigurationPermissionAndRequirePermission.aspx\">requirePermission<\/a> attributuma. A h\u00e1tt\u00e9rben ez a ConfigurationPermission \u00faj 2.0-s permissionre \u00e9p\u00edt. A reflector analyze funkci\u00f3j\u00e1val megn\u00e9zve l\u00e1that\u00f3, hogy a BaseConfigurationRecord.CheckPermissionAllowed met\u00f3dus int\u00e9zi el a k\u00e9rd\u00e9st:<\/p>\n<p>[source:c#]<br \/>\nprivate void CheckPermissionAllowed(string configKey, bool requirePermission, bool isTrustedWithoutAptca)<br \/>\n{<br \/>\n    if (requirePermission)<br \/>\n    {<br \/>\n        try<br \/>\n        {<br \/>\n            UnrestrictedConfigPermission.Demand();<br \/>\n        }<br \/>\n        catch (SecurityException exception)<br \/>\n        {<br \/>\n            throw new SecurityException(SR.GetString(&#8220;ConfigurationPermission_Denied&#8221;, new object[] { configKey }), exception);<br \/>\n        }<br \/>\n    }<br \/>\n&#8230;<br \/>\n}<br \/>\n[\/source]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Internetszolg\u00e1ltat\u00f3k shared hosting eset\u00e9n \u00e1ltal\u00e1ban medium trustra \u00e1ll\u00edtj\u00e1k be a webappokat, \u00edgy azok nem tudj\u00e1k sz\u00e9tbabr\u00e1lni a g\u00e9pet, az nt secu mell\u00e9&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,14,4,22],"tags":[],"class_list":["post-294","post","type-post","status-publish","format-standard","hentry","category-net","category-aspnet","category-szakmai-elet","category-security"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=294"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/294\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}