[quandary] Simplify endpoints config

Reviewed By: ngorogiannis

Differential Revision: D13465306

fbshipit-source-id: 18d25d048
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent 19faf643dc
commit a6d78db9b5

@ -54,8 +54,6 @@ module SourceKind = struct
(QuandaryConfig.Source.of_json Config.quandary_sources)
let endpoints = String.Set.of_list (QuandaryConfig.Endpoint.of_json Config.quandary_endpoints)
(* return a list of source kinds if [procedure_name] is in the list of externally specified sources *)
let get_external_source qualified_pname =
let return = None in
@ -164,7 +162,7 @@ module SourceKind = struct
(Typ.Procname.ObjC_Cpp.get_class_name cpp_pname)
(Typ.Procname.get_method pname)
in
if String.Set.mem endpoints qualified_pname then
if QuandaryConfig.is_endpoint qualified_pname then
taint_all_but_this_and_return ~make_source:(fun name desc ->
UserControlledEndpoint (name, desc) )
else if overrides_service_method pname tenv then

@ -74,9 +74,7 @@ module Sanitizer = struct
[]
end
module Endpoint = struct
type t = string
module Endpoints = struct
let of_json = function
| `List endpoints ->
let parse_endpoint = Yojson.Basic.Util.to_string in
@ -84,3 +82,7 @@ module Endpoint = struct
| _ ->
[]
end
let is_endpoint =
let endpoints = lazy (String.Set.of_list (Endpoints.of_json Config.quandary_endpoints)) in
fun name -> String.Set.mem (Lazy.force endpoints) name

@ -27,9 +27,4 @@ module Sanitizer : sig
val of_json : [> `List of Yojson.Basic.json list] -> t list
end
module Endpoint : sig
(** name of endpoint class *)
type t = string
val of_json : [> `List of Yojson.Basic.json list] -> t list
end
val is_endpoint : string -> bool

@ -116,14 +116,10 @@ module Make (TaintSpecification : TaintSpec.S) = struct
access_tree
let endpoints =
lazy (String.Set.of_list (QuandaryConfig.Endpoint.of_json Config.quandary_endpoints))
let is_endpoint source =
match CallSite.pname (TraceDomain.Source.call_site source) with
| Typ.Procname.Java java_pname ->
String.Set.mem (Lazy.force endpoints) (Typ.Procname.Java.get_class_name java_pname)
QuandaryConfig.is_endpoint (Typ.Procname.Java.get_class_name java_pname)
| _ ->
false

Loading…
Cancel
Save