"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "interprocedural_analyses/taint/features.ml" between
pyre-check-0.0.54.tar.gz and pyre-check-0.0.55.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

features.ml  (pyre-check-0.0.54):features.ml  (pyre-check-0.0.55)
skipping to change at line 30 skipping to change at line 30
(* Used to determine 'foo' from request.foo and request.GET['foo'] *) (* Used to determine 'foo' from request.foo and request.GET['foo'] *)
| First of { | First of {
kind: first_kind; kind: first_kind;
name: string; name: string;
} }
| FormatString (* Via f"{something}" *) | FormatString (* Via f"{something}" *)
| HasFirst of first_kind | HasFirst of first_kind
| Obscure | Obscure
| Lambda | Lambda
| SimpleVia of string (* Declared breadcrumbs *) | SimpleVia of string (* Declared breadcrumbs *)
| ViaValue of string (* Via inferred from ViaValueOf. *) | ViaValue of {
| ViaType of string (* Via inferred from ViaTypeOf. *) tag: string option;
value: string;
}
(* Via inferred from ViaValueOf. *)
| ViaType of {
tag: string option;
value: string;
}
(* Via inferred from ViaTypeOf. *)
| Tito | Tito
| Type of string (* Type constraint *) | Type of string (* Type constraint *)
[@@deriving show, compare] [@@deriving show, compare]
let to_json ~on_all_paths breadcrumb = let to_json ~on_all_paths breadcrumb =
let prefix = if on_all_paths then "always-" else "" in let prefix = if on_all_paths then "always-" else "" in
let via_value_tag tag =
match tag with
| Some tag -> "-of-" ^ tag
| _ -> ""
in
match breadcrumb with match breadcrumb with
| First { name; kind = FirstField } -> `Assoc [prefix ^ "first-field", `Stri ng name] | First { name; kind = FirstField } -> `Assoc [prefix ^ "first-field", `Stri ng name]
| First { name; kind = FirstIndex } -> `Assoc [prefix ^ "first-index", `Stri ng name] | First { name; kind = FirstIndex } -> `Assoc [prefix ^ "first-index", `Stri ng name]
| FormatString -> `Assoc [prefix ^ "via", `String "format-string"] | FormatString -> `Assoc [prefix ^ "via", `String "format-string"]
| HasFirst FirstField -> `Assoc [prefix ^ "has", `String "first-field"] | HasFirst FirstField -> `Assoc [prefix ^ "has", `String "first-field"]
| HasFirst FirstIndex -> `Assoc [prefix ^ "has", `String "first-index"] | HasFirst FirstIndex -> `Assoc [prefix ^ "has", `String "first-index"]
| Obscure -> `Assoc [prefix ^ "via", `String "obscure"] | Obscure -> `Assoc [prefix ^ "via", `String "obscure"]
| Lambda -> `Assoc [prefix ^ "via", `String "lambda"] | Lambda -> `Assoc [prefix ^ "via", `String "lambda"]
| SimpleVia name -> `Assoc [prefix ^ "via", `String name] | SimpleVia name -> `Assoc [prefix ^ "via", `String name]
| ViaValue name -> `Assoc [prefix ^ "via-value", `String name] | ViaValue { tag; value } -> `Assoc [prefix ^ "via-value" ^ via_value_tag ta
| ViaType name -> `Assoc [prefix ^ "via-type", `String name] g, `String value]
| ViaType { tag; value } -> `Assoc [prefix ^ "via-type" ^ via_value_tag tag,
`String value]
| Tito -> `Assoc [prefix ^ "via", `String "tito"] | Tito -> `Assoc [prefix ^ "via", `String "tito"]
| Type name -> `Assoc [prefix ^ "type", `String name] | Type name -> `Assoc [prefix ^ "type", `String name]
let simple_via ~allowed name = let simple_via ~allowed name =
if List.mem allowed name ~equal:String.equal then if List.mem allowed name ~equal:String.equal then
SimpleVia name SimpleVia name
else else
Format.sprintf "Unrecognized Via annotation `%s`" name |> failwith Format.sprintf "Unrecognized Via annotation `%s`" name |> failwith
end end
skipping to change at line 75 skipping to change at line 88
leaf: string; leaf: string;
port: string option; port: string option;
} }
| CrossRepositoryTaintInformation of { | CrossRepositoryTaintInformation of {
producer_id: int; producer_id: int;
canonical_name: string; canonical_name: string;
canonical_port: string; canonical_port: string;
} }
| TitoPosition of Location.WithModule.t | TitoPosition of Location.WithModule.t
| Breadcrumb of Breadcrumb.t | Breadcrumb of Breadcrumb.t
| ViaValueOf of { position: int } | ViaValueOf of {
| ViaTypeOf of { position: int } position: int;
tag: string option;
}
| ViaTypeOf of {
position: int;
tag: string option;
}
[@@deriving show, compare] [@@deriving show, compare]
let via_value_of_breadcrumb ~argument:{ Expression.Call.Argument.value; _ } = let via_value_of_breadcrumb ?tag ~argument:{ Expression.Call.Argument.value; _ } =
let feature = let feature =
Interprocedural.CallResolution.extract_constant_name value Interprocedural.CallResolution.extract_constant_name value
|> Option.value ~default:"<unknown>" |> Option.value ~default:"<unknown>"
in in
Breadcrumb (Breadcrumb.ViaValue feature) Breadcrumb (Breadcrumb.ViaValue { value = feature; tag })
let via_type_of_breadcrumb ~resolution ~argument:{ Expression.Call.Argument.va lue; _ } = let via_type_of_breadcrumb ?tag ~resolution ~argument:{ Expression.Call.Argume nt.value; _ } =
let feature = let feature =
Resolution.resolve_expression resolution value |> snd |> Type.weaken_liter als |> Type.show Resolution.resolve_expression resolution value |> snd |> Type.weaken_liter als |> Type.show
in in
Breadcrumb (Breadcrumb.ViaType feature) Breadcrumb (Breadcrumb.ViaType { value = feature; tag })
end end
module SimpleSet = Abstract.OverUnderSetDomain.Make (Simple) module SimpleSet = Abstract.OverUnderSetDomain.Make (Simple)
let strip_simple_feature_for_callsite features = let strip_simple_feature_for_callsite features =
let strip feature = let strip feature =
match feature.Abstract.OverUnderSetDomain.element with match feature.Abstract.OverUnderSetDomain.element with
| Simple.TitoPosition _ -> None | Simple.TitoPosition _ -> None
| _ -> Some feature | _ -> Some feature
in in
 End of changes. 8 change blocks. 
10 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)