/* DangerousMethodsShouldBeAvoided(System.Reflection.PropertyInfo.SetValue) */ set /**/ {
                PropertyInfo p = typeof(string).GetProperty(nameof(string.Length));
                p.SetValue("str", value, null);
            }
        }

        public void /* DangerousMethodsShouldBeAvoided(System.Reflection.PropertyInfo.SetValue) */ DelegateInsideMethod(/**/)
        {
            Action hacker = () => {
                PropertyInfo p = typeof(string).GetProperty(nameof(string.Length));
                p.SetValue("str", 7, null);
            };
        }

        public void /* DangerousMethodsShouldBeAvoided(System.Web.Hosting.HostingEnvironment.MapPath) */ MethodWithMapPath(/**/)
        {
            System.Web.Hosting.HostingEnvironment.MapPath("/d2l");
        }

        public void /* DangerousMethodsShouldBeAvoided(System.Web.HttpServerUtility.Transfer) */ MethodWithTransfer(/**/)
コード例 #2
0
        public void /* DangerousMethodsShouldBeAvoided(System.Reflection.PropertyInfo.SetValue) */ DifferentMethodName(/**/)
        {
            PropertyInfo p = typeof(string).GetProperty(nameof(string.Length));

            p.SetValue("str", 7, null);
        }

        [DangerousMethodUsage.Audited]
        public void /* DangerousMethodsShouldBeAvoided(System.Reflection.PropertyInfo.SetValue) */ MissingParameters(/**/)
        {
            PropertyInfo p = typeof(string).GetProperty(nameof(string.Length));

            p.SetValue("str", 7, null);
        }

        [DangerousMethodUsage.Unaudited(null, "MapPath")]
        public void /* DangerousMethodsShouldBeAvoided(System.Web.Hosting.HostingEnvironment.MapPath) */ MethodWithMapPath(/**/)
        {
            HostingEnvironment.MapPath("/d2l");
        }

        [DangerousMethodUsage.Unaudited(null, "Transfer")]
        public void /* DangerousMethodsShouldBeAvoided(System.Web.HttpServerUtility.Transfer) */ MethodWithTransfer(/**/)