Пример #1
0
        private static void CheckSecurityOnHeaders(string[] headers)
        {
            bool flag = Application.GetBuildUnityVersion() >= Application.GetNumericUnityVersion("4.3.0b1");

            for (int i = 0; i < headers.Length; i += 2)
            {
                foreach (string str in forbiddenHeaderKeys)
                {
                    if (string.Equals(headers[i], str, StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (flag)
                        {
                            throw new ArgumentException("Cannot overwrite header: " + headers[i]);
                        }
                        Debug.LogError("Illegal header overwrite, this will fail in 4.3 and above: " + headers[i]);
                    }
                }
                if (headers[i].StartsWith("Sec-") || headers[i].StartsWith("Proxy-"))
                {
                    if (flag)
                    {
                        throw new ArgumentException("Cannot overwrite header: " + headers[i]);
                    }
                    Debug.LogError("Illegal header overwrite, this will fail in 4.3 and above: " + headers[i]);
                }
                if (((headers[i].IndexOfAny(forbiddenCharacters) > -1) || (headers[i].IndexOfAny(forbiddenCharactersForNames) > -1)) || (headers[i + 1].IndexOfAny(forbiddenCharacters) > -1))
                {
                    if (flag)
                    {
                        throw new ArgumentException("Cannot include control characters in a HTTP header, either as key or value.");
                    }
                    Debug.LogError("Illegal control characters in header, this will fail in 4.3 and above");
                }
            }
        }
Пример #2
0
 public static Assembly LoadAndVerifyAssembly(byte[] assemblyData)
 {
     if (Application.GetBuildUnityVersion() >= Application.GetNumericUnityVersion("4.5.0a4"))
     {
         Debug.LogError("Unable to verify assembly data; you must provide an authorization key when loading this assembly.");
         return(null);
     }
     return(LoadAndVerifyAssemblyInternal(assemblyData));
 }
Пример #3
0
 public static Assembly LoadAndVerifyAssembly(byte[] assemblyData)
 {
     if (Application.GetBuildUnityVersion() < Application.GetNumericUnityVersion("4.5.0a4"))
     {
         return(UnityEngine.Security.LoadAndVerifyAssemblyInternal(assemblyData));
     }
     Debug.LogError((object)"Unable to verify assembly data; you must provide an authorization key when loading this assembly.");
     return((Assembly)null);
 }