private void TrackTaintedDataEnteringSink(
                ISymbol sinkSymbol,
                Location sinkLocation,
                IEnumerable <SinkKind> sinkKinds,
                IEnumerable <SymbolAccess> sources)
            {
                SymbolAccess sink = new SymbolAccess(sinkSymbol, sinkLocation, this.OwningSymbol);

                this.TrackTaintedDataEnteringSink(sink, sinkKinds, sources);
            }
            private void TrackTaintedDataEnteringSink(SymbolAccess sink, IEnumerable <SinkKind> sinkKinds, IEnumerable <SymbolAccess> sources)
            {
                if (!this.TaintedSourcesBySink.TryGetValue(sink, out (ImmutableHashSet <SinkKind> .Builder SinkKinds, ImmutableHashSet <SymbolAccess> .Builder SourceOrigins)data))
                {
                    data = (ImmutableHashSet.CreateBuilder <SinkKind>(), ImmutableHashSet.CreateBuilder <SymbolAccess>());
                    this.TaintedSourcesBySink.Add(sink, data);
                }

                data.SinkKinds.UnionWith(sinkKinds);
                data.SourceOrigins.UnionWith(sources);
            }
Example #3
0
 public TaintedDataSourceSink(SymbolAccess sink, ImmutableHashSet <SinkKind> sinkKinds, ImmutableHashSet <SymbolAccess> sourceOrigins)
 {
     Sink          = sink ?? throw new ArgumentNullException(nameof(sink));
     SinkKinds     = sinkKinds;
     SourceOrigins = sourceOrigins;
 }