/
model_query_annotated.py.pysa
48 lines (45 loc) · 1.3 KB
/
model_query_annotated.py.pysa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
def _test_sink(arg: TaintSink[Test, Via[special_sink]]): ...
def _test_source() -> TaintSource[Test, Via[special_source]]: ...
ModelQuery(
name = "get_test1_sources",
find = "attributes",
where = [
parent.equals("model_query_annotated.Test1_C"),
type_annotation.matches(".*Annotated\[.*Color\..*")
],
model = [
AttributeModel(TaintSource[Test, ViaTypeOf]),
]
)
ModelQuery(
name = "get_test2_sources",
find = "attributes",
where = [
parent.equals("model_query_annotated.Test2_C"),
AnyOf(
type_annotation.equals("typing.Annotated[(typing.Optional[float], model_query_annotated.Color.RED)]"),
type_annotation.equals("typing.Annotated[(typing.Optional[float], model_query_annotated.Color.RED, foo)]")
)
],
model = [
AttributeModel(TaintSource[Test, ViaTypeOf]),
]
)
ModelQuery(
name = "get_test3_sources",
find = "functions",
where = [
name.matches("test3_"),
AnyOf(
any_parameter.annotation.matches(".*Annotated\[.*Color\..*"),
)
],
model = [
Parameters(TaintSource[Test], where=[
AnyOf(
type_annotation.equals("typing.Annotated[(str, model_query_annotated.Color.RED)]"),
type_annotation.equals("typing.Annotated[(str, model_query_annotated.Color.BLUE, foo)]")
)
]),
]
)