diff --git a/infer/src/quandary/JavaTrace.ml b/infer/src/quandary/JavaTrace.ml index 22a89ed36..37aa388d1 100644 --- a/infer/src/quandary/JavaTrace.ml +++ b/infer/src/quandary/JavaTrace.ml @@ -69,7 +69,7 @@ module SourceKind = struct let procedure = class_name ^ "." ^ method_name in IList.find_map_opt (fun (source_spec : QuandaryConfig.Source.t) -> - if String.equal source_spec.procedure procedure + if Str.string_match source_spec.procedure procedure 0 then Some (of_string source_spec.kind) else None) external_sources @@ -236,7 +236,7 @@ module SinkKind = struct let procedure = class_name ^ "." ^ method_name in IList.find_map_opt (fun (sink_spec : QuandaryConfig.Sink.t) -> - if String.equal sink_spec.procedure procedure + if Str.string_match sink_spec.procedure procedure 0 then let kind = of_string sink_spec.kind in try diff --git a/infer/src/quandary/QuandaryConfig.ml b/infer/src/quandary/QuandaryConfig.ml index 7ee2ef75d..9bbef5d81 100644 --- a/infer/src/quandary/QuandaryConfig.ml +++ b/infer/src/quandary/QuandaryConfig.ml @@ -14,38 +14,32 @@ module F = Format (** utilities for importing JSON specifications of sources/sinks into Quandary *) module Source = struct - type t = { procedure : string; kind : string; } + type t = { procedure : Str.regexp; kind : string; } let of_json = function | `List sources -> let parse_source json = let open Yojson.Basic.Util in - let procedure = json |> member "procedure" |> to_string in + let procedure = json |> member "procedure" |> to_string |> Str.regexp in let kind = json |> member "kind" |> to_string in { procedure; kind; } in IList.map parse_source sources | _ -> [] - - let pp fmt { procedure; kind; } = - F.fprintf fmt "Procedure: %s Kind: %s" procedure kind end module Sink = struct - type t = { procedure : string; kind : string; index : string} + type t = { procedure : Str.regexp; kind : string; index : string} let of_json = function | `List sinks -> let parse_sink json = let open Yojson.Basic.Util in - let procedure = json |> member "procedure" |> to_string in + let procedure = json |> member "procedure" |> to_string |> Str.regexp in let kind = json |> member "kind" |> to_string in let index = json |> member "index" |> to_string in { procedure; kind; index; } in IList.map parse_sink sinks | _ -> [] - - let pp fmt { procedure; kind; index; } = - F.fprintf fmt "Procedure: %s Kind: %s Index %s" procedure kind index end diff --git a/infer/src/quandary/QuandaryConfig.mli b/infer/src/quandary/QuandaryConfig.mli index 44e573490..77b8127a9 100644 --- a/infer/src/quandary/QuandaryConfig.mli +++ b/infer/src/quandary/QuandaryConfig.mli @@ -12,17 +12,13 @@ open! IStd (** utilities for importing JSON specifications of sources/sinks into Quandary*) module Source : sig - type t = { procedure : string; kind : string; } + type t = { procedure : Str.regexp; kind : string; } val of_json : [> `List of Yojson.Basic.json list ] -> t list - - val pp : Format.formatter -> t -> unit end module Sink : sig - type t = { procedure : string; kind : string; index : string; } + type t = { procedure : Str.regexp; kind : string; index : string; } val of_json : [> `List of Yojson.Basic.json list ] -> t list - - val pp : Format.formatter -> t -> unit end diff --git a/infer/tests/codetoanalyze/java/quandary/.inferconfig b/infer/tests/codetoanalyze/java/quandary/.inferconfig index d54b8916a..53ab60cb7 100644 --- a/infer/tests/codetoanalyze/java/quandary/.inferconfig +++ b/infer/tests/codetoanalyze/java/quandary/.inferconfig @@ -1,7 +1,7 @@ { "quandary-sources": [ { - "procedure": "codetoanalyze.java.quandary.ExternalSpecs.privateDataSource", + "procedure": "codetoanalyze.java.quandary.ExternalSpecs.privateData*", "kind": "PrivateData" } ],