diff --git a/source/interprocedural/callGraph.ml b/source/interprocedural/callGraph.ml index 9e31e99dadb..7044399bc16 100644 --- a/source/interprocedural/callGraph.ml +++ b/source/interprocedural/callGraph.ml @@ -620,18 +620,43 @@ end (** An aggregate of all possible callees for a given identifier expression, i.e `foo`. *) module IdentifierCallees = struct - type t = { global_targets: CallTarget.t list } [@@deriving eq, show { with_path = false }] + type t = { + global_targets: CallTarget.t list; + nonlocal_targets: CallTarget.t list; + } + [@@deriving eq, show { with_path = false }] - let deduplicate { global_targets } = { global_targets = CallTarget.dedup_and_sort global_targets } + type identifier_reference = + | Global of Reference.t + | Nonlocal of Reference.t - let join { global_targets = left_global_targets } { global_targets = right_global_targets } = - { global_targets = List.rev_append left_global_targets right_global_targets } + let deduplicate { global_targets; nonlocal_targets } = + { + global_targets = CallTarget.dedup_and_sort global_targets; + nonlocal_targets = CallTarget.dedup_and_sort nonlocal_targets; + } - let all_targets { global_targets } = List.map ~f:CallTarget.target global_targets + let join + { global_targets = left_global_targets; nonlocal_targets = left_nonlocal_targets } + { global_targets = right_global_targets; nonlocal_targets = right_nonlocal_targets } + = + { + global_targets = List.rev_append left_global_targets right_global_targets; + nonlocal_targets = List.rev_append left_nonlocal_targets right_nonlocal_targets; + } + + + let all_targets { global_targets; nonlocal_targets } = + List.map ~f:CallTarget.target (global_targets @ nonlocal_targets) - let to_json { global_targets } = - `Assoc ["globals", `List (List.map ~f:CallTarget.to_json global_targets)] + + let to_json { global_targets; nonlocal_targets } = + `Assoc + [ + "globals", `List (List.map ~f:CallTarget.to_json global_targets); + "nonlocals", `List (List.map ~f:CallTarget.to_json nonlocal_targets); + ] end (** An aggregate of callees for formatting strings. *) @@ -1723,12 +1748,14 @@ let resolve_attribute_access_properties { property_targets; is_attribute } -let as_global_reference ~resolution expression = +let as_identifier_reference ~define ~resolution expression = match Node.value expression with | Expression.Name (Name.Identifier identifier) -> let reference = Reference.create identifier in if Resolution.is_global resolution ~reference then - Some (Reference.delocalize reference) + Some (IdentifierCallees.Global (Reference.delocalize reference)) + else if CallResolution.is_nonlocal ~resolution ~define reference then + Some (IdentifierCallees.Nonlocal (Reference.delocalize reference)) else None | Name name -> ( @@ -1738,20 +1765,31 @@ let as_global_reference ~resolution expression = >>= function | UnannotatedGlobalEnvironment.ResolvedReference.ModuleAttribute { from; name; remaining = []; _ } -> - Some (Reference.combine from (Reference.create name)) + Some (IdentifierCallees.Global (Reference.combine from (Reference.create name))) | _ -> None) | _ -> None -let is_builtin_reference reference = reference |> Reference.single |> Option.is_some +let is_builtin_reference = function + | IdentifierCallees.Global reference -> reference |> Reference.single |> Option.is_some + | Nonlocal _ -> false -let resolve_attribute_access_global_targets ~resolution ~base_annotation ~base ~attribute ~special = + +let resolve_attribute_access_global_targets + ~define + ~resolution + ~base_annotation + ~base + ~attribute + ~special + = let expression = Expression.Name (Name.Attribute { Name.Attribute.base; attribute; special }) |> Node.create_with_default_location in - match as_global_reference ~resolution expression with - | Some global -> [global] + match as_identifier_reference ~define ~resolution expression with + | Some (IdentifierCallees.Global global) -> [global] + | Some (Nonlocal _) -> [] | None -> let global_resolution = Resolution.global_resolution resolution in let rec find_targets targets = function @@ -1805,24 +1843,38 @@ let resolve_attribute_access_global_targets ~resolution ~base_annotation ~base ~ find_targets [] base_annotation -let resolve_identifier ~resolution ~call_indexer ~identifier = +let resolve_identifier ~define ~resolution ~call_indexer ~identifier = Expression.Name (Name.Identifier identifier) |> Node.create_with_default_location - |> as_global_reference ~resolution + |> as_identifier_reference ~define ~resolution |> Option.filter ~f:(Fn.non is_builtin_reference) - >>| Target.create_object - >>| fun global -> - { - IdentifierCallees.global_targets = - [ - CallTargetIndexer.create_target - call_indexer - ~implicit_self:false - ~implicit_dunder_call:false - ~return_type:None - global; - ]; - } + >>| function + | IdentifierCallees.Global global -> + { + IdentifierCallees.global_targets = + [ + CallTargetIndexer.create_target + call_indexer + ~implicit_self:false + ~implicit_dunder_call:false + ~return_type:None + (Target.create_object global); + ]; + nonlocal_targets = []; + } + | Nonlocal nonlocal -> + { + IdentifierCallees.nonlocal_targets = + [ + CallTargetIndexer.create_target + call_indexer + ~implicit_self:false + ~implicit_dunder_call:false + ~return_type:None + (Target.create_object nonlocal); + ]; + global_targets = []; + } (* This is a bit of a trick. The only place that knows where the local annotation map keys is the @@ -1836,6 +1888,8 @@ module DefineCallGraphFixpoint (Context : sig val qualifier : Reference.t + val name : Reference.t + val parent : Reference.t option val debug : bool @@ -2004,7 +2058,13 @@ struct in let global_targets = - resolve_attribute_access_global_targets ~resolution ~base_annotation ~base ~attribute ~special + resolve_attribute_access_global_targets + ~define:Context.name + ~resolution + ~base_annotation + ~base + ~attribute + ~special |> List.map ~f:Target.create_object (* Use a hashset here for faster lookups. *) |> List.filter ~f:(Hash_set.mem attribute_targets) @@ -2105,7 +2165,7 @@ struct |> ExpressionCallees.from_attribute_access |> register_targets ~expression_identifier:attribute | Expression.Name (Name.Identifier identifier) -> - resolve_identifier ~resolution ~call_indexer ~identifier + resolve_identifier ~define:Context.name ~resolution ~call_indexer ~identifier >>| ExpressionCallees.from_identifier >>| register_targets ~expression_identifier:identifier |> ignore @@ -2419,6 +2479,8 @@ let call_graph_of_define let qualifier = qualifier + let name = name + let parent = parent let debug = Ast.Statement.Define.dump define || Ast.Statement.Define.dump_call_graph define diff --git a/source/interprocedural/callGraph.mli b/source/interprocedural/callGraph.mli index 7478794224a..9de66b07eed 100644 --- a/source/interprocedural/callGraph.mli +++ b/source/interprocedural/callGraph.mli @@ -159,7 +159,11 @@ end (** An aggregate of all possible callees for a given identifier expression, i.e `foo`. *) module IdentifierCallees : sig - type t = { global_targets: CallTarget.t list } [@@deriving eq, show] + type t = { + global_targets: CallTarget.t list; + nonlocal_targets: CallTarget.t list; + } + [@@deriving eq, show] val to_json : t -> Yojson.Safe.t end diff --git a/source/interprocedural/test/callGraphTest.ml b/source/interprocedural/test/callGraphTest.ml index 7d528db4148..1931b33bdd9 100644 --- a/source/interprocedural/test/callGraphTest.ml +++ b/source/interprocedural/test/callGraphTest.ml @@ -1745,6 +1745,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~return_type:None (Target.Object "test.d")]; + nonlocal_targets = []; } ); ( "__getitem__", ExpressionCallees.from_attribute_access @@ -2874,6 +2875,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~return_type:None (Target.Object "test.x")]; + nonlocal_targets = []; }) ); ] (); @@ -4878,6 +4880,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~index:0 ~return_type:None (Target.Object "test.x")]; + nonlocal_targets = []; }) ); ( "10:2-10:3", LocationCallees.Singleton @@ -4885,6 +4888,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~index:0 ~return_type:None (Target.Object "test.y")]; + nonlocal_targets = []; }) ); ( "12:2-12:8", LocationCallees.Singleton @@ -4903,6 +4907,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~index:1 ~return_type:None (Target.Object "test.x")]; + nonlocal_targets = []; }) ); ( "13:2-13:8", LocationCallees.Singleton @@ -4921,6 +4926,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~index:1 ~return_type:None (Target.Object "test.y")]; + nonlocal_targets = []; }) ); ] (); @@ -4944,6 +4950,7 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~return_type:None (Target.Object "test.x")]; + nonlocal_targets = []; }) ); ] (); @@ -5049,10 +5056,10 @@ let test_call_graph_of_define context = { IdentifierCallees.global_targets = [CallTarget.create ~return_type:None (Target.Object "test.x")]; + nonlocal_targets = []; }) ); ] (); - (* TODO(T165690928): Add nonlocal to call graph *) assert_call_graph_of_define ~source: {| @@ -5063,7 +5070,37 @@ let test_call_graph_of_define context = x = "str" |} ~define_name:"$local_test?outer$inner" - ~expected:[] + ~expected: + [ + ( "6:4-6:5", + LocationCallees.Singleton + (ExpressionCallees.from_identifier + { + IdentifierCallees.nonlocal_targets = + [CallTarget.create ~return_type:None (Target.Object "test.outer.x")]; + global_targets = []; + }) ); + ] + (); + assert_call_graph_of_define + ~source:{| + def outer(): + x = "" + def inner(): + y = x + |} + ~define_name:"$local_test?outer$inner" + ~expected: + [ + ( "5:8-5:9", + LocationCallees.Singleton + (ExpressionCallees.from_identifier + { + IdentifierCallees.nonlocal_targets = + [CallTarget.create ~return_type:None (Target.Object "test.outer.x")]; + global_targets = []; + }) ); + ] (); () diff --git a/source/interprocedural_analyses/taint/globalModel.ml b/source/interprocedural_analyses/taint/globalModel.ml index e0f26d3f442..129850f15d5 100644 --- a/source/interprocedural_analyses/taint/globalModel.ml +++ b/source/interprocedural_analyses/taint/globalModel.ml @@ -32,7 +32,7 @@ let get_global_targets ~call_graph ~expression = call_graph ~location:(Node.location expression) ~identifier - >>| (fun { global_targets } -> global_targets) + >>| (fun { global_targets; nonlocal_targets = _ } -> global_targets) |> Option.value ~default:[] | Expression.Name (Name.Attribute { attribute; _ }) -> CallGraph.DefineCallGraph.resolve_attribute_access diff --git a/source/interprocedural_analyses/taint/test/integration/closure.py.cg b/source/interprocedural_analyses/taint/test/integration/closure.py.cg index 97183482f73..05ac7b7b257 100644 --- a/source/interprocedural_analyses/taint/test/integration/closure.py.cg +++ b/source/interprocedural_analyses/taint/test/integration/closure.py.cg @@ -1,16 +1,16 @@ @generated Call dependencies -$local_closure?parameter_order_swap_different_variable_names$inner (fun) -> [_test_sink (fun)] +$local_closure?parameter_order_swap_different_variable_names$inner (fun) -> [_test_sink (fun) closure.parameter_order_swap_different_variable_names.a (object) closure.parameter_order_swap_different_variable_names.b (object) closure.parameter_order_swap_different_variable_names.c (object)] $local_closure?parameter_order_swap$inner (fun) -> [_test_sink (fun)] -$local_closure?side_effect_reduction_closure$inner (fun) -> [_test_sink (fun)] +$local_closure?side_effect_reduction_closure$inner (fun) -> [_test_sink (fun) closure.side_effect_reduction_closure.x (object)] $local_closure?wrapper_for_taint_propagation$inner (fun) -> [_test_sink (fun)] $local_closure?wrapper_for_taint_propagation_hof$inner (fun) -> [_test_sink (fun)] closure.parameter_order_swap_different_variable_names (fun) -> [$local_closure?parameter_order_swap_different_variable_names$inner (fun)] closure.wrapper_for_taint_propagation_hof (fun) -> [$local_closure?wrapper_for_taint_propagation_hof$inner (fun) closure.higher_order_function (fun)] -$local_closure?closure$sink (fun) -> [_test_sink (fun)] -$local_closure?closure$source (fun) -> [_test_source (fun)] -$local_closure?nonlocal_closure$sink (fun) -> [_test_sink (fun)] -$local_closure?nonlocal_closure$source (fun) -> [_test_source (fun)] +$local_closure?closure$sink (fun) -> [_test_sink (fun) closure.closure.obj (object)] +$local_closure?closure$source (fun) -> [_test_source (fun) closure.closure.obj (object)] +$local_closure?nonlocal_closure$sink (fun) -> [_test_sink (fun) closure.nonlocal_closure.obj (object)] +$local_closure?nonlocal_closure$source (fun) -> [_test_source (fun) closure.nonlocal_closure.obj (object)] closure.$toplevel (fun) -> [] closure.closure (fun) -> [object.__init__ (method) object.__new__ (method)] closure.closure_flow (fun) -> [closure.closure (fun)] diff --git a/source/interprocedural_analyses/taint/test/integration/decorator.py.cg b/source/interprocedural_analyses/taint/test/integration/decorator.py.cg index 03660fb60d5..bde7733fe89 100644 --- a/source/interprocedural_analyses/taint/test/integration/decorator.py.cg +++ b/source/interprocedural_analyses/taint/test/integration/decorator.py.cg @@ -1,34 +1,34 @@ @generated Call dependencies -$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?bar$_original_function (fun)] -$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs_no_sink2 (fun) -> [$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs (fun)] -$local_decorator?Foo?foo$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?foo$_original_function (fun)] -$local_decorator?Foo?self_has_generic_type$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?self_has_generic_type$_original_function (fun)] -$local_decorator?Foo?some_class_method$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?some_class_method$_original_function (fun)] -$local_decorator?foo_args_kwargs$_inlined_with_logging_args_kwargs (fun) -> [$local_decorator?foo_args_kwargs$_original_function (fun) _test_sink (fun)] -$local_decorator?foo_args_kwargs_with_sink$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?foo_args_kwargs_with_sink$_original_function (fun)] -$local_decorator?foo_log_first_parameter$_inlined_with_logging_first_parameter (fun) -> [$local_decorator?foo_log_first_parameter$_original_function (fun) _test_sink (fun) int.__eq__ (method) int.__ne__ (method)] -$local_decorator?foo_using_decorator_factory$_inlined_with_named_logger (fun) -> [$local_decorator?foo_using_decorator_factory$_original_function (fun) _test_sink (fun) print (fun)] -$local_decorator?foo_with_helper_function$_inlined_with_logging_helper_functions (fun) -> [$local_decorator?foo_with_helper_function$_original_function (fun) $local_decorator?foo_with_helper_function?_inlined_with_logging_helper_functions$after (fun) $local_decorator?foo_with_helper_function?_inlined_with_logging_helper_functions$before (fun) isinstance (fun) print (fun)] +$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?bar$_original_function (fun) decorator.Foo.bar._original_function (object)] +$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs_no_sink2 (fun) -> [$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs (fun) decorator.Foo.bar._inlined_with_logging_args_kwargs (object)] +$local_decorator?Foo?foo$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?foo$_original_function (fun) decorator.Foo.foo._original_function (object)] +$local_decorator?Foo?self_has_generic_type$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?self_has_generic_type$_original_function (fun) decorator.Foo.self_has_generic_type._original_function (object)] +$local_decorator?Foo?some_class_method$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?Foo?some_class_method$_original_function (fun) decorator.Foo.some_class_method._original_function (object)] +$local_decorator?foo_args_kwargs$_inlined_with_logging_args_kwargs (fun) -> [$local_decorator?foo_args_kwargs$_original_function (fun) _test_sink (fun) decorator.foo_args_kwargs._original_function (object)] +$local_decorator?foo_args_kwargs_with_sink$_inlined_with_logging_args_kwargs_no_sink (fun) -> [$local_decorator?foo_args_kwargs_with_sink$_original_function (fun) decorator.foo_args_kwargs_with_sink._original_function (object)] +$local_decorator?foo_log_first_parameter$_inlined_with_logging_first_parameter (fun) -> [$local_decorator?foo_log_first_parameter$_original_function (fun) _test_sink (fun) decorator.foo_log_first_parameter._original_function (object) int.__eq__ (method) int.__ne__ (method)] +$local_decorator?foo_using_decorator_factory$_inlined_with_named_logger (fun) -> [$local_decorator?foo_using_decorator_factory$_original_function (fun) _test_sink (fun) decorator.foo_using_decorator_factory._original_function (object) print (fun)] +$local_decorator?foo_with_helper_function$_inlined_with_logging_helper_functions (fun) -> [$local_decorator?foo_with_helper_function$_original_function (fun) $local_decorator?foo_with_helper_function?_inlined_with_logging_helper_functions$after (fun) $local_decorator?foo_with_helper_function?_inlined_with_logging_helper_functions$before (fun) decorator.foo_with_helper_function._original_function (object) isinstance (fun) print (fun)] $local_decorator?foo_with_helper_function?_inlined_with_logging_helper_functions$after (fun) -> [_test_sink (fun) print (fun)] $local_decorator?foo_with_helper_function?_inlined_with_logging_helper_functions$before (fun) -> [print (fun)] -$local_decorator?foo_with_shady_decorators$_inlined_with_logging_sink (fun) -> [$local_decorator?foo_with_shady_decorators$_original_function (fun) _test_sink (fun)] -$local_decorator?foo_with_shady_decorators$_inlined_with_logging_source (fun) -> [$local_decorator?foo_with_shady_decorators$_inlined_with_logging_sink (fun) _test_source (fun) str.__add__ (method)] -$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs (fun) -> [$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs_no_sink (fun) _test_sink (fun)] +$local_decorator?foo_with_shady_decorators$_inlined_with_logging_sink (fun) -> [$local_decorator?foo_with_shady_decorators$_original_function (fun) _test_sink (fun) decorator.foo_with_shady_decorators._original_function (object)] +$local_decorator?foo_with_shady_decorators$_inlined_with_logging_source (fun) -> [$local_decorator?foo_with_shady_decorators$_inlined_with_logging_sink (fun) _test_source (fun) decorator.foo_with_shady_decorators._inlined_with_logging_sink (object) str.__add__ (method)] +$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs (fun) -> [$local_decorator?Foo?bar$_inlined_with_logging_args_kwargs_no_sink (fun) _test_sink (fun) decorator.Foo.bar._inlined_with_logging_args_kwargs_no_sink (object)] $local_decorator?Foo?bar$_original_function (fun) -> [print (fun)] $local_decorator?Foo?foo$_original_function (fun) -> [decorator.Foo.sink_method (method)] $local_decorator?Foo?self_has_generic_type$_original_function (fun) -> [decorator.Foo.bar (method)] $local_decorator?Foo?some_class_method$_original_function (fun) -> [decorator.Foo.sink_method (method) object.__init__ (method) object.__new__ (method)] -$local_decorator?foo$_inlined_with_logging (fun) -> [$local_decorator?foo$_original_function (fun) _test_sink (fun)] +$local_decorator?foo$_inlined_with_logging (fun) -> [$local_decorator?foo$_original_function (fun) _test_sink (fun) decorator.foo._original_function (object)] $local_decorator?foo_args_kwargs$_original_function (fun) -> [print (fun)] $local_decorator?foo_args_kwargs_with_sink$_original_function (fun) -> [_test_sink (fun)] -$local_decorator?foo_async$_inlined_with_logging_async (fun) -> [$local_decorator?foo_async$_original_function (fun) _test_sink (fun)] +$local_decorator?foo_async$_inlined_with_logging_async (fun) -> [$local_decorator?foo_async$_original_function (fun) _test_sink (fun) decorator.foo_async._original_function (object)] $local_decorator?foo_async$_original_function (fun) -> [print (fun)] $local_decorator?foo_log_first_parameter$_original_function (fun) -> [print (fun)] $local_decorator?foo_using_decorator_factory$_original_function (fun) -> [print (fun)] $local_decorator?foo_with_helper_function$_original_function (fun) -> [print (fun)] $local_decorator?foo_with_shady_decorators$_original_function (fun) -> [print (fun)] -$local_decorator?foo_with_sink$_inlined_with_logging_no_sink (fun) -> [$local_decorator?foo_with_sink$_original_function (fun)] +$local_decorator?foo_with_sink$_inlined_with_logging_no_sink (fun) -> [$local_decorator?foo_with_sink$_original_function (fun) decorator.foo_with_sink._original_function (object)] $local_decorator?foo_with_sink$_original_function (fun) -> [_test_sink (fun) print (fun)] $local_decorator?with_logging_args_kwargs$inner (fun) -> [_test_sink (fun)] $local_decorator?with_logging_args_kwargs_no_sink$inner (fun) -> [] @@ -36,7 +36,7 @@ $local_decorator?with_logging_async$inner (fun) -> [_test_sink (fun)] $local_decorator?with_logging_first_parameter$inner (fun) -> [_test_sink (fun) int.__eq__ (method) int.__ne__ (method)] $local_decorator?with_logging_helper_functions$after (fun) -> [_test_sink (fun) print (fun)] $local_decorator?with_logging_helper_functions$before (fun) -> [print (fun)] -$local_decorator?with_logging_helper_functions$inner (fun) -> [$local_decorator?with_logging_helper_functions$after (fun) $local_decorator?with_logging_helper_functions$before (fun) isinstance (fun) print (fun)] +$local_decorator?with_logging_helper_functions$inner (fun) -> [$local_decorator?with_logging_helper_functions$after (fun) $local_decorator?with_logging_helper_functions$before (fun) decorator.with_logging_helper_functions.after (object) decorator.with_logging_helper_functions.before (object) isinstance (fun) print (fun)] $local_decorator?with_logging_no_sink$inner (fun) -> [] $local_decorator?with_logging_sink$inner (fun) -> [_test_sink (fun)] $local_decorator?with_logging_source$inner (fun) -> [_test_source (fun) str.__add__ (method)] diff --git a/source/interprocedural_analyses/taint/test/integration/decorator_location.py.cg b/source/interprocedural_analyses/taint/test/integration/decorator_location.py.cg index 7107f06bdb3..ac68c6a19f6 100644 --- a/source/interprocedural_analyses/taint/test/integration/decorator_location.py.cg +++ b/source/interprocedural_analyses/taint/test/integration/decorator_location.py.cg @@ -1,24 +1,24 @@ @generated Call dependencies -$local_decorator_location?decorated_logging2_skip_this_decorator$_inlined_with_logging2 (fun) -> [$local_decorator_location?decorated_logging2_skip_this_decorator$_original_function (fun) _test_sink (fun)] +$local_decorator_location?decorated_logging2_skip_this_decorator$_inlined_with_logging2 (fun) -> [$local_decorator_location?decorated_logging2_skip_this_decorator$_original_function (fun) _test_sink (fun) decorator_location.decorated_logging2_skip_this_decorator._original_function (object)] $local_decorator_location?decorated_logging2_skip_this_decorator$_original_function (fun) -> [_test_sink (fun)] -$local_decorator_location?decorated_logging_ignore_this_decorator$_inlined_with_logging (fun) -> [$local_decorator_location?decorated_logging_ignore_this_decorator$_original_function (fun) $local_decorator_location?decorated_logging_ignore_this_decorator?_inlined_with_logging$some_helper (fun) _test_sink (fun)] +$local_decorator_location?decorated_logging_ignore_this_decorator$_inlined_with_logging (fun) -> [$local_decorator_location?decorated_logging_ignore_this_decorator$_original_function (fun) $local_decorator_location?decorated_logging_ignore_this_decorator?_inlined_with_logging$some_helper (fun) _test_sink (fun) decorator_location.decorated_logging_ignore_this_decorator._original_function (object)] $local_decorator_location?decorated_logging_ignore_this_decorator$_original_function (fun) -> [_test_sink (fun)] $local_decorator_location?decorated_logging_ignore_this_decorator?_inlined_with_logging$some_helper (fun) -> [_test_sink (fun) print (fun)] -$local_decorator_location?decorated_logging_logging2$_inlined_with_logging (fun) -> [$local_decorator_location?decorated_logging_logging2$_inlined_with_logging2 (fun) $local_decorator_location?decorated_logging_logging2?_inlined_with_logging$some_helper (fun) _test_sink (fun)] -$local_decorator_location?decorated_logging_logging2$_inlined_with_logging2 (fun) -> [$local_decorator_location?decorated_logging_logging2$_original_function (fun) _test_sink (fun)] +$local_decorator_location?decorated_logging_logging2$_inlined_with_logging (fun) -> [$local_decorator_location?decorated_logging_logging2$_inlined_with_logging2 (fun) $local_decorator_location?decorated_logging_logging2?_inlined_with_logging$some_helper (fun) _test_sink (fun) decorator_location.decorated_logging_logging2._inlined_with_logging2 (object)] +$local_decorator_location?decorated_logging_logging2$_inlined_with_logging2 (fun) -> [$local_decorator_location?decorated_logging_logging2$_original_function (fun) _test_sink (fun) decorator_location.decorated_logging_logging2._original_function (object)] $local_decorator_location?decorated_logging_logging2$_original_function (fun) -> [_test_sink (fun)] $local_decorator_location?decorated_logging_logging2?_inlined_with_logging$some_helper (fun) -> [_test_sink (fun) print (fun)] -$local_decorator_location?handle_request$_inlined_pass_local_variable_to_x (fun) -> [$local_decorator_location?handle_request$_original_function (fun) _test_sink (fun)] +$local_decorator_location?handle_request$_inlined_pass_local_variable_to_x (fun) -> [$local_decorator_location?handle_request$_original_function (fun) _test_sink (fun) decorator_location.handle_request._original_function (object)] $local_decorator_location?ignore_this_decorator_factory$decorator (fun) -> [] $local_decorator_location?ignore_this_decorator_factory?decorator$inner (fun) -> [int.__add__ (method)] $local_decorator_location?handle_request$_original_function (fun) -> [_test_sink (fun)] $local_decorator_location?identity$inner (fun) -> [] $local_decorator_location?pass_local_variable_to_x$inner (fun) -> [_test_sink (fun)] -$local_decorator_location?return_foo$_inlined_identity (fun) -> [$local_decorator_location?return_foo$_original_function (fun)] +$local_decorator_location?return_foo$_inlined_identity (fun) -> [$local_decorator_location?return_foo$_original_function (fun) decorator_location.return_foo._original_function (object)] $local_decorator_location?return_foo$_original_function (fun) -> [object.__init__ (method) object.__new__ (method)] $local_decorator_location?skip_this_decorator$inner (fun) -> [_test_sink (fun)] -$local_decorator_location?with_logging$inner (fun) -> [$local_decorator_location?with_logging$some_helper (fun) _test_sink (fun)] +$local_decorator_location?with_logging$inner (fun) -> [$local_decorator_location?with_logging$some_helper (fun) _test_sink (fun) decorator_location.with_logging.some_helper (object)] $local_decorator_location?with_logging$some_helper (fun) -> [_test_sink (fun) print (fun)] $local_decorator_location?with_logging2$inner (fun) -> [_test_sink (fun)] decorator_location.decorated_ignore_then_skip_decorator (fun) -> [_test_sink (fun)] diff --git a/source/interprocedural_analyses/taint/test/integration/nested_callables.py.cg b/source/interprocedural_analyses/taint/test/integration/nested_callables.py.cg index 8da07d28881..12138a183bd 100644 --- a/source/interprocedural_analyses/taint/test/integration/nested_callables.py.cg +++ b/source/interprocedural_analyses/taint/test/integration/nested_callables.py.cg @@ -2,8 +2,8 @@ Call dependencies $local_nested_callables?access_parameter_in_inner_scope_sink$inner (fun) -> [_test_sink (fun)] $local_nested_callables?access_parameter_in_inner_scope_tito$inner (fun) -> [] -$local_nested_callables?access_variables_in_outer_scope_issue$inner (fun) -> [_test_sink (fun)] -$local_nested_callables?access_variables_in_outer_scope_source$inner (fun) -> [] +$local_nested_callables?access_variables_in_outer_scope_issue$inner (fun) -> [_test_sink (fun) nested_callables.access_variables_in_outer_scope_issue.x (object)] +$local_nested_callables?access_variables_in_outer_scope_source$inner (fun) -> [nested_callables.access_variables_in_outer_scope_source.x (object)] $local_nested_callables?outer_calling_other_function$inner_calling_other_function (fun) -> [nested_callables.some_sink (fun)] $local_nested_callables?foo$inner_with_model (fun) -> [_test_source (fun)] $local_nested_callables?test_mutation_of_class$set_a (fun) -> [_test_source (fun)]