// Token: 0x06000040 RID: 64 RVA: 0x00002F4C File Offset: 0x0000114C
        private RULE_PACKAGE_DETAILS LoadRules(string packageId)
        {
            ULS.SendTraceTag(4850015U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationStore.GetDefaultRulePackageDetails :: Loading rules for package [{0}]", new object[]
            {
                packageId
            });
            RULE_PACKAGE_DETAILS result = default(RULE_PACKAGE_DETAILS);

            result.RulePackageID    = packageId;
            result.RulePackageSetID = "NA";
            List <string> list = new List <string>();

            if (this.defaultRuleSet.PackageId == packageId)
            {
                foreach (string text in this.defaultRuleSet.AllRuleIds)
                {
                    if (VariantConfiguration.IsFeatureEnabled(40, text))
                    {
                        ULS.SendTraceTag(4850016U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetDefaultRulePackageDetails :: Adding rule [{0}]", new object[]
                        {
                            text
                        });
                        list.Add(text);
                    }
                }
            }
            result.RuleIDs = list.ToArray();
            return(result);
        }
Esempio n. 2
0
        // Token: 0x0600009C RID: 156 RVA: 0x00004654 File Offset: 0x00002854
        protected override TreeNode ProcessScopeSubQueryTree(TreeNode scopeSubQueryTree)
        {
            if (this.isDLPAuthorized)
            {
                return(scopeSubQueryTree);
            }
            ScopeNode scopeNode = scopeSubQueryTree as ScopeNode;

            if (scopeNode == null || scopeNode.Scope == null)
            {
                ULS.SendTraceTag(5578898U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree ::tenantId={0};  Argument is null or is not a ScopeNode.", new object[]
                {
                    this.tenantId
                });
                return(scopeSubQueryTree);
            }
            string scope = scopeNode.Scope;

            if (this.classificationScopes.Contains(scope))
            {
                ULS.SendTraceTag(5256290U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree :: tenantId={0}; property={1}; Attempt by unauthorized user to access data-loss-prevention properties.", new object[]
                {
                    this.tenantId,
                    scope
                });
                throw new SecurityAccessDeniedException("You do not have access to the property identified in this scope: " + scopeSubQueryTree);
            }
            ULS.SendTraceTag(5578899U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySecurityProducer.ProcessScopeSubQueryTree :: tenantId={0}; scopeSubQueryTree={1}; Erroneously entered ProcessScopeSubQueryTree with an argument that is not a classification property.  This should not have happened because the scopes of the associated operator should only contain classification properties.", new object[]
            {
                this.tenantId,
                scopeSubQueryTree.ToString()
            });
            return(scopeSubQueryTree);
        }
Esempio n. 3
0
 // Token: 0x0600004C RID: 76 RVA: 0x00003314 File Offset: 0x00001514
 protected override IRecordProducer GetProducer(DLPClassificationOperator op, IRecordSetTypeDescriptor type, IEvaluationContext context)
 {
     if (op == null)
     {
         throw new ArgumentNullException("op");
     }
     try
     {
         ULS.SendTraceTag(4850019U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPClassificationEvaluator.GetProducer :: Using Operator :: {0}", new object[]
         {
             op
         });
         if (!DLPClassificationEvaluator.initialized)
         {
             DLPClassificationEvaluator.InitializeClassificationEngine(op.ClassificationConfiguration);
         }
         return(new DLPClassificationEvaluator.DLPClassificationProducer(DLPClassificationEvaluator.classificationService, DLPClassificationEvaluator.ruleStore));
     }
     catch (ThreadAbortException)
     {
     }
     catch (OutOfMemoryException)
     {
         throw;
     }
     catch (Exception ex)
     {
         ULS.SendTraceTag(4850048U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 10, "Exception in DLPClassificationEvaluator.GetProducer :: {0}", new object[]
         {
             ex
         });
     }
     return(null);
 }
Esempio n. 4
0
        // Token: 0x06000093 RID: 147 RVA: 0x00003EE8 File Offset: 0x000020E8
        public TreeNode CreateSubtree()
        {
            ScopeNode        scopeNode = null;
            RangeNode <long> rangeNode = new RangeNode <long>();

            rangeNode.StartInclusive = new bool?(true);
            rangeNode.Start          = this.CountMinimum;
            rangeNode.EndInclusive   = new bool?(true);
            rangeNode.End            = this.CountMaximum;
            ScopeNode scopeNode2 = new ScopeNode("ClassificationCount");

            scopeNode2.FirstChild = rangeNode;
            if (!this.isDefaultConfidenceRange)
            {
                RangeNode <long> rangeNode2 = new RangeNode <long>();
                rangeNode2.StartInclusive = new bool?(true);
                rangeNode2.Start          = this.ConfidenceMinimum;
                rangeNode2.EndInclusive   = new bool?(true);
                rangeNode2.End            = this.ConfidenceMaximum;
                scopeNode            = new ScopeNode("ClassificationConfidence");
                scopeNode.FirstChild = rangeNode2;
            }
            TreeNode treeNode;

            if (this.isDefaultConfidenceRange)
            {
                treeNode = scopeNode2;
            }
            else if (this.isDefaultCountRange)
            {
                treeNode = scopeNode;
            }
            else
            {
                AndNode andNode = new AndNode();
                andNode.AddNode(scopeNode2);
                andNode.AddNode(scopeNode);
                treeNode = andNode;
            }
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(6121180U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "ClassificationDecoding.CreateSubtree :: subtree={0}; Result of transforming the query.", new object[]
                {
                    treeNode
                });
            }
            return(treeNode);
        }
Esempio n. 5
0
 // Token: 0x06000053 RID: 83 RVA: 0x00003804 File Offset: 0x00001A04
 private void EvaluateFlights(string path, string tenantId, IRecord record, out bool crawl, out bool persist)
 {
     crawl   = false;
     persist = false;
     if (VariantConfiguration.IsFeatureEnabled(41, tenantId))
     {
         crawl   = true;
         persist = true;
     }
     ULS.SendTraceTag(4850052U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPClassificationEvaluator.EvaluateFlights :: path=[{0}] crawl={1}  persist={2}", new object[]
     {
         path,
         crawl,
         persist
     });
 }
Esempio n. 6
0
 // Token: 0x0600004D RID: 77 RVA: 0x000033CC File Offset: 0x000015CC
 private static void InitializeClassificationEngine(ClassificationConfiguration configuration)
 {
     if (!DLPClassificationEvaluator.initialized)
     {
         lock (DLPClassificationEvaluator.lockObj)
         {
             if (!DLPClassificationEvaluator.initialized)
             {
                 ULS.SendTraceTag(4850049U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPClassificationEvaluator.InitializeClassificationEngine :: Creating Classification Service");
                 DLPClassificationEvaluator.ruleStore = new FASTClassificationStore();
                 ExecutionLog executionLog = new FASTExcecutionLog();
                 DLPClassificationEvaluator.classificationService = new ClassificationService(DLPClassificationEvaluator.ruleStore, configuration, executionLog);
                 DLPClassificationEvaluator.initialized           = true;
             }
         }
     }
 }
        // Token: 0x0600003C RID: 60 RVA: 0x00002DE0 File Offset: 0x00000FE0
        public void GetRulePackages(uint ulRulePackageRequestDetailsSize, RULE_PACKAGE_REQUEST_DETAILS[] rulePackageRequestDetails)
        {
            if (rulePackageRequestDetails == null)
            {
                return;
            }
            int num = 0;

            while ((long)num < (long)((ulong)ulRulePackageRequestDetailsSize))
            {
                ULS.SendTraceTag(4850013U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetRulePackages :: Requested Package :: {0}", new object[]
                {
                    rulePackageRequestDetails[num].RulePackageID
                });
                ClassificationRuleSet classificationRuleSet = this.ruleSets[rulePackageRequestDetails[num].RulePackageID];
                rulePackageRequestDetails[num].RulePackage = classificationRuleSet.RuleXML;
                num++;
            }
        }
Esempio n. 8
0
        // Token: 0x0600009D RID: 157 RVA: 0x00004740 File Offset: 0x00002940
        private bool CanAccessDataLossPreventionProperties(IRecord record)
        {
            if (record == null)
            {
                throw new ArgumentNullException("record");
            }
            IUpdateableBucketField updateableBucketField = record[this.propertyBagPosition] as IUpdateableBucketField;

            if (updateableBucketField == null)
            {
                ULS.SendTraceTag(5256291U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; The record did not have a 'PropertyBag' entry.   We cannot determine if the user has permission, so we assume not.", new object[]
                {
                    this.tenantId
                });
                return(false);
            }
            IStringField stringField = updateableBucketField["RootWebTemplate"] as IStringField;

            if (stringField == null)
            {
                ULS.SendTraceTag(5256320U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; The record did not have a 'RootWebTemplate' entry in its 'PropertyBag' or the value was not of type IStringField.   We cannot determine if the user has permission, so we assume not.", new object[]
                {
                    this.tenantId
                });
                return(false);
            }
            if (DLPQuerySecurityProducer.AuthorizedWebTemplateIdentifiers.Contains(stringField.StringValue, StringComparer.Ordinal))
            {
                ULS.SendTraceTag(5256321U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; RootWebTemplate={1}; The query comes from an authorized template.  The user, by virtue of having access to an authorized template, has permission to query for data-loss-prevention properties.", new object[]
                {
                    this.tenantId,
                    stringField.StringValue
                });
                return(true);
            }
            ULS.SendTraceTag(5256322U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySecurityProducer.CanAccessDataLossPreventionProperties :: tenantId={0}; RootWebTemplate={1}; The query does not come from an authorized template.  If the query contains data-loss-prevention properties, it will be rejected.  Identifier for the web template where the query originated: ", new object[]
            {
                this.tenantId,
                stringField.StringValue
            });
            return(false);
        }
        // Token: 0x060000AD RID: 173 RVA: 0x00004A44 File Offset: 0x00002C44
        private Guid GetTenantId(IRecord record)
        {
            Guid result = Guid.Empty;

            if (record == null)
            {
                throw new ArgumentNullException("record");
            }
            IField field = record[this.partitionIdPosition];

            if (field != null)
            {
                result = (Guid)field.Value;
            }
            else
            {
                ULS.SendTraceTag(5833438U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveResultTranslationProducer.GetTenantId :: Could not extract the 'PartitionId' entry (which represents the tenant ID) from the record.  Using the empty Guid.");
            }
            return(result);
        }
        // Token: 0x06000034 RID: 52 RVA: 0x00002D1C File Offset: 0x00000F1C
        public RULE_PACKAGE_DETAILS[] GetRulePackageDetails(IClassificationItem classificationItem)
        {
            if (classificationItem == null)
            {
                return(null);
            }
            ULS.SendTraceTag(4850012U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetRulePackageDetails :: ClassificationItem :: {0}", new object[]
            {
                classificationItem.ItemId
            });
            RULE_PACKAGE_DETAILS value = this.defaultRuleDetails.Value;

            if (value.RuleIDs.Length > 0)
            {
                return(new RULE_PACKAGE_DETAILS[]
                {
                    value
                });
            }
            return(null);
        }
Esempio n. 11
0
        // Token: 0x06000049 RID: 73 RVA: 0x0000325C File Offset: 0x0000145C
        public override void LogOneEntry(string client, string tenantId, string correlationId, ExecutionLog.EventType eventType, string tag, string contextData, Exception exception, params KeyValuePair <string, object>[] customData)
        {
            ULSTraceLevel ulstraceLevel = FASTExcecutionLog.ConvertEventTypeToULSLevel(eventType);

            if (exception == null)
            {
                ULS.SendTraceTag(4850017U, ULSCat.msoulscat_SEARCH_DataLossPrevention, ulstraceLevel, "Client : [{0}] ; CorrelationId : [{1}] ; ContextData : [{2}]", new object[]
                {
                    client,
                    correlationId,
                    contextData
                });
                return;
            }
            ULS.SendTraceTag(4850018U, ULSCat.msoulscat_SEARCH_DataLossPrevention, ulstraceLevel, "Client=[{0}]  CorrelationId=[{1}]  ContextData=[{2}]  Exception=[{3}]", new object[]
            {
                client,
                correlationId,
                contextData,
                exception
            });
        }
        // Token: 0x06000033 RID: 51 RVA: 0x00002C80 File Offset: 0x00000E80
        private void LoadDefaultRuleSet()
        {
            ULS.SendTraceTag(4850011U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.LoadDefaultRuleSet :: loading default classification rules");
            Assembly executingAssembly = Assembly.GetExecutingAssembly();
            Stream   stream            = null;

            try
            {
                stream = executingAssembly.GetManifestResourceStream("defaultClassificationRules");
                using (TextReader textReader = new StreamReader(stream))
                {
                    stream = null;
                    this.defaultRuleSet = new ClassificationRuleSet(textReader);
                }
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
            this.ruleSets.Add(this.defaultRuleSet.PackageId, this.defaultRuleSet);
        }
Esempio n. 13
0
        // Token: 0x06000094 RID: 148 RVA: 0x00004000 File Offset: 0x00002200
        private static void TranslateRangeToken(string rangeToken, uint maximum, out uint firstNumber, out uint secondNumber)
        {
            int  num  = -1;
            int  num2 = -1;
            int  num3 = -1;
            int  num4 = -1;
            int  i    = 0;
            bool flag = false;

            char[] array = rangeToken.ToCharArray();
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i >= array.Length)
            {
                firstNumber  = 1U;
                secondNumber = maximum;
                return;
            }
            if (array[i] == '*')
            {
                for (i++; i < array.Length; i++)
                {
                    if (!char.IsWhiteSpace(array[i]))
                    {
                        throw new ArgumentException("The wildcard character must be alone (except for whitespace).  Token: " + rangeToken);
                    }
                }
                firstNumber  = 1U;
                secondNumber = maximum;
                return;
            }
            if (i < array.Length && char.IsDigit(array[i]))
            {
                num = i;
                do
                {
                    i++;
                }while (i < array.Length && char.IsDigit(array[i]));
                num2 = i - 1;
            }
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i < array.Length && object.Equals('.', array[i]))
            {
                flag = true;
                i++;
                if (i >= array.Length || !object.Equals('.', array[i]))
                {
                    throw new ArgumentException(string.Concat(new object[]
                    {
                        "Expected the end of '..' at index ",
                        i,
                        " of ",
                        rangeToken
                    }));
                }
                i++;
            }
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i < array.Length && char.IsDigit(array[i]))
            {
                if (!flag)
                {
                    throw new ArgumentException(string.Concat(new object[]
                    {
                        "Expected '..' between the two numbers at index ",
                        i,
                        " of ",
                        rangeToken
                    }));
                }
                num3 = i;
                while (i < array.Length && char.IsDigit(array[i]))
                {
                    i++;
                }
                num4 = i - 1;
            }
            while (i < array.Length && char.IsWhiteSpace(array[i]))
            {
                i++;
            }
            if (i < array.Length)
            {
                throw new ArgumentException(string.Concat(new object[]
                {
                    "Unexpected characters in the token, starting at index ",
                    i,
                    ", range: ",
                    rangeToken
                }));
            }
            ULS.SendTraceTag(5884048U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "ClassificationDecoding.ctor :: rangeToken={0}, firstNumberStart={1}, firstNumberEnd={2}, secondNumberStart={3}, secondNumberEnd={4}", new object[]
            {
                rangeToken,
                num,
                num2,
                num3,
                num4
            });
            if (num2 >= 0)
            {
                if (flag)
                {
                    if (num4 < 0)
                    {
                        if (!uint.TryParse(new string(array, num, 1 + num2 - num), out firstNumber))
                        {
                            throw new ArgumentException("Failed to parse first number as a 32-bit unsigned integer.");
                        }
                        secondNumber = maximum;
                        return;
                    }
                    else
                    {
                        if (!uint.TryParse(new string(array, num, 1 + num2 - num), out firstNumber))
                        {
                            throw new ArgumentException("Failed to parse first number as a 32-bit unsigned integer.  Range: " + rangeToken);
                        }
                        if (!uint.TryParse(new string(array, num3, 1 + num4 - num3), out secondNumber))
                        {
                            throw new ArgumentException("Failed to parse second number as a 32-bit unsigned integer.  Range: " + rangeToken);
                        }
                        if (firstNumber > secondNumber)
                        {
                            throw new ArgumentException("Illegal range.  The first number is larger than the second.  Range: " + rangeToken);
                        }
                    }
                }
                else
                {
                    if (!uint.TryParse(new string(array, num, 1 + num2 - num), out firstNumber))
                    {
                        throw new ArgumentException("Failed to parse the number as a 32-bit unsigned integer.");
                    }
                    secondNumber = firstNumber;
                }
                return;
            }
            if (num4 < 0)
            {
                throw new ArgumentException("A range must have at least one number.  Range: " + rangeToken);
            }
            if (!uint.TryParse(new string(array, num3, 1 + num4 - num3), out secondNumber))
            {
                throw new ArgumentException("Failed to parse the number as a 32-bit unsigned integer.");
            }
            firstNumber = 1U;
        }
        // Token: 0x060000BF RID: 191 RVA: 0x00004FEC File Offset: 0x000031EC
        protected override TreeNode ProcessScopeSubQueryTree(TreeNode scopeSubQueryTree)
        {
            if (scopeSubQueryTree == null)
            {
                throw new ArgumentNullException("scopeSubQueryTree");
            }
            ScopeNode scopeNode = scopeSubQueryTree as ScopeNode;

            if (scopeNode == null || scopeNode.Scope == null)
            {
                ULS.SendTraceTag(5884049U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: argument={0}; Erroneously entered ProcessScopeSubQueryTree with an argument that is not a ScopeNode.  This should not have happened because the scopes of the associated operator should prevent it.", new object[]
                {
                    scopeSubQueryTree.ToString()
                });
                return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
            }
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(5884050U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: scope={0}; Processing a tree (or subtree) for data loss prevention translation from a virtual property to the actual index property.", new object[]
                {
                    scopeNode.Scope
                });
            }
            string scope = scopeNode.Scope;

            if (string.Equals("SensitiveType", scope, StringComparison.OrdinalIgnoreCase))
            {
                BoundaryNode boundaryNode = scopeNode.Node as BoundaryNode;
                StringNode   stringNode;
                TokenNode    tokenNode;
                if (boundaryNode != null)
                {
                    if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                    {
                        ULS.SendTraceTag(6038296U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Boundary operator mode:{0}; Processing a boundary node in the query tree." + boundaryNode.BoundaryMode);
                    }
                    if (boundaryNode.BoundaryMode != 2 && boundaryNode.BoundaryMode != null)
                    {
                        ULS.SendTraceTag(5884051U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Unexpected boundary operator mode.  For 'SensitiveType' queries, only equality is legal.  Boundary operator mode: " + boundaryNode.BoundaryMode);
                        return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
                    }
                    stringNode = (boundaryNode.Node as StringNode);
                    tokenNode  = (boundaryNode.Node as TokenNode);
                }
                else
                {
                    stringNode = (scopeNode.Node as StringNode);
                    tokenNode  = (scopeNode.Node as TokenNode);
                }
                string text;
                if (stringNode != null)
                {
                    text = stringNode.Text;
                }
                else
                {
                    if (tokenNode == null)
                    {
                        ULS.SendTraceTag(5884052U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: Unexpected node type.  The query looks like it is a 'SensitiveType' style query, but the value portion is not a StringNode or a TokenNode.  Node type: " + boundaryNode.Node.GetType());
                        return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
                    }
                    text = tokenNode.Token;
                }
                if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                {
                    ULS.SendTraceTag(5884053U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: encoding={0}; About to parse the encoding.", new object[]
                    {
                        text
                    });
                }
                SensitiveTypeWildcardExpander sensitiveTypeWildcardExpander = new SensitiveTypeWildcardExpander(text, DLPQuerySensitiveTypeTranslationOperator.Store);
                if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                {
                    ULS.SendTraceTag(5884054U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: About to create the new subtree.");
                }
                return(sensitiveTypeWildcardExpander.CreateSubtree());
            }
            if (string.Equals("SensitiveMatchConfidence", scope, StringComparison.OrdinalIgnoreCase) || string.Equals("SensitiveMatchCount", scope, StringComparison.OrdinalIgnoreCase))
            {
                throw new ArgumentException(scope + " is illegal to use in a query.  You may use it as a select property.  In queries, use SensitiveType");
            }
            ULS.SendTraceTag(5884055U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveTypeTranslationProducer.ProcessScopeSubQueryTree :: scope={0}; This is not a legal scope for this producer.  There must be some error in which the operator has the wrong scopes or a code change is incorrect.  Ignoring and continuing.", new object[]
            {
                scope
            });
            return(base.ProcessScopeSubQueryTree(scopeSubQueryTree));
        }
 // Token: 0x0600003D RID: 61 RVA: 0x00002E56 File Offset: 0x00001056
 public void GetUpdatedRulePackageInfo(uint ulRulePackageTimestampDetailsSize, RULE_PACKAGE_TIMESTAMP_DETAILS[] rulePackageTimestampDetails)
 {
     ULS.SendTraceTag(4850014U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationStore.GetUpdatedRulePackageInfo");
 }
        // Token: 0x060000BE RID: 190 RVA: 0x00004E74 File Offset: 0x00003074
        protected override void ProcessRecordInScopeIterationMode()
        {
            IField field = this.holder[this.tenantIdPosition];

            if (field != null)
            {
                this.tenantId = (Guid)field.Value;
            }
            else
            {
                ULS.SendTraceTag(5833443U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPQuerySensitiveTypeTranslationProducer.ProcessRecordInScopeIterationMode :: Could not extract the tenant ID from the record.  Using the empty Guid.");
            }
            if (!VariantConfiguration.IsFeatureEnabled(39, this.tenantId.ToString()))
            {
                return;
            }
            try
            {
                IUpdateableListField <string> updateableListField = this.holder[this.selectPropertiesPosition] as IUpdateableListField <string>;
                if (updateableListField != null)
                {
                    bool flag  = false;
                    bool flag2 = false;
                    int  num   = 0;
                    while (num < updateableListField.Count && !flag2)
                    {
                        string b = updateableListField[num];
                        if (string.Equals("SensitiveType", b, StringComparison.OrdinalIgnoreCase))
                        {
                            flag2 = true;
                        }
                        else if (string.Equals("SensitiveMatchCount", b, StringComparison.OrdinalIgnoreCase) || string.Equals("SensitiveMatchConfidence", b, StringComparison.OrdinalIgnoreCase))
                        {
                            flag = true;
                        }
                        num++;
                    }
                    if (flag && !flag2)
                    {
                        updateableListField.Add("SensitiveType");
                    }
                }
                base.ProcessRecordInScopeIterationMode();
            }
            catch (ThreadAbortException)
            {
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
            catch (SecurityAccessDeniedException)
            {
                throw;
            }
            catch (ArgumentException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ULS.SendTraceTag(5833472U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 10, "DLPQuerySensitiveTypeTranslationProducer.ProcessRecordInScopeIterationMode :: tenantId={0}; exception={1}", new object[]
                {
                    this.tenantId,
                    ex
                });
                throw;
            }
        }
        // Token: 0x06000017 RID: 23 RVA: 0x000027A4 File Offset: 0x000009A4
        public void SetClassificationResults(ICAClassificationResultCollection results)
        {
            if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
            {
                ULS.SendTraceTag(4850008U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: saving results for [{0}]", new object[]
                {
                    this.ItemId
                });
            }
            IUpdateableBucketField updateableBucketField = this.record[this.managedPropertiesPosition] as IUpdateableBucketField;

            if (updateableBucketField != null)
            {
                if (this.persistClassificationData)
                {
                    updateableBucketField.AddField(this.lastScanPropertyName, StandardFields.GetStandardDateTimeField(new DateTime?(DateTime.UtcNow)), BuiltInTypes.DateTimeType);
                }
                ICollection <long?>  collection  = new List <long?>();
                ICollection <long?>  collection2 = new List <long?>();
                ICollection <string> collection3 = new List <string>();
                HashSet <long>       hashSet     = new HashSet <long>();
                if (results != null && results.Count > 0)
                {
                    this.resultCount = results.Count;
                    for (int i = 0; i < this.resultCount; i++)
                    {
                        ICAClassificationResult icaclassificationResult = results[i + 1];
                        if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                        {
                            ULS.SendTraceTag(4850009U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: Results Found :: package={0} ruleId={1}", new object[]
                            {
                                icaclassificationResult.RulePackageID,
                                icaclassificationResult.ID
                            });
                        }
                        long?resultBase = this.ruleStore.GetResultBase(icaclassificationResult.RulePackageID, icaclassificationResult.ID);
                        if (resultBase == null)
                        {
                            ULS.SendTraceTag(6038295U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationItem.SetClassificationResults :: Unkwown rule ID in result (should not happen). :: package={0} ruleId={1}", new object[]
                            {
                                icaclassificationResult.RulePackageID,
                                icaclassificationResult.ID
                            });
                        }
                        else
                        {
                            long value = resultBase.Value;
                            if (!hashSet.Add(value))
                            {
                                ULS.SendTraceTag(5833436U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "FASTClassificationItem.SetClassificationResults :: Duplicate rule entry is being ignored.  Duplicate rule entries should not happen. :: package={0} ruleId={1}", new object[]
                                {
                                    icaclassificationResult.RulePackageID,
                                    icaclassificationResult.ID
                                });
                            }
                            else
                            {
                                long value2 = value + (long)((int)icaclassificationResult.GetAttributeValue("BD770258-EA9C-4162-B79C-7AD408EC7CD5"));
                                long value3 = value + (long)((int)icaclassificationResult.GetAttributeValue("AFF85B32-1BA9-4EDE-9286-F08A7EE5A421"));
                                collection.Add(new long?(value2));
                                collection2.Add(new long?(value3));
                                collection3.Add(icaclassificationResult.ID);
                            }
                        }
                    }
                    if (this.persistClassificationData && this.resultCount > 0)
                    {
                        if (ULS.ShouldTrace(ULSCat.msoulscat_SEARCH_DataLossPrevention, 100))
                        {
                            ULS.SendTraceTag(4850010U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "FASTClassificationItem.SetClassificationResults :: Updating managed properties");
                        }
                        IUpdateableListField <long?> updateableListField = (IUpdateableListField <long?>)StandardFields.ListDescriptor <long?>(BuiltInTypes.Int64Type).CreateField();
                        updateableListField.Value = collection;
                        updateableBucketField.AddField(this.countPropertyName, updateableListField, BuiltInTypes.ListType(BuiltInTypes.Int64Type));
                        updateableListField       = (IUpdateableListField <long?>)StandardFields.ListDescriptor <long?>(BuiltInTypes.Int64Type).CreateField();
                        updateableListField.Value = collection2;
                        updateableBucketField.AddField(this.confidencePropertyName, updateableListField, BuiltInTypes.ListType(BuiltInTypes.Int64Type));
                        IUpdateableListField <string> updateableListField2 = (IUpdateableListField <string>)StandardFields.ListDescriptor <string>(BuiltInTypes.StringType).CreateField();
                        updateableListField2.Value = collection3;
                        updateableBucketField.AddField(this.typePropertyName, updateableListField2, BuiltInTypes.ListType(BuiltInTypes.StringType));
                    }
                }
            }
        }
Esempio n. 18
0
        // Token: 0x0600009B RID: 155 RVA: 0x0000449C File Offset: 0x0000269C
        protected override void ProcessRecordInScopeIterationMode()
        {
            ULS.SendTraceTag(5256286U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 100, "DLPSecurityTrimmerProducer.ProcessRecordInScopeIterationMode :: record={0}", new object[]
            {
                this.holder
            });
            IField field = this.holder[this.tenantIdPosition];

            if (field != null)
            {
                this.tenantId = (Guid)field.Value;
            }
            else
            {
                ULS.SendTraceTag(5256287U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPSecurityTrimmerProducer.ProcessRecordInScopeIterationMode :: Could not extract the tenant ID from the record.  Using the empty Guid.");
            }
            if (!VariantConfiguration.IsFeatureEnabled(62, this.tenantId.ToString()))
            {
                return;
            }
            try
            {
                this.isDLPAuthorized = this.CanAccessDataLossPreventionProperties(this.holder);
                if (!this.isDLPAuthorized)
                {
                    IListField <string> listField = this.holder[this.selectPropertiesPosition] as IListField <string>;
                    if (listField != null)
                    {
                        for (int i = 0; i < listField.Count; i++)
                        {
                            string text = listField[i];
                            if (this.classificationScopes.Contains(text, StringComparer.OrdinalIgnoreCase))
                            {
                                ULS.SendTraceTag(5256288U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPSecurityTrimmerProducer.ProcessRecordInScopeIterationMode :: tenantId={0}; selectProperty={1}; User is not authorized for data-loss-prevention properties, but attempted to access at least one as a select property.", new object[]
                                {
                                    this.tenantId,
                                    text
                                });
                                throw new SecurityAccessDeniedException("You do not have access to this property: " + text);
                            }
                        }
                    }
                    base.ProcessRecordInScopeIterationMode();
                }
            }
            catch (ThreadAbortException)
            {
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
            catch (SecurityAccessDeniedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ULS.SendTraceTag(5256289U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 10, "DLPSecurityTrimmerProducer.ProcessRecordInScopeIterationMode :: tenantId={0}; exception={1}", new object[]
                {
                    this.tenantId,
                    ex
                });
                throw;
            }
        }
        // Token: 0x060000AE RID: 174 RVA: 0x00004A9C File Offset: 0x00002C9C
        public override void ProcessRecordCore(IRecord record)
        {
            Guid tenantId = this.GetTenantId(record);

            if (!this.isIPClassificationQueryEnabled)
            {
                base.SetNextRecord();
                return;
            }
            IUpdateableBucketField updateableBucketField = record[this.otherPosition] as IUpdateableBucketField;

            if (updateableBucketField != null)
            {
                for (int i = 0; i < updateableBucketField.FieldCount; i++)
                {
                    string text = updateableBucketField.Name(i);
                    if (string.Equals(text, "SensitiveType", StringComparison.OrdinalIgnoreCase))
                    {
                        IUpdateableListField <string> updateableListField = updateableBucketField[text] as IUpdateableListField <string>;
                        if (updateableListField == null)
                        {
                            ULS.SendTraceTag(5833439U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}, fieldName={1}; Found a result entry for the field name (expected to represent the sensitive type list), but its type was not IUpdateableListField<string> or its value was null.  Cannot do any data-loss-prevention result-set translation.", new object[]
                            {
                                tenantId,
                                text
                            });
                        }
                        else
                        {
                            for (int j = 0; j < updateableListField.Count; j++)
                            {
                                string text2 = DLPQuerySensitiveResultTranslationOperator.Store.RuleIdToRuleName(updateableListField[j]);
                                if (text2 == null)
                                {
                                    ULS.SendTraceTag(5833440U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}, fieldIndex={1}, fieldValue={2}; Found a result entry for the field name (expected to represent the sensitive type list), but the value at this index was either null or an invalid rule ID.  Cannot translate this value.", new object[]
                                    {
                                        tenantId,
                                        j,
                                        updateableListField[j]
                                    });
                                }
                                else
                                {
                                    updateableListField[j] = text2;
                                }
                            }
                        }
                    }
                    else if (string.Equals(text, "SensitiveMatchCount", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "SensitiveMatchConfidence", StringComparison.OrdinalIgnoreCase))
                    {
                        IUpdateableListField <long?> updateableListField2 = updateableBucketField[text] as IUpdateableListField <long?>;
                        long?[] array = updateableBucketField[text].Value as long?[];
                        if (array == null || updateableListField2 == null)
                        {
                            ULS.SendTraceTag(5833441U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}, fieldName={1}; Found a result entry for the field name, but its value was null or not of type long?[] or the field was not of type IUpdateableListField<long?>.  Cannot do any data-loss-prevention result-set translation.", new object[]
                            {
                                tenantId,
                                text
                            });
                        }
                        else
                        {
                            for (int k = 0; k < array.Length; k++)
                            {
                                array[k] &= (long)((ulong)-1);
                            }
                            updateableListField2.Value = array;
                        }
                    }
                }
            }
            else
            {
                ULS.SendTraceTag(5833442U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPQuerySensitiveResultTranslationProducer.ProcessRecordCore :: tenantId={0}; The 'Other' field in the record was null, so we cannot do any data-loss-prevention result-set translation.", new object[]
                {
                    tenantId
                });
            }
            base.SetNextRecord();
        }
Esempio n. 20
0
            // Token: 0x06000052 RID: 82 RVA: 0x00003530 File Offset: 0x00001730
            public override void ProcessRecordCore(IRecord record)
            {
                string text = null;

                if (record == null)
                {
                    throw new ArgumentNullException("record");
                }
                IField field = record[this.pathPosition];

                if (field != null)
                {
                    text = (field.Value as string);
                }
                if (string.IsNullOrEmpty(text))
                {
                    base.SetNextRecord();
                    return;
                }
                string text2 = null;

                field = record[this.tenantIdPosition];
                if (field != null && field.Value is Guid)
                {
                    text2 = ((Guid)field.Value).ToString();
                }
                bool flag;
                bool persistClassificationData;

                this.EvaluateFlights(text, text2, record, out flag, out persistClassificationData);
                if (!flag)
                {
                    base.SetNextRecord();
                    return;
                }
                try
                {
                    this.sw.Restart();
                    this.classificationItem.Reset(base.OutputProperties.Holder, text, persistClassificationData, () => base.Aborted);
                    bool flag2 = this.classificationService.Classify(this.classificationItem);
                    this.sw.Stop();
                    if (base.Aborted)
                    {
                        ULS.SendTraceTag(6127683U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 20, "DLPClassificationEvaluator.ProcessRecordCore :: Processing has been aborted :: tenantId={0}; path={1}; ms={2}; charactersProcessed={3}; totalContentLength={4};", new object[]
                        {
                            text2,
                            text,
                            this.sw.ElapsedMilliseconds,
                            this.classificationItem.CharactersProcessed,
                            this.classificationItem.ContentLength
                        });
                    }
                    if (this.classificationItem.ResultCount > 0 || this.classificationItem.IsExcelAlternateFeedUsed || this.sw.ElapsedMilliseconds >= 100L)
                    {
                        ULS.SendTraceTag(4850050U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 50, "DLPClassificationEvaluator.ProcessRecordCore :: tenantId={0}; path={1}; classified={2}; results={3}; ms={4}; excelAlternateFeed={5}; charactersProcessed={6}; aborted={7};", new object[]
                        {
                            text2,
                            text,
                            flag2,
                            this.classificationItem.ResultCount,
                            this.sw.ElapsedMilliseconds,
                            this.classificationItem.IsExcelAlternateFeedUsed,
                            this.classificationItem.CharactersProcessed,
                            base.Aborted
                        });
                    }
                    this.classificationItem.ReleaseObjects();
                    base.SetNextRecord();
                }
                catch (ThreadAbortException)
                {
                }
                catch (OutOfMemoryException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    ULS.SendTraceTag(4850051U, ULSCat.msoulscat_SEARCH_DataLossPrevention, 10, "DLPClassificationEvaluator.ProcessRecordCore :: tenantId={0}; path={1}; Classification failed with exception: {2}", new object[]
                    {
                        text2,
                        text,
                        ex
                    });
                    this.classificationItem.ReleaseObjects();
                    base.SetNextRecord();
                }
            }